セキュアブートを有効にしているために毎度ひと手間かかる初回のVirtualBoxインストールです。
VirtualBox7.1.10のインストールと設定
Index of http://download.virtualbox.org/virtualbox
ここから最新の7.1.10のフォルダに入って次の3つのファイルをダウンロードします。
virtualbox-7.1_7.1.10-169112~Debian~bookworm_amd64.deb
Oracle_VirtualBox_Extension_Pack-7.1.10.vbox-extpack
VBoxGuestAdditions_7.1.10.iso
まず最初のdebファイルを使ってVirutalBox7.1.10をインストールしました。
VirtualBoxを起動して機能拡張ー>インストール。
Oracle_VirtualBox_Extension_Pack-7.1.10.vbox-extpackを選択してインストールします。
さらにホストOSでユーザーをvboxusersグループに追加します。
sudo gpasswd -a ログイン名 vboxusers
これはゲストOSでUSB機器を使えるようにするためです。
仮想マシンの作成とゲストOSのインストールはVirtualBox7.0にDebian12.9をインストール-p--qと同じです。今回はゲストOSはDebian12.11にしました。
カーネルモジュールに署名する
はじめて仮想マシンを起動しようとすると/sbin/vboxconfigを実行するよう促す表示が出てきます。セキュアブートを有効にしているPCでは初回だけカーネルモジュールに署名しないといけません。
ホストOSの端末でsudo /sbin/vboxconfigを実行します。
pq@debian:~$ sudo /sbin/vboxconfig
[sudo] pq のパスワード:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-amd64 linux-headers-6.1.0-37-amd64
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-amd64 linux-headers-6.1.0-37-amd64
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
カーネルヘッダーがないのでカーネルモジュールがセットアップできないと言われています。
sudo apt install linux-headers-amd64 linux-headers-6.1.0-37-amd64
これでカーネルヘッダーをインストールしました。
再度端末でsudo /sbin/vboxconfigを実行します。
pq@debian:~$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: You must sign these kernel modules before using VirtualBox:
vboxdrv vboxnetflt vboxnetadp
See the documentation for your Linux distribution..
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Signing VirtualBox kernel modules.
vboxdrv.sh: failed:
System is running in Secure Boot mode, however your distribution
does not provide tools for automatic generation of keys needed for
modules signing. Please consider to generate and enroll them manually:
sudo mkdir -p /var/lib/shim-signed/mok
sudo openssl req -nodes -new -x509 -newkey rsa:2048 -outform DER -addext "extendedKeyUsage=codeSigning" -keyout /var/lib/shim-signed/mok/MOK.priv -out /var/lib/shim-signed/mok/MOK.der
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
sudo reboot
Restart "rcvboxdrv setup" after system is rebooted
.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
今度はモジュールを署名するためのキーを作成するように言われます。
VirtualBox6.0のインストール-p--qでやった方法とはMOK.derファイルの置き場が異なります。ログイン名という固有情報を入力しなくてよくて楽そうです。
sudo mkdir -p /var/lib/shim-signed/mok
sudo openssl req -nodes -new -x509 -newkey rsa:2048 -outform DER -addext "extendedKeyUsage=codeSigning" -keyout /var/lib/shim-signed/mok/MOK.priv -out /var/lib/shim-signed/mok/MOK.der
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
sudo reboot
国のコードとかemailとか色々質問されますがすべてデフォルトのままEnterで乗り切りました。
input password:でパスワードを設定します。
再起動時にロゴ画面がでてきたあと青い画面になったらとりあえず何かキーを押します。
Intel NUCでVirtualBoxの仮想マシンの起動-p--q
あとはこの記事の「Secure Bootのパスワードを使う」の通りにして先程設定したパスワードを使います。
これで仮想マシンが起動できるようになりました。
ゲストOSを自動ログインにする
Ubuntu 24.04 とフレーバーで自動ログインを有効にする
Debian CiannmonではGUIで自動ログインにはできないようなのでこれの「LightDM の自動ログインを有効にする」の方法を使います。
systemctl status display-manager
ディスプレイマネージャはこのコマンドで確認できます。
pq@vbox:~$ systemctl status display-manager
● lightdm.service - Light Display Manager
Loaded: loaded (/lib/systemd/system/lightdm.service; enabled; preset: enab>
Active: active (running) since Sat 2025-07-05 15:48:55 JST; 57min ago
Docs: man:lightdm(1)
Main PID: 1345 (lightdm)
Tasks: 5 (limit: 19110)
Memory: 123.0M
CPU: 11.743s
CGroup: /system.slice/lightdm.service
├─1345 /usr/sbin/lightdm
└─1357 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/ro>
Warning: some journal files were not opened due to insufficient permissions.
Debian CinnamonのディスプレイマネージャはLightDMです。
sudo mkdir -p
/etc/lightdm/lightdm.conf.d
sudo gedit /etc/lightdm/lightdm.conf.d/autologin.conf
これで開いたautologin.confファイルに以下を書き込んで保存します。
[SeatDefaults]
autologin-user=自動ログインするユーザー名
autologin-user-timeout=5
この設定では5秒の遅延をさせているのでログインダイアログがでてきてから5秒待つと設定したユーザーでログインされます。カウントダウンはでてきません。
起動メニューを表示させない
sudo apt install grub-customizer
これでインストールしたGrub Customizerの一般設定タブから起動時間を0にします。
メニュー表示のチェックを消してもだめでした。
0 件のコメント:
コメントを投稿