I barely use any Debian linux distribution although it’s quite popular such as Ubuntu desktop is widely used on personal computer.
A few weeks ago a friend asked me what to do with his old laptop with Windows 7 which is end of life, he would like to give it to his young kid to study computer technology. So I helped him to restage laptop with the Ubuntu desktop. The GUI of linux is a distant thing to me since I always work on that dark terminal window when using Linux. I was impressed with the Ubuntu’s desktop. It’s fast and you can do whatever things you usually do on a Windows system. Especially nowdays everything is on cloud. All you need is just a browser.
Last week he came to see me again with the laptop because all of sudden he could not login into the desktop anymore. He typed in the password and it just returned the login screen right away. I had no idea either. As usual we just googled. Lots of people had the same issue and they were talking about the file “.Xauthority” — a file saved under each user home directory and is used to store credentials in cookies used by xauth for authentication of X sessions. It might get a wrong owership or permissions.
The first thing was that we need to get into a terminal window to check. Ubuntu has 7 virtual consoles (ttys) and ctrl+alt+F1~F7 can be used to switch them. With Ubuntu version 20.04 we have, tty1 (ctrl+alt+F1) is used by X Window (the desktop). Using ctrl+alt+F2 gave us a terminal window. After login, I could see there was no .Xauthority file, even user directory was gone! I thought that might be the problem so I went ahead and recreated the user home directories. Still we could not login into the desktop.
As other people suggested, I even tried update the system and re-installed the desktop:
sudo apt update sudo apt dist-upgrade sudo apt autoremove sudo apt clean sudo apt remove ubuntu-desktop sudo apt install ubuntu-desktop
Still had the same issue. Kept looking around and finally I saw the error in the system log /var/log/syslog
mount: /home: cannot mount; probably corrupted filesystem on /dev/sda5
Ha, that was it! That’s why the user home directories disappeared. Tried to use “e2fsck” to fix the partition without any luck. Since it’s just a personal device, we went ahead to re-create the ext4 filesystem on it and mounted it — the problem fixed. We are able to login into the desktop again.
Not sure what happened, but best guess was the system was not shutdown cleanly which caused the corruption on the partition.