3

I installed xdm on my raspberry pi os with apt, at the end of the installation, it prompt me to choose default display manager and I chose xdm instead of previously installed lightdm.

Now when I power it on, for some reason it cannot load display manager and I left with a black screen. Even I can not go to another tty with ctr+alt.

How can I switch back to lightdm by modifying files in SD card using another computer?

jsotola
  • 705
  • 1
  • 9
  • 13
parsa2820
  • 133
  • 6

1 Answers1

3

There's a good chance this is just the X server borking and not the whole system failing.

Try holding down Ctrl Alt and then slowly cycling through F1 -> F6. If at some point you see a few lines of text followed by a raspberrypi login: prompt, stop.

You should be able to log in and from there:

sudo dpkg-reconfigure lightdm

Then check cat /etc/X11/default-display-manager, you should get back /usr/sbin/lightdm. You can then reboot and hopefully things are better.


If you cannot do that but you can access the second partition from another computer, you could try:

  • Changing the content of /etc/X11/default-display-manager to /usr/sbin/lightdm

  • There is a symlink, /etc/systemd/system/display-manager.service, to a file in /lib/systemd/system/; remove it and change it to point to the lightdm service file:

      sudo rm /etc/systemd/system/display-manager.service
      sudo ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
    

The dpkg-reconfigure program (it looks to be a perl wrapper on dpkg) does at least that, and quite possibly that might be it all it does.

My first idea here was to change the systemd default target from graphical to multi-user, but I suspect this will not actually stop the GUI from starting.

However, if you can create symlinks on whatever system you use to access the card, and the above does not work, you could try deleting /etc/systemd/system/default.target, which is just a symlink, then replace it with:

ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

If it does disable the GUI, this should boot to console and you can try dpkg-reconfigure, the reset the default target (within a running system: sudo systemctl set-default graphical.target.

goldilocks
  • 60,325
  • 17
  • 117
  • 234