Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holmberd/f97b35a838c658348fb708acf7e99e9f to your computer and use it in GitHub Desktop.
Save holmberd/f97b35a838c658348fb708acf7e99e9f to your computer and use it in GitHub Desktop.
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