Score:1

How can I get unattended-upgrades to work reliably on my laptops?

ss flag

For months, I’ve been having issues with unattended-upgrades not running every day, or thereabouts, with logs often empty for a week or so, or with it not working at all.

I’ve amended the relevant file (50unattended-upgrades) so that only ‘proposed’ are not updated, as well as the relevant part that would only allow updates on AC power, so it should now update on battery power. When I amended the latter, that helped solve the problem, updating automatically more or less every day. The laptops are used every day, but obviously the odd day missed for updates may occur.

My desktop PC is fine, updating mostly every day.

Sincere apologies for a lack of logs. Due to disability and chronic illness, it’s difficult to gather all of the information together. It’s taken quite a while to write this. I know more information is helpful, so please do ask if you require any further information. Please bear with me if you can. Thank you.

Basically, the apt timers show up as having been successful, but the logs for unattended-upgrades are all empty. On a new installation, some log files have not been created. I don’t know if that’s normal. A dry run of unattended-upgrades does create a log file and fill it with information. However, the laptop I’ve recently installed 18.04 and then 22.04 sat for a few days without any further logs, and updates were available when I checked manually.

This has been a problem with all available versions from 18.04, 20.04, 22.04 and 22.10, and on three different laptop brands.

Linux Mint’s automatic updates appear to work well on my laptops, but then its methods for doing so are different. Do any of the Ubuntu flavours work any differently in this regard, even slightly, thus somehow not exhibiting this problem?

I’ve used Ubuntu since 2007, so I can delve deeper and edit files if necessary. The only changes I’ve made are the ones mentioned above (no other tweaks).

I suspect this is an issue where Ubuntu still will not update because the laptop is running on battery power, as my desktop appears to be fine.

I have looked at others’ posts on this subject.

Many thanks for your help. It’s much appreciated.

guiverc avatar
cn flag
Upgrades for *flavors* use the same Ubuntu code as Ubuntu Desktop, so I'd not expect any differences. Speaking mostly for Lubuntu (*where I can speak most authoritatively easily*) our only difference as per our [*seeds*](https://people.canonical.com/~ubuntu-archive/seeds/lubuntu.lunar/desktop) is the inclusion of [`lubuntu-update-notifier`](https://launchpad.net/ubuntu/+source/lubuntu-update-notifier) which is a desktop notifier only.. and I'd expect the same for other *flavors* given how we work...
ar flag
Unattended upgrades are designed to start at a random time within the set hour. This is because if millions of Ubuntu computers start updating at the same time, the upgrade server may crash. Unattended upgrades is not meant for laptops.
user535733 avatar
cn flag
Well, my own Unattended Upgrades works perfectly well on this laptop, as it worked properly on the previous laptop, and the laptop before that. Using the stock configuration, it works. Your mention of `-proposed` suggests a possible misconfiguration. Your mention of "no logs" suggests a possible broken (or disabled) timer or service file.
user535733 avatar
cn flag
Run `ls -lah /var/lib/apt/periodic/`. That will provide you the timestamps of most recent apt completions, including unattended upgrades. Check those timestamps against your /var/log/apt/history.log to verify that your logs are accurately recording activity. Check those timestamps against `systemctl list-timers | grep apt` to verify that the two unattended-upgrades timers are working.
yellowsky avatar
ss flag
Thanks, all. Sorry for the delay. Despite a new installation of 20.04 on another laptop, the issue remains. ‘Proposed’ has been left as not allowed, but ‘backports’, ‘security’ and ‘updates’ are. I’ve checked the logs, as mentioned by user535733. Dry runs work on battery, but it doesn’t work when the timers arrive. They pass with no logs, no updates at all. Looking online, it appears another check to determine AC/battery is made (systemd?). That might be why updates don’t take place despite timers being listed. This always worked until a few months ago. Is this a bug?
yellowsky avatar
ss flag
Just tried this. Unattended-upgrades run from the command line, without options or –debug, works even on battery. Logs are there and all pending updates installed. The two apt timers are present but, even after a long time after the timers have passed and the laptop is left on, waiting updates are not installed and no logs are made. It appears unattended-upgrades does not get started by the timer(s). As said previously, apparently there is another check, one beyond the AC/battery configuration set in 50unattended-upgrades, that determines AC or battery before proceeding (systemd?).
I sit in a Tesla and translated this thread with Ai:

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.