Ubuntu 21.10 - GDM problem - login screen
I just upgrade my desktop from Ubuntu 21.04 to 21.10. Everything works fine! I was happy.
But after that, I run a wrong program that will change the background of the graphical login screen to another picture.
Mostly likely the Script that I run: I downloaded the following program during 21.04 and install and run it.
github.com/thiggy01/gdm-background
gdm-background/gdm-background-helper /
#!/usr/bin/env python3
import distro
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
import shutil
from subprocess import call
class GDMBackground(dbus.service.Object):
if distro.id() == 'ubuntu':
default_theme = '/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource'
elif distro.id() == 'pop':
default_theme = '/usr/share/gnome-shell/theme/Pop/gnome-shell-theme.gresource'
backup_theme = default_theme + '~'
def __init__(self, conn=None, object_path=None, bus_name=None):
dbus.service.Object.__init__(self, conn, object_path, bus_name)
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='b',
sender_keyword='sender', connection_keyword='conn')
def SetImage(self, task, sender=None, conn=None):
action_id = 'xyz.thiggy01.GDMBackground.SetImage'
if self._check_polkit_privilege(sender, conn, action_id):
if task == 'backup':
shutil.copy(self.default_theme, self.backup_theme)
elif task == 'set':
shutil.move("/tmp/gdm3/theme/gnome-shell-theme.gresource", self.default_theme)
return True
else:
return False
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='b',
sender_keyword='sender', connection_keyword='conn')
def RestoreBackup(self, task, sender=None, conn=None):
action_id = 'xyz.thiggy01.GDMBackground.RestoreBackup'
if self._check_polkit_privilege(sender, conn, action_id):
if task == 'restore':
shutil.move(self.backup_theme, self.default_theme)
return True
else:
return False
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='',
sender_keyword='sender', connection_keyword='conn')
def RestartGDM(self, action_id, sender=None, conn=None):
if self._check_polkit_privilege(sender, conn, action_id):
call(['/usr/sbin/service', 'gdm', 'restart'])
def _check_polkit_privilege(self, sender, conn, action_id):
if sender is None and conn is None:
return
self.proxy_dbus = dbus.Interface(conn.get_object('org.freedesktop.DBus',
'/org/freedesktop/DBus/Bus', False), 'org.freedesktop.DBus')
sender_pid = self.proxy_dbus.GetConnectionUnixProcessID(sender)
self.proxy_polkit = dbus.Interface(dbus.SystemBus().get_object(
'org.freedesktop.PolicyKit1', '/org/freedesktop/PolicyKit1/Authority', False),
'org.freedesktop.PolicyKit1.Authority')
try:
(is_auth, is_challenge, details) = self.proxy_polkit.CheckAuthorization(
('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
'start-time': dbus.UInt64(0, variant_level=1)}),
action_id, {'':''}, dbus.UInt32(1), 'cancel')
if is_auth:
return True
else:
return False
except dbus.DBusException as error:
self.proxy_polkit.CancelCheckAuthorization('cancel')
raise
if __name__ == '__main__':
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
name = dbus.service.BusName('xyz.thiggy01.GDMBackground', bus)
gdm_background_helper = GDMBackground(name, '/xyz/thiggy01/GDMBackground')
GLib.MainLoop().run()
After that the Ubuntu 21.10 cannot load the graphical login screen anymore.
There is an error on the screen: Monitor SAD face with the message "Oh no! Something has gone wrong." A problem has occurred and the system can't recover. Please contact a system administrator.
I try troubleshoot the problem by running Ubuntu 21.10 using recovery mode. Then go to the root and using the commands:
sudo apt install ubuntu-gnome-desktop
systemctl status gdm
systemctl start gdm
It doesn't work at all.
I suspect the program / script I run has conflict the set up of GNOME 40 with Ubuntu 21.04. Please help me to get back the original GUI login screen setting.
I try to login to Ubuntu 21.04 using CTRL-SHIFT-F3. Then I type:
systemctl status gdm3
gdm.service is active (running)
Starting GNOME Display Manager.....
But there is an error message:
Gdm: GdmDisplay: Session never registered, failing
Gdm: Child process -2037 was already dead.
Solution 1:
I had the same problem. First you'll need to get to a recovery root console. Pressing left shift or escape during boot should do it. https://wiki.ubuntu.com/RecoveryMode
What might be sufficient
I installed lightdm, but I'm not sure if installing lightdm and switching back to gdm3 was required. This might work:
sudo apt reinstall gdm3 gnome-shell yaru-theme-gnome-shell
sudo service gdm3 restart
What I did
First I ran the restore option to put the original file back. No effect. I used a different script with a --restore flag, not the Python code you posted. It looks like both of them just do this:
mv /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource~ \
/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
Then I installed lightdm.
# Should install then show UI to switch from gdm3 to lightdm
sudo apt install lightdm
Rebooted and that worked, but UI was glitchy once I logged back into Gnome. For example: hitting the Super key brought up the app search box, but icons were drawn overlapping and flickering like a framebuffer issue. Also lightdm showed Ubuntu version 21.04 in the bottom left corner. I don't think lightdm + gnome is properly supported in 21.10 yet.
Finally, I reinstalled gdm3, gnome-shell, and the yaru theme and switched from lightdm back to gdm.
sudo apt reinstall gdm3 gnome-shell yaru-theme-gnome-shell
# Switch back to gdm3
sudo dpkg-reconfigure gdm3
Rebooted and everything works again, still the same default background image for gdm3. It is beyond tedious that it requires hacking to change a background image, but here we are.