我刚刚从 osboxes 下载了 Debian 9.6.0 以在虚拟机上运行它。然而,我遇到了一些问题。
我不能 sudo。好的,你必须先安装它。没问题……我想。事实证明,确实有一些适合我。查了谷歌后我发现:
apt-get install sudo -y
最终结果是Could not get lock /var/lib/dpkg/lock - open (11: Resoruce temporarily unavailable
以及Unable to lock the admin directory /var/lib/dpkg/, is another process using it?
。请记住,我是作为默认 osboxes.org 帐户登录并su
之前使用过的。
GDA3R 的答案解决了锁定问题。然而,当我尝试时,apt-get install sudo
我得到please insert the disc labeled Debian GNU/Linux 9.5.0 _Stretch_
可以通过注释掉 services.list 中的行来解决。但是,该文件是只读的,我无法编辑它。
source.list如下
# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 20180714-10:25]/ stretch contrib main
deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 20180714-10:25]/ stretch contrib main
deb http://security.debian.org/debian-security stretch/updates main contrib
deb-src http://security.debian.org/debian-security stretch/updates main contrib
# stretch-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ stretch-updates main contrib
# deb-src http://deb.debian.org/debian/ stretch-updates main contrib
我想我应该胜过第二个 deb cdrom。我可以在终端中打开该文件。但是,尝试插入 # 会导致光标跳转到第一个 deb 并返回?\<deb\>
最后一行
答案1
您应该等待通过服务完成自动更新apt-daily.service
(在后台)。
或者您可以停止apt-daily.service
正在运行的apt
实例,然后手动运行已中止的任务(以 root 身份):
systemctl stop apt-daily.service
pkill apt
dpkg-configure -a
apt update
apt install sudo
要解决该错误:
please insert the disc labeled Debian GNU/Linux 9.5.0 _Stretch_...
以 root 身份,注释或从您的sources.list
.
/etc/apt/sources.list
这是来自的文件示例Debian Wiki:来源-列表
deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main
deb http://deb.debian.org/debian-security/ stretch/updates main
deb-src http://deb.debian.org/debian-security/ stretch/updates main
deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main
如果您还想要 contrib 和非免费组件,请
contrib non-free
在后面添加main
:
deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free
deb http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free
答案2
您好,您需要从sources.list 文件中删除cdrom 条目。要解决此问题,只需转到命令行并输入:
sudo sed -i '/cdrom/d' /etc/apt/sources.list
这将解决它。