diff --git a/debian/lightdm-failure-handler.service b/debian/lightdm-failure-handler.service new file mode 100644 index 00000000..8b317cc6 --- /dev/null +++ b/debian/lightdm-failure-handler.service @@ -0,0 +1,9 @@ +[Unit] +Description=Handle LightDM failure + +[Service] +Type=oneshot +ExecStart=/bin/mv /etc/issue /etc/issue.restore; /bin/sh -c 'echo -e "LightDM has failed to start. You are now in a TTY for troubleshooting...\nYou can log in and check for details in logs." > /etc/issue; /usr/bin/chvt 4' + +[Install] +WantedBy=multi-user.target diff --git a/debian/lightdm-success-handler.service b/debian/lightdm-success-handler.service new file mode 100644 index 00000000..7976de41 --- /dev/null +++ b/debian/lightdm-success-handler.service @@ -0,0 +1,11 @@ +[Unit] +Description=Reset /etc/issue after LightDM starts successfully +Requires=lightdm.service +After=lightdm.service + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'test -f /etc/issue.restore && mv /etc/issue.restore /etc/issue || echo "File /etc/issue.restore not found. No restore action needed."' + +[Install] +WantedBy=graphical.target diff --git a/debian/lightdm.service b/debian/lightdm.service index 6bb1968d..cd7c7eb3 100644 --- a/debian/lightdm.service +++ b/debian/lightdm.service @@ -3,6 +3,9 @@ Description=Light Display Manager Documentation=man:lightdm(1) Conflicts=getty@tty7.service plymouth-quit.service After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service systemd-hostnamed.service +StartLimitIntervalSec=60s +StartLimitBurst=5 +OnFailure=lightdm-failure-handler.service [Service] # temporary safety check until all DMs are converted to correct @@ -10,4 +13,5 @@ After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service sys ExecStartPre=/bin/sh -c '[ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "lightdm" ]' ExecStart=/usr/sbin/lightdm Restart=always +RestartSec=5s BusName=org.freedesktop.DisplayManager