debconf: DbDriver “config”: /var/cache/debconf/config.dat is locked by another process: No locks available

Asked by Marietto

Hello.

I want to run some x86_64 apps from jetson nano,for example google chrome and teamviewer and I want also to copy heavy files from the sd card of the nano on a larger disk on the desktop PC. For this reason I've configured the NFS server on ubuntu 18.04 x64 and the client on the jetson nano where I have installed ubuntu 18.04 arm64. I've configured the server adding this command inside the /etc/exports file on ubuntu 18.04 x64 :

/home/loziomario/Scrivania/Nano/qemu-chroot-I9 *(rw,fsid=0,insecure,no_root_squash,no_subtree_check,async,nohide)

on the client side,I mount the shared folder with this command :

sudo mount 192.168.1.6:/home/loziomario/Scrivania/Nano/qemu-chroot-I9 /root/Scrivania/Work/qemu-chroot-I9

where :

192.168.1.6 = ip number of the server (ubuntu 18.04 x64 bit)
192.168.1.3 = ip number of the nano / ubuntu 18.04 arm64

what I want to do is to copy the groovy debootstrapped chroot folder from the nano sd card to the server disk,inside a shared folder,called "qemu-chroot-I9" and I do this with this command :

sudo rsync -avzhprt --numeric-ids /root/Scrivania/Work/qemu-chroot-nano/chroot-groovy-x86_64 /root/Scrivania/Work/qemu-chroot-I9

all the files are copied without problems. After this,I mount all the chroot system folders and I copy the qemu-x86_64-static file from the /usr/bin folder of the ubuntu / nano on the /usr/bin folder of the groovy chroot like this :

cp /usr/bin/qemu-x86_64-static /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/usr/bin

and :

xhost +
sudo mount -t sysfs /sys/ /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/sys/
sudo mount -t proc /proc/ /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/proc/
sudo mount --bind /dev /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/dev/
sudo mount --bind /dev/pts /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/dev/pts/
sudo mount --bind /dev/shm /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/dev/shm/

and I became root inside the chroot with this command :

sudo chroot /root/Scrivania/Work/qemu-chroot-I9/chroot-groovy-x86_64/ /bin/su -l root

(I can become root because I have been able to debootstrap correctly the groovy amd64 directly on the nano sd card (using the two debootstrapping stages :

1) debootstrap --foreign --arch amd64 groovy ./chroot-groovy-x86_64

2) sudo chroot ./chroot-groovy-x86_64/ /debootstrap/debootstrap --second-stage

and I have configured the root login correctly groovy first on the nano sd card)

and this is what happens if I try to install nano inside the chroot :

root@ziomario-desktop:~# apt install nano
Reading package lists… Done
Building dependency tree… Done
Suggested packages:
hunspell
The following NEW packages will be installed:
nano
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 284 kB of archives.
After this operation, 930 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu groovy/main amd64 nano amd64 5.2-1 [284 kB]
Fetched 284 kB in 1s (324 kB/s)

unfortunately this error occour :

debconf: DbDriver “config”: /var/cache/debconf/config.dat is locked by another process: No locks available
dpkg: error: unable to lock dpkg database lock: No locks available
W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock-frontend
W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock
W: Not using locking for nfs mounted lock file /var/cache/apt/archives/lock
E: Sub-process /usr/bin/dpkg returned an error code (2)

according with this post

https://askubuntu.com/questions/136881/debconf-dbdriver-config-config-dat-is-locked-by-another-process-resource-t

it says that doing :

sudo fuser -v /var/cache/debconf/config.dat

Will show you what process is holding the lock:

good. I gave this command outside the chroot like this :

root@ziomario-desktop:~# sudo fuser -v /var/cache/debconf/config.dat

output = nothing

I gave this command also on the server side :

root@loziomario-I9:/home/loziomario/Scrivania/Nano# sudo fuser -v /var/cache/debconf/config.dat

output = nothing

so,nothing is holding the lock.

this is even more interesting. I have renamed the config.dat file on ubuntu 18.04 arm64 outside and inside the chroot like this :

root@ziomario-desktop:/var/cache/debconf# mv config.dat config.dat_

root@ziomario-desktop:/var/cache/debconf# ls

config.dat-old config.dat_ passwords.dat templates.dat templates.dat-old

and I tried to install nano again :

root@ziomario-desktop:/var/cache/debconf# apt install nano
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
hunspell
The following NEW packages will be installed:
nano
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/284 kB of archives.
After this operation, 930 kB of additional disk space will be used.

but the error is still there :

debconf: DbDriver “config”: /var/cache/debconf/config.dat is locked by another process: No locks available
dpkg: error: unable to lock dpkg database lock: No locks available
W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock-frontend
W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock
W: Not using locking for nfs mounted lock file /var/cache/apt/archives/lock
E: Sub-process /usr/bin/dpkg returned an error code (2)

it seems to me a bug.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Could try:

lsof | grep config.dat

May show the process and you can kill it

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

"W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock"

This indicates that the lock mechanism probably does not work on nfs-mounted directories at all.

Revision history for this message
Marietto (marietto2008) said :
#3

on the server :

root@loziomario-I9:/home/loziomario# lsof | grep config.dat

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.

maybe this is relevant ?

Revision history for this message
Marietto (marietto2008) said :
#4

 fixed it,changing this :

sudo mount 192.168.1.6:/home/loziomario/Scrivania/Nano/qemu-chroot-I9
 /root/Scrivania/Work/qemu-chroot-I9

with this :

sudo mount -t nfs -o nolock,local_lock=all
192.168.1.6:/home/loziomario/Scrivania/Nano/qemu-chroot-I9
 /root/Scrivania/Work/qemu-chroot-I9

and the version of nfs that I'm using on the server is the 3.

I've got the solution here :

https://unix.stackexchange.com/questions/430570/mount-nfs-with-nolock-option-do-not-take-effect

Il giorno ven 5 feb 2021 alle ore 10:41 Manfred Hampl <
<email address hidden>> ha scritto:

> Your question #695377 on apt in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/apt/+question/695377
>
> Manfred Hampl proposed the following answer:
> "W: Not using locking for nfs mounted lock file /var/lib/dpkg/lock"
>
> This indicates that the lock mechanism probably does not work on nfs-
> mounted directories at all.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ubuntu/+source/apt/+question/695377/+confirm?answer_id=1
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/apt/+question/695377
>
> You received this question notification because you asked the question.
>

--
Mario.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Great share hopefully it helps others

Can you help with this problem?

Provide an answer of your own, or ask Marietto for more information if necessary.

To post a message you must log in.