1. 程式人生 > >ubuntu 18.0.4 安裝vagrnat安裝執行

ubuntu 18.0.4 安裝vagrnat安裝執行

0x01  bash: /etc/init.d/vboxdrv: 沒有那個檔案或目錄

 

Kernel driver not installed (rc=-1908)
 
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
 
'/etc/init.d/vboxdrv setup'
 
as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

 將軟體源替換為官方源

先執行下面命令:

sudo gedit /etc/apt/sources.list
# deb cdrom:[Ubuntu 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

將源新增進去

執行命令
apt-get clean
然後執行

apt-get update -y && apt-get dist-upgrade -y && apt-get install linux-headers-$(uname -r) -y &&  apt-get install virtualbox -y
 此時會安裝預設的virtualbox,命令列下 輸入下面命令

virtualbox

但是彈出了這樣的提示

接著繼續執行命令

apt-get install virtualbox-dkms
virtualbox解除安裝掉
apt-get remove virtualbox
apt-get install vagrant
apt-get install virtualbox  或是安裝過程中出現"核心不存在",需要解決依賴即dpkg下的info有問題,中間可能會出現輸入密碼等的安全模式驗證,需要進入BIOS把安全模式關掉

 出現一種新的錯誤

嗯,沒錯,這個是說vboxdrv核心模組沒有被載入。下面一大堆的也不看了,解決方法如下

0x04  修復核心模組問題

1

apt-get install linux-headers-$(uname -r)

 問題又出現了,但是出現一定是可以解決的。

看看問題詳情

很顯然是缺少依賴

國際慣例執行修復命令來修復依賴問題,執行下面命令

1

apt-get -f install

 過程中可能需要輸入 確認

vagrant box add name url.box

vagrant init

vagrant up 啟動不成功,看警告,會出現資料夾許可權的原因

啟動成功後

VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

  1. 如果是重啟電腦的,一直接del鍵,進入BIOS設定。

    VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

  2. 進入BIOS設定頁面,切到Configuration頁,如下圖所示,可以看到Intel Virtual Technology這一項現在是Disabled的。

    VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

  3. 切到該項後回車,在彈出的選擇框中選擇Enabled後回車。

    VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

  4. 如下圖所示,這時可以看到該功能選項被設定成了Enabled。

    VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

  5. 按F10儲存,彈出如下對話方塊,預設是Yes選項,選擇直接回車即可。

    VBOX提示VT-x/AMD-V硬體加速不可用怎麼辦

背景:

系統是win+virtualBox 在虛擬機器中安裝了linuxMint系統。

如何共享目錄呢

第一步:

在虛擬機器中安裝增強功能

2,在virtualBox中設定共享目錄

3,在linux下建立共享目錄 winShare   

mkdir winShare

4,設定掛載,注意linuxMintShare和winShare的名字不能一樣。

sudo mount -t vboxsf linuxMintShare /home/komiles/winShare

5,檢視檔案

linux下面:

windows下面:

6,不想每次都手動掛載,可以編輯/etc/fstab檔案

sudo vim /etc/fstab
linuxMintShare /home/komiles/winShare vboxsf rw,gid=100,uid=1000,auto 0 0

7,卸掉掛載

sudo umount -f /home/komiles/winShare

8,檢視本機有多少掛載點

df -l 或者df -h