Technotes for future me


See Also:


  • Check for security upgrades

      # With apt-show-versions
      apt-show-versions | grep "security upgradeable"
      # With aptitude
      aptitude search '?and(~U,~Asecurity)'
      # With pure apt-get
      grep -h '^deb.*security' /etc/apt/sources.list /etc/apt/sources.list.d/* >sec.list
      apt-get -s dist-upgrade -o Dir::Etc::SourceList=sec.list | grep ^Inst
  • Check for restarts on library upgrades

      apt-get install needrestart
  • Build Kernel Package: How to build kernel packages with make-pkg

      cd /usr/src/linux && make-kpkg clean && make-kpkg --initrd --revision=myrev kernel_image
  • Setup Keyring: How to solve “The following packages cannot be authenticated”

      apt-get install debian-archive-keyring
      apt-get update
  • Security Debian HowTo


  • Upgrade wheezy -> jessie

      apt-get update
      apt-get upgrade
      sed -i 's/wheezy/jessie/g' /etc/apt/sources.list /etc/apt/sources.list.d/*
      apt-get update
      apt-get upgrade
      apt-get dist-upgrade
  • Upgrade squeeze -> wheezy

      apt-get update
      apt-get upgrade
      sed -i 's/squeeze/wheezy/g' /etc/apt/sources.list /etc/apt/sources.list.d/*
      apt-get update
      apt-get install apt dpkg aptitude
      apt-get dist-upgrade
  • Force remove broken “reportbug”: This can happen during dist-upgrades from Etch/Sarge to Lenny.


You can access arbitrary older releases via

deb lenny main
deb-src lenny main
deb lenny/updates main
deb-src lenny/updates main

APT Cheat sheet


  • Ubuntu - Access Repositories for older releases. Once a release is deprecated it is moved to You need to adapt /etc/apt/sources.list to fetch packages from there

      sed -i 's/' /etc/apt/sources.list
  • Ubuntu - Check for new HWE

  • Ubuntu - List Security Updates

      # Print summary
      /usr/lib/update-notifier/apt-check --human-readable
      # Print package names
      /usr/lib/update-notifier/apt-check -p
  • Ubuntu - Upgrade Security Fixes Only

      apt-get dist-upgrade -o Dir::Etc::SourceList=/etc/apt/
  • Ubuntu - Reboot Required

      ls /var/run/reboot-required # Reboot flag file
      # Packages requiring the reboot
      cat /var/run/reboot-required.pkgs
Last updated on 31 Jan 2021
Published on 25 Dec 2019
Edit on GitHub