openvpn-install
openvpn-install copied to clipboard
A fix about a problem with apt and dpkg lock
Checklist
- [x] I read the README
- [x] I read the FAQ
- [x] I searched the issues
- [x] My issue is about the script, and not OpenVPN itself
Problem
When Ubuntu starts, it triggers the apt for checking latest security patches. Since apt has no mechanism to keep sequent calls on-hold, they are ending up with error. Script can not install required packages and tries to continue without them.
This issue more likely belongs to apt-get
than this repo, but seems like there are issues reported about apt at bugs.debian.org [^1] [^2] none of them resolves the apt-get
's problem.
Fix
Fast fix could be wrapping apt calls with until
and sleep
:
until apt-get install openvpn; do sleep 1; done
I will make a pull request to resolve issue.
Symptoms
-
VPN connection can not be established.
-
<tls-crypt>
section of.ovpn
file remains empty -
Packages may not be installed at all (
openvpn
,easy-rsa
etc.) Related error for that:E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1502 (apt-get) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to lock directory /var/lib/apt/lists/
-
Error messages caused by commands at the line 931
cp: cannot stat '/lib/systemd/system/[email protected]': No such file or directory sed: can't read /etc/systemd/system/[email protected]: No such file or directory sed: can't read /etc/systemd/system/[email protected]: No such file or directory Failed to enable unit: Unit file [email protected] does not exist. Failed to restart [email protected]: Unit [email protected] not found.
Server Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-42-generic x86_64)
Client Mac — Viscosity iOS — Official OpenVPN client
References
[^1]: Bug report: (apt: support option to wait for lockfile)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754103
[^2]: Feature request: (apt/aptitude finer grained locking)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478961
Probably the same answer as checking the $PATH
variable https://github.com/angristan/openvpn-install/issues/593#issuecomment-606007954
This is not a bug in this script.
I can say, on ubuntu after starts (user logon)... Do a automatic apt update.. maybe was that causing your problem on lock.. just need wait a little..