You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04更新NVIDIA驱动后黑屏,如何借助boot repair修复启动问题?

Hey there, let's work through this black screen issue you're facing after updating your NVIDIA driver on Ubuntu 16.04. The fact you can SSH in remotely is a huge win—we can leverage that to fix things step by step using Boot Repair, custom boot scripts, and adjustments to shimx64.efi. Let's dive in:

1. First: Fix the Broken update-initramfs Command

Since you mentioned errors when running sudo update-initramfs -u, this is likely the root of your boot-time graphics failure. Let's diagnose and resolve this first:

  • First, check the initramfs logs to pinpoint the exact error:
    cat /var/log/initramfs-tools/*.log
    
    Look for lines mentioning NVIDIA module failures or missing files—this will tell us if the corrupted driver is blocking initramfs generation.
  • If NVIDIA drivers are the culprit, purge all existing NVIDIA packages to clean up:
    sudo apt purge nvidia-*
    
  • Now try regenerating the initramfs again:
    sudo update-initramfs -u
    
    If this runs successfully, you can try reinstalling a stable NVIDIA driver later. If not, move on to the next steps.
2. Use Boot Repair to Fix Bootloader & EFI Issues

Boot Repair is a tool that automates most boot-related fixes, including repairing shimx64.efi and GRUB entries. Here's how to use it via SSH:

  • Install Boot Repair from its PPA:
    sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt update && sudo apt install boot-repair
    
  • First, gather boot info to understand the current state (this helps if we need to troubleshoot further):
    sudo boot-repair --boot-info
    
  • Now run the core repair command to fix GRUB and EFI boot entries (this will reinstall GRUB and ensure shimx64.efi is properly configured):
    sudo boot-repair --reinstall-grub
    
  • If you get an error about the EFI partition not being mounted, first locate your EFI partition (usually /dev/sda1—use sudo fdisk -l to confirm), then mount it:
    sudo mount /dev/sda1 /boot/efi
    
    Re-run the boot repair command after mounting.
3. Custom Boot Script to Bypass Graphics Init Failures

If Boot Repair doesn't resolve the black screen, we can modify the GRUB boot parameters to skip problematic graphics initialization:

  • Edit the GRUB default configuration file:
    sudo nano /etc/default/grub
    
  • Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add nomodeset to bypass proprietary graphics drivers on boot. It should look like:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
    
    Alternatively, if you want to force the open-source nouveau driver, use nouveau.modeset=1 nvidia.modeset=0 instead of nomodeset.
  • Save the file (Ctrl+O, Enter) and exit (Ctrl+X), then update GRUB:
    sudo update-grub
    
  • Reboot your machine—this should let you boot into a working graphical environment.
4. Manual Shimx64.efi & EFI Bootloader Fix

If the above steps don't fix the EFI boot issue, let's manually repair shimx64.efi (the EFI bootloader for Ubuntu with secure boot support):

  • Ensure your EFI partition is mounted (as we did earlier: sudo mount /dev/sda1 /boot/efi).
  • Reinstall the shim-signed package (which provides shimx64.efi):
    sudo apt install --reinstall shim-signed
    
  • Reinstall GRUB to the EFI partition:
    sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu
    
  • Check your EFI boot entries to make sure Ubuntu is set as the priority:
    sudo efibootmgr
    
  • If Ubuntu isn't listed or isn't the first entry, add it manually (replace /dev/sda and 1 with your disk and EFI partition number):
    sudo efibootmgr -c -d /dev/sda -p 1 -L "Ubuntu" -l "\EFI\ubuntu\shimx64.efi"
    
5. Post-Fix: Reinstall a Stable NVIDIA Driver

Once you can boot into the graphical interface again, let's install a reliable NVIDIA driver for Ubuntu 16.04:

  • Purge any remaining NVIDIA packages:
    sudo apt purge nvidia-*
    
  • Install the official stable driver for 16.04 (nvidia-384 is the LTS recommended driver):
    sudo apt install nvidia-384
    
  • Regenerate the initramfs one last time:
    sudo update-initramfs -u
    
  • Reboot your machine—this should give you a working system with the NVIDIA driver installed correctly.

Quick Notes

  • Always back up important files before running system repair commands.
  • If you have Secure Boot enabled, you may need to disable it temporarily (in your BIOS/UEFI settings) or enroll the NVIDIA driver's signing key to avoid boot issues.
  • If update-initramfs still fails, try deleting leftover NVIDIA module files manually:
    sudo rm -rf /usr/lib/modules/$(uname -r)/kernel/drivers/video/nvidia*
    
    Then re-run sudo update-initramfs -u.

内容的提问来源于stack exchange,提问作者user3639557

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:08:44