I just bought a NAS (Lenovo ix4-300d) that's running Debian, and I just found out how to enable SSH. I want to install Apache, MySQL and PHP for local development.
When I'm trying to use apt-get
, I get the following error:
login as: root
root@192.168.1.76's password:
root@ix4-300d:/# apt-get install php5
E: Could not open lock file /var/lib/dpkg/lock - open (2 No such file or directory)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
root@ix4-300d:/# su
sh-3.2# apt-get install php5
E: Could not open lock file /var/lib/dpkg/lock - open (2 No such file or directory)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Even though I su
ed to get root access, it still tells me I'm not root when trying to use apt-get
.
How do I fix apt-get
here?
Best Answer
Well, it looks like for some reason, Debian was unable to open up the lock file apt uses. This seems to be a massively common thing according to Google.
This seems to be a logical solution - that
/var/lib/dpkg/lock
dosen't exist - so checking for the existence of and creating/var/lib/dpkg/
might help.If it also complains that
/var/lib/dpkg/status
doesn't exist, you should be able to copy it from a backup by doingcp /var/backups/dpkg.status.0 /var/lib/dpkg/status
as root.