Score:1

Unattended-Upgrades and autoremove dangerous?

pl flag

I have an Ubuntu 20.04.1 server that I configured to automatically update with unattended-upgrades and 'InstallOnShutdown'. I also activated the 'autoremove unused dependencies' feature. After a reboot at night, and unattended-upgrades doing it's job, the next morning I found that autoremove had removed all network capabilities and some other essential Ubuntu components. So the server had no network anymore. Just SOME of the uninstalled were: git, ubuntu-server, cloud-init, iptables, ubuntu-standard, ufw, isc-dhcp-client, netplan.io, iproute2, openssh-server, xauth, python3-netifaces, python3-distutils, python3-setuptools, screen, tmux

I ended up reinstalling because I needed the quickest solution (no saved data, just a service). Is this autoremove feature known to be dangerous? Or can this be, because I marked almost all packages as auto-installed yesterday (apt-mark auto)?

haikosaw avatar
pl flag
The stock install has a timer called apt-daily-upgrade, yes. But when does it install updates? I use unattended upgrades in order to make upgrades wait for a reboot. We've had multiple problems with Ubuntu installing updates which need a reboot, and then some service (docker/dockerregistry) doesn't work correctly anymore until a reboot is made (Docker is not in the origins, only security/Ubuntu). I guess I could also make a service always checking if a reboot is required and reboot at night, could work like that as well.
user535733 avatar
cn flag
Oh, I think I understand: Perhaps you didn't *enable* Unattended Upgrades; you merely changed the config. Well, that's why the config file is there. The former suggests some weird non-standard install that may have other impacts (hence concern); the latter is completely normal and expected.
haikosaw avatar
pl flag
Sorry, yes, you are correct. I thought I had seen a timer unattended-upgrades.timer and so I thought that what is enabled by default was different, because on a clean install I couldn't find that timer..but I was mistaken, there is none. So yes, I only changed the 50unattended-upgrades file to fit my _needs_.
Score:1
vn flag

From the apt-mark manpage:

auto
    auto is used to mark a package as being automatically installed, which will cause the
    package to be removed when no more manually installed packages depend on this package.

manual
    manual is used to mark a package as being manually installed, which will prevent the
    package from being automatically removed if no other packages depend on it.

So yeah, marking the packages as auto-installed can indeed be dangerous.

Under normal circumstances, Remove-Unused-Dependencies in unattended-upgrades or running apt autoremove should not be dangerous. But this of course depends on the following:

  • There were no dependency errors introduced in any packages (which may cause undesired removals)
  • There are no errors in the manual or auto flags of packages (as you experienced)
haikosaw avatar
pl flag
Thanks. I guess I should've taken more time to read more. I marked them auto because I thought maybe then the least amount of packages would be held back...but I was already second guessing this could be the issue. At least with a fresh install now I have a baseline again of what should be marked manual.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.