老电脑拿出来装了个Ubuntu,遇到了不少问题,写出来记录一下。
一.无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
sudo apt-get update
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
当执行sudo apt-get相关的命令,会显示上面类似的错误
参考别人的解决方法是
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
可以运行
sudo rm /var/lib/apt/lists/lock
sudo rm /var/lib/dpkg/lock
二.无法解析主机
只需要将etc下的hosts文件中127.0.0.1对应的主机名改成自己的电脑主机名称就行了。
sudo vim /etc/hosts
三.切换更新源
总是更新不了,你懂的,直接换成阿里云的源就好多了啊
sudo vim /etc/apt/sources.list
删除以前的,改为下面的
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
暂时先说这么多吧。。。