Important:
I find that you can avoid a lot of update-related issues by running
apt installinside a virtual TTY withCtrl+Alt+F3(or F4, F5, etc..) instead of the normal graphical desktop. This would hopefully prevent a black screen since there is no active display server to crash. See below if you still get a black screenThis guide is for systems using systemd
First of all, do not immediately reboot/shutdown the machine. It's possible that an update (especially for GPU drivers) caused the display server to crash, but the update is still running in the background.
You can try switching TTY's with Ctrl+Alt+F# with any function key from F3-F6 (might also be worth trying the full range from F1-F9) and see if anything happens. If it's completely unresponsive, wait at least 5 minutes before restarting in case the update is somehow still running or even longer to be safe (may be the reason I'm writing this). On a good day, the display server might even come back by itself.
After rebooting:
If it says that dpkg was interrupted during an update (but not during a critical kernel one, lucky!), run
sudo dpkg --configure -aThis should finish installing the updates and fix most issues for you. Try apt installing again to check if there still problems.
Enter the emergency shell by pressing Enter and try the systemctl options mentioned in the report. If they all return to the same emergency mode screen, enter the shell again.
Read the logs from
journalctl -xb(boot logs with explanations where available) and try to figure out where the issue stems from. Look for the red text to see critical errors.
If it is likely a broken kernel issue from the interrupted update, try rebooting from an old kernel backup. You can see the current kernel with
uname -r
# 6.16.2-12345-generic
## or
file /boot/vmlinuz
# /boot/vmlinuz: symbolic link to vmlinuz-6.16.2-12345-generic
## or
file /boot/initrd.img
# /boot/initrd.img: symbolic link to initrd.img-6.16.2-12345-generic- vmlinuz (virtual memory linux gzip) is a compressed version of the kernel, and initrd (initial RAM disk) is a temporary filesystem for loading kernel modules. These are used together to start the boot process before mounting your actual filesystem
- the only thing you need to care about here is their version number (e.g.
6.16.2-12345-generic)
and check for saved kernels with
ls /boot/vmlinuz*You'll want to later boot into /boot/vmlinuz.old, which you can check the kernel version it links to with
file /boot/vmlinuz.old
# /boot/vmlinuz.old: symbolic link to vmlinuz-6.12.10-12345-genericThis is an old version of the kernel (e.g. 6.12.10-12345-generic) saved as a backup in cases like these. (if you don't have this, ggs)
Remember this version for the next steps.
- Try rebooting with
systemctl reboot, but if you're here then that probably won't work. In that case, forcibly shutdown the machine with the power button and reboot. - During the reboot, repeatedly press
Spaceto bring up systemd-boot's boot menu, and select the old kernel version. - Hopefully you'll boot into a functional kernel again, where you can resume the update with
sudo dpkg --configure -a. Make sure to do this in a TTY withCtrl+Alt+F3. - Reboot into the normal kernel again (shouldn't have to enter the boot menu this time) and check if everything seems normal. You can apt update and install again to double check.
If even this doesn't work, you'll have to try something else, good luck
If your screen becomes black when running apt install inside a virtual TTY, try checking if the device is actually frozen by pressing Ctrl+Alt+F3 (or other F keys) and seeing what happens. Sometimes this happens to me when updating a graphics driver, but it just switched to a different screen and going back to the same TTY shows the update is still running.
After waiting for the update to complete, things should sort themselves out, otherwise you may have to reboot and hope for the best.