Ubuntu Upgrade Removed Git NVIDIA Fix | Generated by AI
Question: After running do-release-upgrade from Ubuntu 22.04 to 24.04, should I have chosen to remove old/obsolete packages in the final step? Now both git and my NVIDIA driver are gone — how do I fix this?
Answer:
Understanding the “Remove Obsolete Packages” Step
After all packages are updated during do-release-upgrade, you are prompted to remove any obsolete packages that are no longer needed, with a message like: “Remove obsolete packages? 30 packages are going to be removed. Continue [y/N] Details [d]”
You can press d to view details about such packages before deciding. Outdated packages do not receive security updates, so removing them is generally reasonable — but you may wish to keep them so that the system keeps working with older apps.
The short answer: you should always press d first and review the list before saying yes. The problem is that do-release-upgrade sometimes incorrectly marks packages like git or NVIDIA drivers as “obsolete” — particularly if they came from PPAs, third-party repos (like NVIDIA’s own CUDA repo), or if the upgrader lost track of them during the process.
Why Git and NVIDIA Drivers Got Removed
There are two common causes:
1. Third-party / PPA sources
The upgrader marks packages as “obsolete” if it cannot find them in the new Ubuntu 24.04 repositories. If your NVIDIA driver was installed from a third-party source (e.g., ppa:graphics-drivers/ppa or NVIDIA’s CUDA repo), it may not be recognized as a valid 24.04 package and gets flagged for removal.
2. The NVIDIA upgrader logic failed silently
The upgrader’s internal log can show messages like INFO no old nvidia driver installed, installing no new — meaning the tool detected no recognized NVIDIA driver and skipped reinstalling one automatically, leaving you without a driver after the upgrade.
Fix: Reinstall Git
This is straightforward — git is available in Ubuntu 24.04’s default repositories:
sudo apt update
sudo apt install git
Verify with:
git --version
Fix: Reinstall NVIDIA Driver on Ubuntu 24.04
Step 1: Check your GPU
lspci | grep -i nvidia
Step 2: Let Ubuntu detect and recommend the right driver
sudo ubuntu-drivers list
Step 3: Auto-install the recommended driver
sudo ubuntu-drivers autoinstall
Or install a specific version manually (replace 550 with your preferred version):
sudo apt install nvidia-driver-550
Step 4: Make sure kernel headers are installed (required for DKMS)
sudo apt install linux-headers-$(uname -r) build-essential
Step 5: Reboot
sudo reboot
Step 6: Verify
nvidia-smi
If nvidia-smi is missing after installation, the nvidia-smi command is provided by NVIDIA utilities packages. Install the matching utilities package for your branch, such as nvidia-utils-<version>, then run nvidia-smi again.
If You Have Broken Packages
If apt install gives errors about broken packages, clean up first:
sudo apt purge 'nvidia-*' 'libnvidia-*'
sudo apt clean
sudo apt update
sudo apt -f install
sudo ubuntu-drivers autoinstall
Best Practice for Future Upgrades
Before running do-release-upgrade next time:
- Always press
dat the “Remove obsolete packages?” prompt and review what will be removed. - Note down any important packages you want to reinstall afterward (especially NVIDIA drivers, git, etc.).
- For NVIDIA users specifically, a safer approach is to switch to the open-source
nouveaudriver before the upgrade, then reinstall the proprietary NVIDIA driver after a successful boot into the new release.
References:
- Ubuntu Server Docs - How to upgrade your release
- How to Install NVIDIA Drivers on Ubuntu 24.04 - Cherry Servers
- Ubuntu 24.04 + Nvidia Drivers - projectable.me
- How to Install NVIDIA Drivers on Ubuntu - LinuxCapable
- do-release-upgrade 22.04 to 24.04 - Launchpad Q&A