Recently when starting up an Ubuntu GNOME VM, I couldn't seem to login as it would immediately drop me back to the login screen as if I hadn't logged in at all. In fact, what I was seeing was GDM restarting silently and restarting my session.
I rebooted the VM and attempted to restart GDM with
systemctl restart gdm, but that made things worse as now GDM wouldn't even load and all I got was a flickering screen!
Finally managing to get a console and running
journalctl | tail led me to output like the below:
Jun 13 10:51:25 achapman-ubuntu-vm gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0) Jun 13 10:51:25 achapman-ubuntu-vm systemd-logind: New session c680 of user gdm. Jun 13 10:51:25 achapman-ubuntu-vm systemd: Started Session c680 of user gdm. Jun 13 10:51:25 achapman-ubuntu-vm /usr/lib/gdm3/gdm-x-session: Unable to run X server Jun 13 10:51:25 achapman-ubuntu-vm gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm Jun 13 10:51:26 achapman-ubuntu-vm systemd-logind: Removed session c680. Jun 13 10:51:26 achapman-ubuntu-vm gdm3: Child process -17472 was already dead. Jun 13 10:51:26 achapman-ubuntu-vm gdm3: Child process 17469 was already dead. Jun 13 10:51:26 achapman-ubuntu-vm gdm3: Unable to kill session worker process
Not very helpful because all we're seeing is dead processes and sessions failing to open.
After beating my head against a brick wall for a while, I realised the cause was actually deceptively simple: the VM was out of disk space:
[email protected]:~$ df -h Filesystem Size Used Avail Use% Mounted on udev 2.0G 0 2.0G 0% /dev tmpfs 400M 27M 374M 7% /run /dev/mapper/ubuntu--gnome--vg-root 18G 17G 0 100% / /dev/sda1 472M 220M 229M 49% /boot /home/achapman/.Private 18G 17G 0 100% /home/achapman
This meant GDM could not even create the session files it needs to run, but instead of failing gracefully, it just sits there trying over and over again.
So if you're seeing "Unable to run X server" errors, GDM is failing to start or getting "session closed for user gdm" errors, it's worth checking that you have free disk space for GDM to start!
Sometimes, it's the simple things that are the hardest to find...