As part of my workflow I'm using Ubuntu server 20.04.3.
So I prepare the image for the VM and deploy it using Ansible.
Since it is env with no access to the internet all packages I'm installing have been previously downloaded .deb. by execution simple shell command:
dpkg -i deb_1.deb deb_2.deb deb_3.deb deb_4.deb
dpkg -i deb_5.deb deb_6.deb deb_7.deb deb_8.deb
Sometimes ~5% of cases, I'm receiving this error totally sporadically, can occur on first installation
"stderr_lines": ["dpkg: error: dpkg frontend lock is locked by another process",
"E: Sub-process dpkg --set-selections returned an error code (2)", "E: Executing dpkg failed. Are you root?"]
I have tried to solve this by:
- List item
Before each installation step perform manual lock file deletion
- /var/lib/dpkg/lock
- /var/lib/dpkg/lock-frontend
- /var/cache/apt/archives/lock
But even after manual deletion the error continue to appears.
Tried to install packages with Ansible apt module and "deb" arg - but the behavior is the same.
Tried to figure out what process actually owns the lock files with "lsof", but file was not owned by any process.
Is there is some way to fix this strange and buggy behavior?
What process is responsible for creating lock files sometimes on system startup?