Stuck in command line upon reboot in Ubuntu 18.04.4. Can't access Ubuntu GUI
Solution 1
I faced this exact issue.
Before I locked my screen, I wanted to remove all Evolution package files, and made the mistake of doing so by executing sudo apt remove --purge evolution-*
.
After I locked the screen, I faced the exact scenario that you described.
Turns out, my mistake removed the ubuntu-desktop
package as well (I don't know why).
Installed it again using - sudo apt install ubuntu-desktop
and then sudo reboot
- voila! Got my desktop back.
Edit: Purging Evolution didn't remove ubuntu-desktop
per se, it just deleted some files that support the package.
Solution 2
I guess,
- packages that related to graphical stack updated
- reboot
- display-manager(GDM) service launching fail
- you got console login
Did you some special action before this happen? Like install some new packages or edit some systemd config files.
If not, you could try easy one first. Update system(packages) in hope to some bug already fixed and published. After console login, type this command.
sudo apt update && sudo apt upgrade
If it ended well, reboot. sudo reboot
If you have same situation after update and reboot, you have two options.
- Reinstall - Only if you have data and configs well backed up, and you can set desktop setting, applications, etc up very quick and easily. about to 30min - 1hour. Your daily apps are only two or three (like web browser) and used on most default settings, this is quite practical. Backup that apps configs and data to usb stick then good to go. But in the end same bug/fail could be happened.
- Fix problem
Two basic and essential commands for digging system problem is,
- systemctl
- journalctl
run systemctl
, then it shows services(process) that running, exited, failed. You can search string by type /
key. input something - try 'fail' first - then enter. n
for move to next match. you can navigate by arrows, pgup/pgdn.
If you can see some service failed, read their logs with journalctl
.
# view kernel message + all services logs from current booting only
jorunalctl -b
# view logs from current booting only + specific service
journalctl -b -u example.service
If your network connection is OK, then could share those outputs with other like us. First install package for text online share service(pastebin.com).
sudo apt install pastebinit
Then upload text like this,
journalctl -b -u gdm.service | pastebinit
It would spit out short URL.
Related videos on Youtube
Techi-Joe
System.out.println("I do fun thing with code to make my life easier!")
Updated on September 18, 2022Comments
-
Techi-Joe over 1 year
recently I restarted my Ubuntu laptop for the first time and was met with a command line that asked for a login and then a password. At first, I was unable to figure out my password but was eventually able to reset it using recovery mode. However this is when I realized that I was in the command line for linux, fully logged into the system, mind you, but unable to access the GUI. After doing some research online I was able to find a solution using the "startx" command. However, when I do that it simply throws the error "xinit: connection to X server lost". Upon further inspection, it appears that this command is intended for server-hosted linux machines, not my internally-run one. I also tried "sudo init 1-6", but they all just reset me to the same command prompt. Ctrl Alt F1-F12 also have no effect. I've provided a screenshot below that shows what I get when I login to the command prompt and attempt to use "startx". Hope someone can help me with this. Thanks!
I should add that what lead me to reboot my laptop was a weird glitch I experienced with Ubuntu on the GUI login screen, where it would constantly give an authentication error upon selecting my user icon from the list of icons. Basically, I would click on my user icon (techi) be prompted with the password window where you type your password, but before I could type anything some orange text (the type you normally get for mistyping the password) would appear saying that there was an authentication error. after like 1.5 seconds it would then immediately go back to the user selection window.
*UPDATE (same day): I was able to recover some of my files by loading up Ubuntu through a USB, however when I tried logging out as the USB user and logging back in through the "not listed?" feature on the user selection page my username and password wouldn't work.
**UPDATE (4-5-20): I gave up and just reinstalled Ubuntu since it seems that seeking a fix is more trouble then it's worth. Since this was a secondary laptop that I only use for casual programming on the side, a OS reset wasn't a big deal. Now the laptop is working fine. However, if you know how to fix this problem feel free to post it below for other people who don't want to reset. Thank you all for your help!
-
gnubeard about 4 yearsDoes Ctrl-Alt-F2 have any effect? If not, can you try the command:
unity
? -
Techi-Joe about 4 years@gnubeard ctrl-alt-F2 puts me in a second console window. unity returns a warning: g_settings_value: value for key 'visual-bell-type' in schema 'org.gnome.wm.preferences is outside of valid range
-
Techi-Joe about 4 years@gnubeard there is also a Warning that no display value has been set
-
Admin about 4 yearsWhat happens if you type "startx" at the prompt? It should be deprecated by now, but I once got into a recalcitrant Lubuntu GUI thanks to it, about a month ago.
-
Techi-Joe about 4 years@Didier nope, same error as described in the original post
-
Admin about 4 yearsOK. Since you're at the prompt and (I suppose) you have access to the Internet, how about a "sudo apt-get update && sudo apt-get upgrade"? What does it give you? Your version of Ubuntu is outdated by a year and a half, at best, as versions go. That could explain why you're locked out of your PC.
-
Techi-Joe about 4 yearsI gave up and just reinstalled Ubuntu since it seems that seeking a fix is more trouble then it's worth. Since this was a secondary laptop that I only use for casual programming on the side, a OS reset wasn't a big deal. Now the laptop is working fine. However, if you know how to fix this problem feel free to post it below for other people who don't want to reset. Thank you all for your help!
-
-
Techi-Joe about 4 yearsTried to update/upgrade apt, did not change anything. systemctl shows all processes working as expected.
-
Techi-Joe about 4 yearsAll I did is remove some old versions of python (2.7 and 3.6) because I had 3.8 installed and wanted to have pip work with it. I also installed pip and py2exe
-
dontdieych about 4 yearsIn systemctl list, there should be 'display-manager.service' or 'gdm.service'. That is what responsible for launching graphical desktop environment.
-
dontdieych about 4 yearsI've assumed you installed default ubuntu. not like kubuntu or some other flavor.
-
Techi-Joe over 3 yearsMost likely you are correct, I remember messing around with desktop before rebooting and having this issue. However I have no way of knowing since the computer battery failed and now it's bricked.