Skip to content

Instantly share code, notes, and snippets.

@jclec
Created September 20, 2025 23:58
Show Gist options
  • Select an option

  • Save jclec/5b68b8954ebecb361313368aa6266825 to your computer and use it in GitHub Desktop.

Select an option

Save jclec/5b68b8954ebecb361313368aa6266825 to your computer and use it in GitHub Desktop.
Black screen during apt install

Black screen during apt install

Important:

I find that you can avoid a lot of update-related issues by running apt install inside a virtual TTY with Ctrl+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 screen

This 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:

1. Can login normally but apt install fails

If it says that dpkg was interrupted during an update (but not during a critical kernel one, lucky!), run

sudo dpkg --configure -a

This should finish installing the updates and fix most issues for you. Try apt installing again to check if there still problems.

2. It boots into emergency mode (!)

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-generic

This 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.

Booting into old kernel

  1. 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.
  2. During the reboot, repeatedly press Space to bring up systemd-boot's boot menu, and select the old kernel version.
  3. 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 with Ctrl+Alt+F3.
  4. 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

Black screen even when updating inside TTY

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment