Make sure auto-updates are enabled
apt install unattended-upgrades #dpkg -l | grep unattended-upgrades dpkg-reconfigure -plow unattended-upgrades
or do it manually,
date | mailx -s `hostname` root mailq cd /etc/apt/apt.conf.d/ cp -pi 50unattended-upgrades ~/50unattended-upgrades.dist cat ../sources.list vi 50unattended-upgrades Unattended-Upgrade::Allowed-Origins { "${distro_id}:${distro_codename}"; "${distro_id}:${distro_codename}-security"; "${distro_id}ESM:${distro_codename}"; "${distro_id}:${distro_codename}-updates"; "${distro_id}:${distro_codename}-proposed"; }; Unattended-Upgrade::Mail "root"; cp -pi 20auto-upgrades ~/20auto-upgrades.dist vi 20auto-upgrades APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Download-Upgradeable-Packages "1"; APT::Periodic::AutocleanInterval "1"; APT::Periodic::Unattended-Upgrade "1"; systemctl status unattended-upgrades systemctl restart unattended-upgrades
Deal with left-over configurations
cat > ~/PURGE <<-EOF apt autoremove dpkg -l | grep ^rc echo clean this all up? dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg --purge EOF chmod +x ~/PURGE ./PURGE
Do you have disk space problems on /boot/
?
df -h
see what you have now
uname -r ls -lhF /boot/vmlinuz*
select the kernels you wanna get rid of and e.g.
dpkg -l | grep 5.4.0-37 | awk '{print $2}' dpkg -l | grep 5.4.0-37 | awk '{print $2}' | xargs dpkg --purge
double-check
dpkg -l | grep kernel | awk '{print $2}' dpkg -l | grep linux | awk '{print $2}'
obsolete
#dpkg -l | grep -E 'linux-(image|headers|extra)' | grep ^i #apt install byobu #purge-old-kernels
apt autoremove --purge
lsb_release -a df -h dpkg -l | grep ^ rc apt update apt full-upgrade apt autoremove dpkg -l | grep ^ rc do-release-upgrade iptables -I INPUT -p tcp --dport 1022 -j ACCEPT
make sure grub is in place,
update-grub2
make sure there’s a few bytes left for the system to start fine,
df -h
and reboot,
reboot
https://help.ubuntu.com/lts/serverguide/automatic-updates.html
https://wiki.debian.org/UnattendedUpgrades
https://www.hiroom2.com/2016/05/18/ubuntu-16-04-auto-apt-update-and-apt-upgrade/