The officially official Devuan Forum!

You are not logged in.

#1 2020-11-08 16:10:38

Copper36
Member
Registered: 2018-11-27
Posts: 55  

dpkg database is locked, can't proceed with installation

Hi,

I am trying to install fheroes2 (from the repo of course), and it requires an additional download/compilation of some non-free components. According to the instructions, after Synaptic is done and closed, I issued:

~$ sudo dpkg-reconfigure fheroes2-pkg

Pseudo-grapic menu appeared asking for permission to download and to compile, "Yes", but then:

fheroes2-pkg: dpkg database is locked. You may need to use command "sudo dpkg-reconfigure fheroes2-pkg".
fheroes2-pkg: Building and installation of package(s) [fheroes2] postponed till after next APT operation.

Synaptic is not running, no traces of apt/dpkg/synaptic in the processes list. Tried to reboot - no changes, still got stuck.
It looks like I can manually delete a lock file, do my stuff and then probably reboot to restore a status-quo, but is it safe? Maybe any other more conventional methods to deal with this?

ASCII 64bit.

Thank you.

Offline

#2 2020-11-08 16:40:37

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: dpkg database is locked, can't proceed with installation

Check if anything's using the lock:

lsof /var/lib/dpkg/lock

If not then it should be safe to remove manually.


Brianna Ghey — Rest In Power

Offline

#3 2020-11-08 16:55:51

Copper36
Member
Registered: 2018-11-27
Posts: 55  

Re: dpkg database is locked, can't proceed with installation

Head_on_a_Stick wrote:

Check if anything's using the lock:

lsof /var/lib/dpkg/lock

If not then it should be safe to remove manually.

Huh, it doesn't seem to work.
lsof /var/lib/dpkg/lock does not report anything, but:

~$ sudo rm /var/lib/dpkg/lock
~$ sudo dpkg-reconfigure fheroes2-pkg
fheroes2-pkg: dpkg database is locked. You may need to use command "sudo dpkg-reconfigure fheroes2-pkg".
fheroes2-pkg: Building and installation of package(s) [fheroes2] postponed till after next APT operation.

Last edited by Copper36 (2020-11-08 16:56:58)

Offline

#4 2020-11-08 17:08:23

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: dpkg database is locked, can't proceed with installation

There are other lock files:

find /var -name 'lock*' -exec lsof {} \;

EDIT: added -exec option.

Last edited by Head_on_a_Stick (2020-11-08 17:10:38)


Brianna Ghey — Rest In Power

Offline

#5 2020-11-08 18:41:24

Copper36
Member
Registered: 2018-11-27
Posts: 55  

Re: dpkg database is locked, can't proceed with installation

Here is the output:

~$ find /var -name 'lock*' -exec lsof {} \;
find: ‘/var/log/exim4’: Permission denied
find: ‘/var/lib/sudo/ts’: Permission denied
find: ‘/var/lib/colord/.cache’: Permission denied
find: ‘/var/lib/udisks2’: Permission denied
find: ‘/var/lib/polkit-1’: Permission denied
find: ‘/var/lib/geoclue/.cache’: Permission denied
find: ‘/var/lib/apt/lists/partial’: Permission denied
find: ‘/var/lib/rkhunter/db’: Permission denied
find: ‘/var/lib/rkhunter/tmp’: Permission denied
find: ‘/var/cache/ldconfig’: Permission denied
find: ‘/var/cache/cups’: Permission denied
find: ‘/var/cache/apt/archives/partial’: Permission denied
find: ‘/var/spool/cups’: Permission denied
find: ‘/var/spool/cron/crontabs’: Permission denied
find: ‘/var/spool/exim4’: Permission denied
find: ‘/var/spool/rsyslog’: Permission denied

Should it be run with sudo?

I also looked at what happens to the /var/lib/dpkg/lock, it keeps re-appearing at the moment I hit "Yes" in the download-compile window... not sure if it should.

Last edited by Copper36 (2020-11-08 18:46:00)

Offline

#6 2020-11-09 05:36:01

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: dpkg database is locked, can't proceed with installation

Okay, I've tried installing that in my Debian buster box and I see the same errors but I don't know why. If nobody else can help with this then it may be best to open a bug report.


Brianna Ghey — Rest In Power

Offline

#7 2020-11-09 06:41:31

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: dpkg database is locked, can't proceed with installation

Looks like an install script bug at /usr/lib/fheroes2-pkg/b-i_fheroes2.sh:20

Change that line to be

echo # dpkg -i /dev/zero 2>/dev/null

to make it build more happily.

Offline

#8 2020-11-09 16:42:38

Copper36
Member
Registered: 2018-11-27
Posts: 55  

Re: dpkg database is locked, can't proceed with installation

Head_on_a_Stick wrote:

Okay, I've tried installing that in my Debian buster box and I see the same errors but I don't know why. If nobody else can help with this then it may be best to open a bug report.

My wild guess would be the script locks dpkg for itself... Anyway, I compiled it from the sources, seems to work.

Thank you for your time and effort!

P.S. I have found a reference to the same error (but one and only) on one of the Debian forums dated 2017.

Offline

Board footer