![Could not open lock file /var/lib/dpkg/lock-frontend ubuntu Could not open lock file /var/lib/dpkg/lock-frontend ubuntu](/uploads/1/2/4/7/124748754/198924912.png)
I'm trying to execute the command sudo apt-get -y install linux-headers-rpi to install this driver for a pm sensor. However, my raspi gives me this output every time when I execute this command: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?I've searched through other post on the forum, and they said that it should be ok once I've reboot it or killed the process that's occupying the file. I did it, but it didn't work.
![Could Not Get Lock /var/lib/dpkg/lock-frontend Open Could Not Get Lock /var/lib/dpkg/lock-frontend Open](http://www.programmersought.com/images/136/9fa7d4229d28fd36e29dda2f51c2a5c0.png)
Yes, there was something obvious that I was missing. Systemd is all about concurrent start of services, so the cloud-init script is run at the same time the apt-daily.service is triggered. By the time cloud-init gets to execute the user-specified payload, apt-get update is already running. So the attempts 2. Failed not because of some namespace magic, but because they altered the system.