[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1070027: apt: daily systemd service handles dpkg frontend locking incorrectly?



Control: reassign -1 aptitude
Control: retitle -1 aptitude: frontend lock support

On Wed, Aug 07, 2024 at 11:38:35AM GMT, Vincent Lefevre wrote:
> On 2024-08-07 11:04:15 +0200, Guillem Jover wrote:
> > On Thu, 2024-07-25 at 11:03:50 +0200, Vincent Lefevre wrote:
> [...]
> > > With VERBOSE=2, I could get more details about this failure:
> > > 
> > > Jul 25 13:22:16 qaa systemd[1]: Starting apt-daily.service - Daily apt download activities...
> > > Jul 25 13:22:16 qaa apt.systemd.daily[378644]: E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 378454 (apt)
> > > Jul 25 13:22:16 qaa apt.systemd.daily[378644]: E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
> > > Jul 25 13:22:16 qaa apt.systemd.daily[378637]: error encountered in cron job with "apt-get check".
> > > Jul 25 13:22:16 qaa systemd[1]: apt-daily.service: Deactivated successfully.
> > > Jul 25 13:22:16 qaa systemd[1]: Finished apt-daily.service - Daily apt download activities.
> > > 
> > > Here, the failure occurs in the apt.systemd.daily, because the
> > > process used for the upgrade got the lock first. But it could
> > > be the other way round, as this could be seen with aptitude.
> > 
> > So, as mentioned above, and as we saw earlier in the bug report, it looks
> > like the lock handling in the apt-daily.service is not working, and is
> > interfering with the current run. This needs to be fixed there
> > somehow. Reassigning.
> 
> OK. So, in short, apt keeps the lock for too long. The lock should
> be released by apt for triggers since a lock may be needed by some
> process run by a trigger.

No that's nonsense. The frontend lock is exactly supposed to be held
while running dpkg (which runs the lock). This is working as designed.

Now the original bug report is quite clearly about aptitude not
implementing frontend lock support, as in it still uses the old API
to release all locks to run dpkg and hence the service will steal
the frontend lock from it. That's expected and working as designed;
a frontend that does not implement frontend locking is vulnerable to
the same race as before.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: