我安装了 Ubuntu 18.04,然后在安装 Virtualbox 后收到“i386”错误消息:
$ sudo apt-get update
Get:1 http://nl.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu bionic InRelease
Hit:4 http://nl.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://nl.archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:6 http://download.virtualbox.org/virtualbox/debian bionic InRelease [4429 B]
Get:7 http://download.virtualbox.org/virtualbox/debian bionic/contrib amd64 Packages [1426 B]
Fetched 248 kB in 1s (209 kB/s)
Reading package lists... Done
N: Skipping acquire of configured file 'contrib/binary-i386/Packages' as repository 'http://download.virtualbox.org/virtualbox/debian bionic InRelease' doesn't support architecture 'i386'
我在 Askubuntu 上找到了几个关于“i386”消息的答案,但我不知道如何将其应用到我的情况
答案1
首先,请注意,这只是笔记( N:
),而不是错误 ( E:
),甚至不是警告 ( W:
)。其次,记下出现此注释的存储库。在本例中,即http://download.virtualbox.org/virtualbox/debian
。在您的源中找到该存储库:
grep -F 'http://download.virtualbox.org/virtualbox/debian' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
这可能表明文件位于 中。/etc/apt/sources.list.d/virtualbox.list
然后编辑该文件:
sudoedit /etc/apt/sources.list.d/virtualbox.list
并更改存储库:
deb https://download.virtualbox.org/virtualbox/debian bionic contrib
专门仅适用于amd64
:
deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib
或者打开终端并执行以下命令:
echo "deb [arch=$(dpkg --print-architecture)] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
具体来说,对于 Virtualbox,您可以运行此 bash 脚本从 Oracle 存储库安装 virtualbox 及其依赖项(已在 Ubuntu 18.04/20.04/22.04-unconfirmed 中测试):
sudo chmod +x VboxInstall.sh && sudo ./VboxInstall.sh
#!/bin/bash
# Oracle Repository
# Download and install .asc
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor | tee /usr/share/keyrings/virtualbox.gpg &> /dev/null
# add repo
echo deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox.gpg] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib | tee /etc/apt/sources.list.d/virtualbox.list/virtualbox.list
apt update
# install vbox
apt -y install linux-headers-$(uname -r) build-essential gcc make perl dkms bridge-utils
apt -y install virtualbox-6.1
dpkg --configure -a && apt-get -f -y install
# install Extension Pack
export VBOX_VER=`VBoxManage --version | awk -Fr '{print $1}'`
wget -c http://download.virtualbox.org/virtualbox/$VBOX_VER/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VER.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VER.vbox-extpack
# configure
usermod -a -G vboxusers $USER
update-grub
/sbin/vboxconfig
echo "Done. Reboot"
# check service after reboot
systemctl status vboxdrv
答案2
您应该尝试使用https
deb 源:
deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib
答案3
我想就此事向 secretAgent 添加一条评论,但我的声誉不够。
由于此站点上列出的原因,我们不需要对 apt 包使用 https:https://whydoesaptnotusehttps.com/
此外,如果您的 virtualbox 源位于/etc/apt/sources.list
,ajcg 的答案可以修改为:
sudo nano /etc/apt/sources.list
编辑行
deb http://download.virtualbox.org/virtualbox/debian bionic contrib
到
deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bionic contrib
或者你可以直接启动终端并输入
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list