/srv/irclogs.ubuntu.com/2016/07/13/#ubuntu-ie.txt

larryone1aloha folks10:14
larryone1a question10:15
larryone1I have a bootstrap script that runs an apt-get update and upgrade10:15
larryone1occasionally failing, complaining about /var/lib/dpkg/lock10:16
slashbelhello larryone1!10:16
larryone1but I seem to be able to apt-get my stuff even when the file is there10:16
larryone1and the lock file is still there without any dpkg proc running10:16
larryone1hi slashbel10:17
larryone1_o/10:17
slashbelit's complaining about an existing lock file or that it cannot create a lock file?10:17
larryone1the file always exists, but the timestamp does change on a successful apt-get upgrade10:17
larryone1E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)10:18
larryone1E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?10:18
larryone1that error seems to suggest it's complaining about the existence of the lock10:18
slashbeliirc there is a dæmon in Ubuntu which checks for updates, that would grab a lock10:19
larryone1this only started when we began replacing machines with 16.04, so am suspecting there's something new doing this10:19
larryone115.10 and older didn't have this problem10:20
slashbeldoes fuser give you any info on who has the lock?10:22
larryone1might add that check to the boot script and see10:23
larryone1the file is always owned by root from what I can see10:23
slashbelsorry, i meant which process10:25
larryone1have thrown in a ps -ef | grep dpkg into the boot script, provisioning a new machine now to see10:26
larryone1grr, successful provisioning this time10:27
larryone1WHY WONT YOU FAIL?10:27
* larryone1 continues trying to reproduce the intermittent failure 10:53
ebellarryone: I don't know how dpkg works, but I think there's a "file lock" thing in Unix.11:55
ebellarryone: i.e. it actually does some system call to create a file. It doesn't just look at whether the file exists11:55
ebellarryone: So things like "The file always exists" might not be relevant for whether there is a lock or not.11:56
larryone1ebel, so there might be some sort of file attribute that gets changed or something14:29
larryone1?14:29
ebellarryone1: yeah, or some sort of unix kernel magic14:29
larryone1threw this into my bootstrap script:14:34
larryone1ps -ef | grep dpkg > /root/dpkg-ps.out14:34
larryone1got14:34
larryone1root      2006  1990  0 11:55 pts/1    00:00:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/tzdata.postinst configure 2016d-0ubuntu0.16.0414:34
larryone1so it looks like there's some foo that it does on first boot14:34
larryone1...or maybe even every boot14:35
larryone1nonetheless, looks like I might need to put some kind of condition in my provisioning script to not do aptish stuff if there's dpkg things happening14:35
larryone1root      1990  1580  0 11:55 pts/1    00:00:00 /usr/bin/dpkg --status-fd 10 --configure tzdata:all14:40
larryone1yup14:42
larryone1looks like problem solved14:42
larryone1ebel, slashbel thanks14:43
ebel\o/14:44
larryone1looks like the check is not for the file's existence, but whether the file handle is open14:49
larryone1lsof | grep dpkg14:49
larryone1^^ that in the bootstrap script confirmed14:49

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!