martinandersson / box-ubuntu-budgie-17-x64

A Vagrant box with Ubuntu Budgie 17.
https://app.vagrantup.com/pristine/boxes/ubuntu-budgie-17-x64
The Unlicense
0 stars 0 forks source link

Box fails to provision due to a lock file being locked #3

Open martinandersson opened 6 years ago

martinandersson commented 6 years ago

Each apt-get (also apt and aptitude?) process instance lock a lock file to make sure it never runs concurrently (because otherwise, shit happens?).

Recent Ubuntu/Debian releases have an "apt daily" timer setup which fires off on boot (I believe this comes as part of the unattended-upgrades package). This will cause the lock file to be locked and subsequent provisioning done by Vagrant that uses apt-get will fail. It has also been reported that it makes the machine startup slow.

Actually, /lib/systemd/system/apt-daily.timer is configured to fire the timer each day at a random time. But it also has Persistent=true set which makes the machine catch up a missed event immediately on boot.

Setting Persistent=false (default value) should "fix the problem". But I don't consider this an optimal solution for two reasons.

Firstly, this reduces the likelihood of the collision to happen but does not definitively get rid of the problem, the chance is still there if that random event time happened to be right at boot. Secondly, I agree with this comment that the update process shouldn't run at a random time at all. It should be deterministic (at least to some degree) and occur some short time after boot.

Solution: Configure the apt daily timer such that it elapses 15-45 minutes after boot. It may also be delayed up to one hour at the discretion of the system (to minimize CPU wake-ups). Repeat every day the machine stays awake.

Some good-to-have links:

martinandersson commented 6 years ago

It has been noted that although the problem is gone most of the times, it can still happen. So apparently there are even more processes that need to be reconfigured.

I will reopen this issue and change the wording for release v10.0.1 in the changelog from "fixed" to "improved". But for the moment, I regard this issue as an infrequent upstream one not worthy of my time.