Debian

sudo 安裝問題

  • January 13, 2019

我剛剛從 osboxes 下載了 Debian 9.6.0 以在 VM 上執行它。但是,我遇到了一些問題。

我不能sudo。好的,您必須先安裝它。沒問題……我想。事實證明,我確實有一些。查了Google后發現:

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 中的行來解決這個問題時。但是,這個文件是只讀的,我不能編輯它。

sources.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\>在最後一行返回

您應該等待通過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的文件範例:Sources- List

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 和 non-free 組件,請在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

引用自:https://unix.stackexchange.com/questions/493200