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?

2
  • Does the green ACT led behave normally (frequent irregular flashing for the first ~20s or so after power on)?
    – goldilocks
    Oct 16, 2022 at 12:54
  • nope. it is completely normal
    – parsa2820
    Oct 17, 2022 at 20:09

1 Answer 1

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.

4
  • thanks for your answer; but as i mentioned, i can not change tty with ctrl+alt
    – parsa2820
    Oct 16, 2022 at 10:10
  • 1
    Whoops, missed that :\ I've added a few possibilities above you can apply from another computer on the SD card.
    – goldilocks
    Oct 16, 2022 at 13:12
  • Actually /etc/systemd/system/display-manager.service was a link to /lib/systemd/system/lxdm.service. I changed it to /lib/systemd/system/lightdm.service and now it works just fine. Thanks for you help.
    – parsa2820
    Oct 17, 2022 at 20:30
  • Hmmph, dunno how I missed that, edited to reflect.
    – goldilocks
    Oct 18, 2022 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.