introduction
My Ubuntu 24.04 desktop unexpectedly boot into tty1 presenting a shell interface to interact with on bootup.
The above image shows the tty1 output.
Sometimes this happens when one accidentally removes critical components such as the desktop environment or Python. In my case, I had installed Python while trying to solve other issues I encountered with Python3.
Step 1: Login to tty1 {tty(n)} with your username and password
First, log in with your username and password to access the system. This way we can run commands and possibly recover the desktop UI.
Step 2: Confirm you have access to the internet
Once logged in, you have to confirm if you have an internet connection. The easiest way to do this is to run the ping
command to the internet, and select any address or domain name available.
ping google.com
If you have an internet connection you will receive packets from the address or domain. Therefore you can skip to step 4.
If you cant receive packets, don't worry, we've got you. You can connect to a LAN or move closer to a WLAN connection and proceed to establish a connection to the internet.
Step 3: Recover an internet connection
In linux, everything can be represented using a file format and this also includes all the network interfaces on the Network Interface Card(NIC). NIC has the ethernet LAN interface and the Wireless LAN (Wi-Fi) interface. These interfaces are stored in the /sys/class/net
file. so we proceed to list them.
ls -l /sys/class/net
The LAN interface starts with an e while the WLAN interface starts with w. Note down the interface names.
Connecting the interfaces has several ways.
- use network management interface command
nmtui
If nmtui
command is available you can easily get the connection established via the interface that pops up from running running the nmtui
command.
nmtui
- Modify configs
In somecases nmtui
is not available and even netplan
command was not available due to damaged packages and missing packages. As was in my case. Here we have to modify configs. For LAN or wired connection, we can establish a connection without modifying configs while for Wireless connection, we have to modify configs.
You can confirm the state of the link or interfaces whether they are up or down using the ip a
command
ip a
As highlighted here the ethernet and wireless interfaces might be in down state.
wired connection
Connect the LAN cable from your router to the LAN port of your computer
sudo ifconfig eth0 up
change eth0 to your interface label. The interface will now show up on ifconfig
command.
If you are using DHCP on your router then
sudo dhclient eth0
The LAN link will obtain an IP address and running simple ping command will return packets from the internet. If you have to assign an IP address you can use the following command.
ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
route add default gw GATEWAY-IP eth0
If it has worked up to here you can proceed to step 4. If the wired connection hasn't worked, lets try the wireless connection route.
wireless connection
For establishing a wireless connection from recovery terminal, checkout the following reference Reference 1, Reference 2
Step 4: Check and repair packages
Update packages and that there are no broken packages since we now have an internet connection.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get --fix-broken install
let all these run and install
Step 5: confirm dgm or dgm3
Confirm the display manager is installed or not
Step 6: Install ubuntu-desktop
Now reinstall the Ubuntu desktop UI
sudo apt-get install ubuntu-desktop
Step 7: Install and configure the display manager dgm3
sudo apt-get install gdm3
Properly configure the display manager by running the following command
sudo dpkg-reconfigure gdm3
Step 8: Reboot
Reboot system to apply changes
sudo reboot
Upon bootup, your Ubuntu UI built on GNOME desktopenvironment should now pop up.
Conclusion
Thank you. Hope this helps you recover your Ubuntu desktop when the internet connection is not available. When any other issues arise, you can proceed to trouble shoot further. It is important to back up configuration files to avoid loosing initial state during troubleshooting.
Top comments (1)
Thankyou!, i got the same issue when working with python, but now it solved 🙌