我得到这个输出:
7 packages can be updated.
7 updates are security updates.
Last login: Tue Apr 19 10:04:51 2016 from 10.0.0.199
每当我连接到我的服务器时。我仍然看到这些包没有更新!我是 root ( sudo su
)。
当我sudo apt-get update
得到这个:
myserver@YHserver:~$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denie d)
E: Unable to lock directory /var/lib/apt/lists/
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?
Hit http://il.archive.ubuntu.com wily InRelease
Hit http://il.archive.ubuntu.com wily-updates InRelease
Hit http://il.archive.ubuntu.com wily-backports InRelease
Hit http://il.archive.ubuntu.com wily/main Sources
Hit http://il.archive.ubuntu.com wily/restricted Sources
Hit http://il.archive.ubuntu.com wily/universe Sources
Hit http://il.archive.ubuntu.com wily/multiverse Sources
Hit http://il.archive.ubuntu.com wily/main amd64 Packages
Hit http://il.archive.ubuntu.com wily/restricted amd64 Packages
Hit http://il.archive.ubuntu.com wily/universe amd64 Packages
Hit http://il.archive.ubuntu.com wily/multiverse amd64 Packages
Hit http://il.archive.ubuntu.com wily/main i386 Packages
Hit http://il.archive.ubuntu.com wily/restricted i386 Packages
Hit http://il.archive.ubuntu.com wily/universe i386 Packages
Hit http://il.archive.ubuntu.com wily/multiverse i386 Packages
Hit http://il.archive.ubuntu.com wily/main Translation-en
Hit http://il.archive.ubuntu.com wily/multiverse Translation-en
Hit http://il.archive.ubuntu.com wily/restricted Translation-en
Hit http://il.archive.ubuntu.com wily/universe Translation-en
Hit http://il.archive.ubuntu.com wily-updates/main Sources
Hit http://il.archive.ubuntu.com wily-updates/restricted Sources
Hit http://il.archive.ubuntu.com wily-updates/universe Sources
Hit http://il.archive.ubuntu.com wily-updates/multiverse Sources
Hit http://il.archive.ubuntu.com wily-updates/main amd64 Packages
Hit http://il.archive.ubuntu.com wily-updates/restricted amd64 Packages
Hit http://il.archive.ubuntu.com wily-updates/universe amd64 Packages
Hit http://il.archive.ubuntu.com wily-updates/multiverse amd64 Packages
Hit http://il.archive.ubuntu.com wily-updates/main i386 Packages
Hit http://il.archive.ubuntu.com wily-updates/restricted i386 Packages
Hit http://il.archive.ubuntu.com wily-updates/universe i386 Packages
Hit http://il.archive.ubuntu.com wily-updates/multiverse i386 Packages
Hit http://il.archive.ubuntu.com wily-updates/main Translation-en
Hit http://il.archive.ubuntu.com wily-updates/multiverse Translation-en
Hit http://il.archive.ubuntu.com wily-updates/restricted Translation-en
Hit http://il.archive.ubuntu.com wily-updates/universe Translation-en
Hit http://il.archive.ubuntu.com wily-backports/main Sources
Hit http://il.archive.ubuntu.com wily-backports/restricted Sources
Hit http://il.archive.ubuntu.com wily-backports/universe Sources
Hit http://il.archive.ubuntu.com wily-backports/multiverse Sources
Hit http://il.archive.ubuntu.com wily-backports/main amd64 Packages
Hit http://il.archive.ubuntu.com wily-backports/restricted amd64 Packages
Hit http://il.archive.ubuntu.com wily-backports/universe amd64 Packages
Hit http://il.archive.ubuntu.com wily-backports/multiverse amd64 Packages
Hit http://il.archive.ubuntu.com wily-backports/main i386 Packages
Hit http://il.archive.ubuntu.com wily-backports/restricted i386 Packages
Hit http://il.archive.ubuntu.com wily-backports/universe i386 Packages
Get:1 http://security.ubuntu.com wily-security InRelease [65.9 kB]
Hit http://il.archive.ubuntu.com wily-backports/multiverse i386 Packages
Hit http://il.archive.ubuntu.com wily-backports/main Translation-en
Hit http://il.archive.ubuntu.com wily-backports/multiverse Translation-en
Hit http://il.archive.ubuntu.com wily-backports/restricted Translation-en
Hit http://il.archive.ubuntu.com wily-backports/universe Translation-en
Get:2 http://security.ubuntu.com wily-security/main Sources [45.5 kB]
Get:3 http://security.ubuntu.com wily-security/restricted Sources [2,854 B]
Get:4 http://security.ubuntu.com wily-security/universe Sources [11.7 kB]
Get:5 http://security.ubuntu.com wily-security/multiverse Sources [2,782 B]
Get:6 http://security.ubuntu.com wily-security/main amd64 Packages [145 kB]
Get:7 http://security.ubuntu.com wily-security/restricted amd64 Packages [10.9 k B]
Get:8 http://security.ubuntu.com wily-security/universe amd64 Packages [52.1 kB]
Get:9 http://security.ubuntu.com wily-security/multiverse amd64 Packages [6,253 B]
Get:10 http://security.ubuntu.com wily-security/main i386 Packages [142 kB]
Get:11 http://security.ubuntu.com wily-security/restricted i386 Packages [10.8 k B]
Get:12 http://security.ubuntu.com wily-security/universe i386 Packages [52.1 kB]
Get:13 http://security.ubuntu.com wily-security/multiverse i386 Packages [6,430 B]
Hit http://security.ubuntu.com wily-security/main Translation-en
Hit http://security.ubuntu.com wily-security/multiverse Translation-en
Hit http://security.ubuntu.com wily-security/restricted Translation-en
Hit http://security.ubuntu.com wily-security/universe Translation-en
Fetched 555 kB in 2s (227 kB/s)
Reading package lists... Done
我该怎么做才能更新它?这是安全更新,而且似乎很重要
我总是追求apt-get upgrade -y
“更新”。
我没有删除锁文件并按照这篇文章的第二条评论操作: 无法锁定管理目录(/var/lib/dpkg/),是否有另一个进程正在使用它? 这没有帮助。我看不到持有“apt”的进程
root 3004 0.0 0.0 9496 2260 pts/0 S+ 10:32 0:00 grep --color=auto apt-get
root@YHserver:/home/myserver# kill -9 3004
bash: kill: (3004) - No such process
root@YHserver:/home/myserver# kill -9 2260
bash: kill: (2260) - No such process
root@YHserver:/home/myserver# kill -9 9496
bash: kill: (9496) - No such process
答案1
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denie d)
E: Unable to lock directory /var/lib/apt/lists/
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?
这看起来就像您遇到了某种权限问题。
myserver@YHserver ...
更新/升级时,您应该是 root。看起来您是“myserver”,而不是 root。您是通过 ssh 还是直接连接到机器?(您需要启用“通过 ssh 的 root”)
请尝试执行 patrick 编写的命令并在此报告结果
sudo apt-get update
sudo apt-get upgrade -y
如果这没有帮助,请尝试以下操作:
su
apt-get update
apt-get upgrade -y
我想到了一个另一种可能性:你检查过 dist-upgrades 吗?
sudo apt-get dist-upgrade
答案2
尝试这个
sudo apt-get update;sudo apt-get upgrade -y
我经常使用它,如果有可用的更新,它会更新所有已安装的软件包