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
.