Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clean full boot partition with unmet dependencies - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Remove old kernels and fix unmet dependency issue

  • See currently loaded kernel: uname -r
  • List all old kernels: dpkg --list 'linux-image*'
  • List old kernels except currently loaded: sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`
  • Remove with force and purge: sudo dpkg --force-all -P linux-image-3.13.0-32-generic
  • Fix dependency problems: sudo apt-get install -f
  • Remove all expect the loaded kernel: sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Future proof yourself

  • Setup unattended upgrades: sudo dpkg-reconfigure unattended-upgrades
  • Edit config: sudo vim /etc/apt/apt.conf.d/50unattended-upgrades
    • Uncomment //Unattended-Upgrade::Remove-Unused-Dependencies "false"; and set it to true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment