UBUNtU APT PROBLEMS AND FIXES
Ubuntu overall is a good distribution, but like all things has its quirks that can crop up from time to time. Most of my issues come from apt being very reminiscent of how RPM was back in 2000-2003, with issues that crop up and can be a royal nightmare to troubleshoot and finally repair. Here are my issues that I have found thru my time as an admin and occasional user of Ubuntu. This is a WIP, and is subject to me having time to collate the code/commands/steps to remedy into a coherent manual. Best of luck!
APT HAS A STALE LOCKFILE
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
sudo apt update
APT HANGS ON KERNEL UPGRADE
- Use a virtual terminal (important, gnome-terminal or the like will not work correctly) by pressing CTL+ALT+F3
-
Issue the following commands
sudo dpkg --configure -a sudo apt-get install -f sudo apt-get clean sudo apt-get update
-
Press ALT+F2 to return to GUI desktop
APT HANGS ON KERNEL UPGRADE ON SYSTEM NVIDIA HYBRID GRAPHICS
- Open up a terminal
-
Run the following command:
sudo prime-switch intel
-
Reboot
-
Issue the following commands:
sudo apt-get install -f sudo apt-get clean sudo apt-get update sudo apt-get upgrade sudo prime-switch nvidia
-
Reboot
APT RECONFIGURE FAILS DUE TO A BAD UPDATE METADATA FILE
This occurs after an attemt to dpkg --configure -a with the following error:
dpkg: error: parsing file '/var/lib/dpkg/updates/1234' near line 0:
newline in field name `#padding'
The exact file in error may vary, but will be at the same path (/var/lib/dpkg/updates/XXXX). The resolution is simply to delete that file.
APT BROKE NVIDIA
- Switch to a virtual terminal (CTL+ALT+F3)
-
Run the following command:
sudo apt-get purge nvidia-*
-
When completed, return to your GUI desktop (ALT+F2)
- Run the program Software & Updates
- Navigate to the Additional Drivers tab
- Reselect NVIDIA when the system finishes scanning and click apply changes
- When the system finishes downloading and installing the drivers, reboot.