Linux あれこれ

Linux 関連(一部 Windows11 )の備忘録です。

「Windows11」(22H2) を、「Windows11」(23H2) にアップデート〈H165-6〉

登録日: 2024-03-14 更新日: 2024-03-14

「Windows11」(22H2) を、「Windows11」(23H2) にアップデートしました。セキュリティサポート期間の延長が主な目的です。

ただし、手持ちのPC は古くて「Windows11」の「システム要件」を満たしていないので、「推奨されない」手順を使いました。

その備忘録です。

-

-

注意点:

「Windows11」の「システム要件」を満たす PC であれば、通知を待っての「アップデート」、もしくはダウンロード後 setup を実行するやり方が安全です:

今回のやり方は「自己責任」です。

-

大事なデータは「クラウド」に退避して、失敗したら「Linux に移行する」つもりで行いました。

-

-

使用したPC は、USB 3.0 ポートのあるノートPC で、「Windows 10」から「Windows11」(22H2) に移行済です。メモリ 12GB に増設、SSD 1TB に置換して強化しましたが、CPU が古い世代の「i5」で、TPM 1.2 なので「システム要件」を満たしていません。

UEFI 立ち上げ」のPC です。

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

前回の作業:

Windows マシンを、「Windows10」から「Windows11」(22H2) に移行〈H165〉

-

今回の作業:

  1. 「Windows11」(22H2) を最新にアップデート:

  2. 「Windows11」(23H2) の iso イメージをダウンロード:

  3. 「Windows11」(23H2) にアップデート:

-

参考:

TPM について:

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

アップデートした「Windows11」(23H2) を起動:

-

「Windows11」のバージョンを表示:

Windows ボタンを右クリック→「システム」→一覧で「バージョン」の項目を確認:

-

Windows」(23H2) の画面:

→多くの機能が追加されたみたいですが、壁紙も、外観も「Windows11」(22H2) のときとほとんど変わりません。

違いは、パネルバーの右端に「Copilot」アイコンが追加されたぐらい。

-

追加された「Copilot」を起動:

パネルの「Copilot」アイコンをクリックするか、「 Windows + C 」を同時押しで起動します。

-

→AI 機能のある「検索メニュー」および「アシスタント機能」です。

「うまい質問」をするのがコツみたい。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

参考: 「Windows11」(23H2) へのアップデートについて:

-

Windows 11 のセキュリティ更新プログラムの提供を受けるには、アップデートして「機能更新プログラム」を適用する必要があります:

Windows 11 の「機能更新プログラム」は毎年10月頃に提供されています。
適用することで、セキュリティ更新プログラムを提供する期間が 24ヶ月延長されます。
(つまり、2年ごとに更新が必要で、2つ前のバージョンを使い続けることはできません。)

Version 23H2 〜 2025-10月頃まで
Version 22H2 〜 2024-10-08 まで
Version 21H2 〜 2023-10-10 まで

-

Windows 11」の「システム要件」:

プロセッサ(CPU)
        Intel      : 第 8 世代以降の CPU
        AMD        : Zen2 以降の CPU
メモリ              :  4 GB 以上
ストレージ           : 64 GB 以上
TPM                : バージョン 2.0
システムファームウェア : UEFI、セキュア ブート対応

-

手持ちの PC で、アップデートを行うと下記が表示:
この PC は現在、Windows 11 を実行するための最小システム要件を満たしていません

-

要件をチェックすると 2つがアウト:
  • TPM」のバージョンが「1.2」

  • 「CPU」が i5 、「世代が古い CPU」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

参考: TPM について:

-

TPM (Trusted Platform Module) は、デバイス上でセキュリティ機能を提供するために、 暗号化で利用する「鍵」(証明書)を、金庫?とは別の安全な場所(TPM)で管理するための仕組みです。

TPM には、「1.2」と「2.0」が存在します。

-

TPM は物理的なハードウェアとして「マザーボード上」に搭載される場合と、

CPU 内蔵の TPM 機能 (Intel PTT、AMD fTPM) が使われる場合、

「外付けのハードウェア」として搭載される場合があります。

-

最近の PC であれば、起動時の UEFI (BIOS) セットアップ画面から「Intel PPT」や「AMD fTPM」を有効化することで利用可能になる場合があります。

-


1). 「TPM」のバージョンを「tpm.msc」で確認する場合:

-

Windows + R →「tpm.msc」Enter

GUI が起動して、TPMが実装されているかどうかが表示されます:

一番下にある表示:

仕様バージョン: 1.2

-

2). 「TPM」のバージョンを管理者権限で「PowerShell」を起動して確認する場合:

-

Windows キー →「po」で絞り込み→「PowerShell」の項目の「管理者として実行する」をクリック:

許可する?

→「はい」

-

PS C:\Windows\system32 >

→管理者権限のプロンプトが表示:

-

確認:

PS C:\Windows\system32 > get-tpm

一覧の表示にて、複数の項目で下記が表示されました:

TPM 1.2 ではサポートされていません

-


3). 注意:

Windows 11」の導入のときに、CPU 交換なども考えている場合で、 「BitLocker」などを使っていたら、あらかじめ解除してから CPU を交換しないと(CPU に TPM がある場合があるので)起動できなくなる可能性があります。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

1. 作業前に「Windows11」(22H2) を最新に上げておきます:

-

Windows →設定→「Windows Update」を実行:

再起動:

-

何度か繰り返して、

→「Windows 11」(22H2) を最新の状態にしました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

2. ブラウザにて、「Windows11」(23H2) の iso イメージをダウンロード:

-

1). ブラウザ(edge、もしくは Firefox など)を起動:

-

2). ダウンロード:

Windows 11 download」で検索:

-

Windows 11 をダウンロードする」をクリック

-

Windows 11 ディスクイメージ(ISO)をダウンロードする」をクリック

「ダウンロードを選択」をクリック

→「Windows 11 (multi-edition ISO)」を選択(1つしかありません)

下の「ダウンロード」をクリック

-

製品の言語の選択:

「1 つ選択」をクリック

→「日本語」を選択

下の「確認」をクリック

-

Windows 11 日本語

「64-bit ダウンロード」をクリック

→「Win11_23H2_Japanese_x64v2.iso」(6.3 GB) のダウンロードが開始されます

-

3). ダウンロードが完了したら、吹き出しの右の「フォルダ」アイコンをクリック

エクスプローラで「ダウンロード」フォルダが表示:

「Win11_23H2_Japanese_x64v2.iso」を右クリック →「マウント」をクリック

「このファイルを開きますか?」

→「開く」

-

追記:

複数の Windows 11 マシンがある場合は、USB メモリ(8GB 以上を ntfs で初期化)を準備してコピーしておくと、2回目以降のダウンロードの手間が省けます。

-

Windows」に未練がある場合は、前回の〈H165〉 の「Rufus」ツールで、立ち上げ可能なUSB メモリを作るやり方が良いかも:(自己責任)

もし、HDD が壊れた等で新規インストールから行う場合は、「ライセンス」関連を聞いてくることがあるので、各 PC に貼られた Windows のライセンスのラベルをスマホのカメラで写しておくと、小さな文字を拡大できます。

-

4). エクスプローラで iso イメージが開かれるので、

左側の「DVD ドライブ」を見て、ドライブ番号を確認: 「F:」ドライブ

-

ブラウザは使わないので、右上の「x」で閉じます:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

3. 「Windows11」(23H2) にアップデート:

-

「サーバー」としてアップデートすると、「Windows11」で要求される仕様が少なくできるみたい:

-

1). コマンドプロンプトを起動:

-

Windows」+R →「cmd」Enter

→「コマンドプロンプト」が起動:

C:\Users\user>

-

2). ダウンロードした iso イメージをマウントした「F:」ドライブに変更:

使用環境により、ドライブ番号は変わります:

C:\Users\user> f:

プロンプトが下記に変わりました:

F:\>

-

ファイルを確認:

F:\> dir /w

-

3). 作業フォルダを移動:

F:\> cd sources

-

ファイルを確認:

F:\sources> dir /w

-

4). コマンドを実行:

F:\sources> setupprep /product server

許可しますか?

→「はい」をクリック

-

5). 「Windows Server のインストール」画面表示:

画面にある「セットアップでの更新プログラムのダウンロード方法の変更」をクリック

-

6). 「今は実行しない」にチェック

→「次へ」をクリック

-

この設定で余計な処理が回避できるので早く完了します:

-

7). 「適用される通知とライセンス条項」画面:

→「同意する」をクリック

-

8). 「引き継ぐ項目を選んでください」画面:

「ファイル、設定、アプリを保持する」にチェック

→「次へ」をクリック

-

9). 「インストール準備完了」画面:

今までの設定が表示されるので確認:

Windows 11 Home をインストール」にチェックあり

「ファイル、設定、アプリを保持する」にチェックあり

-

→「インストール」をクリック

青色の「Windows Server のインストール中」画面表示:

10). インストールが完了したら、再起動されます:

-

11). Windows を右クリック →システム →バージョンを確認:「23H2」

-

12). Windows →設定 →「Windows Update」を実行:

セキュリティ関連の更新が多数ありました。

何度か再起動:

→最新の状態にしました:

-

-


まとめ

「Windows11」を「Windows11」(23H2) にアップデートしました。推奨された手順ではないので「自己責任」です。

-

見た目で気付くのは、画面下の、パネルの右端に「Copilot」アイコンが追加されたこと:

「検索」メニューが、今流行りの「Ai 機能」を使った「アシスタント」機能になりました:

-

Windows11 23H2 新機能」で検索:

  • AI アシスタント「Microsoft Copilot」の搭載:
  • 「ペイント」に AI 機能搭載:
  • 圧縮ファイル「RAR」「7Z」「TAR」などを標準でサポート:
  • 「タスクバー」のアップデート:
  • スクリーンショットツール「Snipping Tool」のアップデート:

個人的にありがたいのは「ペイント」アプリの強化。キャプチャ画像から文字を抽出したり、 キャプチャ画像の背景を消して、別の背景(レイヤ)を重ねたりできます。

-

色々と追加された機能を試してみるとおもしろいかも。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

Vagrant 実践編9: 公式「Box」にある「almalinux/9」をインストール〈H170-12〉

登録日: 2024-03-08 更新日: 2024-03-14

Xubuntu 22.04.4 LTS」、および「Windows11」(22H2) の「VirtualBox 7.0.14」にて、「Vagrant」(ベイグラント) という仮想マシンの管理ツールを使えるようにしました。

-

(実践編9):

今回は、その環境で、公式「Box」にある「almalinux/9」をインストールしました。
CentOS 後継(互換?)の RHEL クローンOS のひとつです。

前回の投稿で、(VirtualBox の)「仮想マシン」の立ち上げ時に自動で「Guest Additions」の更新やインストールをしてくれる、Vagrant の「プラグイン」を(ホストOS 側に)追加しているので、だいぶ楽ができると思います。

-

その備忘録です。

-

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

Vagrant」を使うときの参考:

  1. 「Vagrant」コマンドについて:

  2. 「Vagrant」コマンドの使用例:

  3. 「Vagrant」コマンドの使用例:(目次)

  4.  修正版3: 使い回し可能な「Vagrantfile」:

  5. 「vagrant vbguest」のヘルプを表示:

  6.  Vagrant に「vagrant-vbguest」プラグインをインストールする場合:

  7.  もし、PC のディスクに余裕がない場合:

  8. 「ssh 接続」でオススメのテキストエディタ「nano」:

  9.  もし、PC のディスクに余裕がない場合:

-

今回の作業:

  1.  目的の「Box」を検索:

  2. 「作業フォルダ」を作成:

  3. 「Vagrantfile」を作成:

  4. 「仮想マシン」の(初回の作成と)立ち上げ:

  5. 「Vagrantfile」を修正:

  6. 「仮想マシン」の再作成:

  7. 「ホスト名」を「vagrant」に変更したい場合:

  8. 「今回の作業で気づいたこと:

-

「AlmaLinux」関連の投稿:

  1.  VirtualBox に「AlmaLinux 9.0」をインストール〈H154〉

  2. 「AlmaLinux 9.0」にアプリをインストール〈H154-2〉

  3. 「AlmaLinux 9.0」に「ibus-mozc」をインストール〈H154-3〉

  4. 「AlmaLinux 9.0」に「Xfce」デスクトップ環境をインストール〈H154-5〉

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

Vagrant で「Almalinux 9.3」の「仮想マシン」を立ち上げ:

-

1). 公式「Box」の「almalinux/9」を「vagrant up」で立ち上げ:

事前に「Vagrantfile」を作成:

左の「端末」画面から起動:

$ cd ~/ダウンロード/vm/almalinux/
$ vagrant up

-

左の「端末」画面はちゃんと完了しました:

ただし、右の「仮想マシン」の画面は、メッセージの途中で止まってしまい、いくら待ってもログイン画面が表示されません。

-

仮想マシン」の画面をクリックして、マウスのスクロールボタンを動かしたら、画面が真っ暗になりました:

→「ssh 接続」はできたので、「仮想マシン」は立ち上がっています。表示だけの問題です。

-

2). 「Vagrantfile」を修正して立ち上げ:

→ディスプレイメモリが小さかったので、大きくしたら、ちゃんとログイン画面が表示されました:

-

-

(デスクトップを後で追加することを考え、)GUI 表示するように設定していたので、表面化したみたい。

ssh 接続」のみで使っていれば、気付きませんでした。

公開されている「Box」は最小構成の場合が多いので、使い方によっては問題が発生します。

-

-


現在のバージョンを表示:

-

ホストOS : 「Xubuntu 22.04.4 LTS」

2024-03-08 現在

カーネル:

$ uname -r
5.15.0-100-generic

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

→ついに「22.04.4」に上がりました。

安定しているので、次のLTS版が落ち着く Ubuntu 24.04.1 LTS(noble)になる頃(1年後)まで使いたいところ。

-

Vagrant」のバージョン:

$ vagrant --version
Vagrant 2.4.1

-

vagrant-vbguest」プラグインのバージョン:

$ vagrant plugin list
vagrant-vbguest (0.32.0, global)

-

-

ゲストOS : 「Almalinux 9.3」

2024-03-08 現在

カーネル:

$ uname -r
5.14.0-362.8.1.el9_3.x86_64

→サーバーでの使用が多く、安定度重視なので、Ubuntu より少しカーネルは遅れています

-

リリース:

$ cat /etc/system-release
AlmaLinux release 9.3 (Shamrock Pampas Cat)

-

$ cat /etc/redhat-release
AlmaLinux release 9.3 (Shamrock Pampas Cat)

→「Shamrock Pampas Cat」は開発コード名(総称)?です:

-

$ cat /etc/os-release
:
NAME="AlmaLinux"
VERSION="9.3 (Shamrock Pampas Cat)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.3 (Shamrock Pampas Cat)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.3"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"

→「ID_LIKE=」を見ると、CentOS 後継?(RHEL クローン)ということがわかります:

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

参考: RHEL クローンのサポート期間:

RHEL クローン(RHEL 100% 互換?)の「AlmaLinux 9.3」は、2032年(リリースから10年)までサポートされます。

ただし、RHELRHEL クローンは(サーバー向けなので)安定度を増すために、Fedora に比べてカーネルは古いバージョンだし、リポジトリの使用も制限されています。もし、デスクトップで使うときは EPEL リポジトリを追加すると Fedora の一部のパッケージが使えるようになるので使い勝手が向上します。

ちなみに、Vagrant の公式「Box」には、公式に「AlmaLinux 9.3」が「almalinux/9」として登録されており、安心して使えます。今回は、その「Box」を使いました。

一方の「Rocky Linux 9」は、公式の登録はなく、個人で登録の「boxomatic/rocky-9」などを使うことになります。セキュリティ面では不利ですが、実機で使う前の確認のみであればリスクは下がりますし、自分で iso から「Box」を作成してもOK。

-

「AlmaLinux 9.3」はRHEL クローンですが、やはり100% ではありません。微妙に違います:

$ dnf list gcc
:
gcc.x86_64       11.4.1-2.1.el9.alma         @appstream

→「alma」に注目

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

VirtualBox」について:

-

VirtualBox」は、Oracle が開発している「仮想マシン」を構築するためのソフトウェアです。

-

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

Vagrant」 (ベイグラント) について:

-

公式サイト:

Vagrant by HashiCorp

-

仮想マシン」の管理や操作をコマンドで行うことで、作業効率を上げてくれる「フロントエンド」のソフトウェアです:

-

→詳細は、以前に投稿した「こちら 」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

「AlmaLinux」について:

-

公式サイト:

AlmaLinux

抜粋:

AlmaLinux OS は、CentOS Linux 安定版リリースの廃止によって残された溝を埋める、
オープンソースのコミュニティ主導の Linux オペレーティングシステムです。
RHEL とバイナリ レベルで完全に互換なクローンです。

AlmaLinux OS は、単独の無料の OS として、CloudLinux Inc. から支援を受けて、
コミュニティのメンバーによって開発されています。

-

AlmaLinux 9.3 安定版を発表! :

Announcing AlmaLinux 9.3 Stable!

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

1. 公式の「Box」にて、目的の「Box」を検索:

-

公式の「Box」の検索サイト:

Discover Vagrant Boxes

-

「検索キー」の入れ方で、微妙に、表示される「Box」が変わります:

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

「almaLinux」で検索:

「almalinux/8」もヒットしますが、今回は無視:

-

almalinux/9」サイトの記述:

AlmaLinux OS 9.3 (Shamrock Pampas Cat)

リリースノート

-

(1). 「New」タブ
vagrant init almalinux/9
vagrant up

→作業フォルダで上記のコマンドを実行すると、仮想マシンが作成されます

-

(2). 「Vagrantfile」タブ
Vagrant.configure("2") do |config|
  config.vm.box = "almalinux/9"
end

→上記の「Vagrantfile」を作業フォルダに作成して「vagrant up」すると、仮想マシンが作成されます

-

(3). 下記をクリックすると「.box」ファイルがダウンロードできますが、今回は直接のダウンロードはしません:

-

virtualbox v9.3.20231118

Vagrant Cloud に登録 (872 MB)

4 ヶ月前に作成:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

2. 「作業フォルダ」の作成:

-

作業フォルダに移動してコマンドを実行すると、コマンドで「仮想マシン名」や「id」番号を省略できます:

-

作業フォルダ名は分かりやすい名前にしました:

$ mkdir -p ~/ダウンロード/vm/almalinux/

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

3. 「Vagrantfile」を手動で作成:

-

個人的にオススメの設定:

→以前に「仮想マシン」を作成したときに発生した問題に対応しているので、立ち上げが成功しやすいです:

GUI の「デスクトップ」の追加を前提にした設定なので、「ssh 接続」のみで使うには無駄が多いかも。

-


「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/almalinux/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "almalinux/9"
  #config.vm.box_version = "9.3.20231118"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  # ホストの作業フォルダ内の data フォルダと
  # 仮想マシン内の /vagrant_data フォルダを共有:
  # 指定のフォルダがない場合は、フォルダを作成:
  config.vm.synced_folder "./data", "/vagrant_data", create: true
  # デフォルトの共有フォルダを無効にします:
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.provider "virtualbox" do |vb|
    # 仮想マシンの起動時に VirtualBox GUI を表示:
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

説明:

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7〜8行目で、リトライのタイムアウト値を短く調整: ←(ssh 認証時のループ回避)
9〜12行目で、共有フォルダ「/vagrant_data」を設定: ★
13〜14行目で、デフォルトの共有フォルダ「/vagrant」を無効化: ★
17行目で、GUI 表示を有効に設定:
18〜19行目で、メモリ「2048」MB に変更:
20行目で、プロセッサ「2」個 に変更:
21〜22行目で、ディスプレイを 「vmsvga」に変更:

-

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:「config.vm.box = "almalinux/9"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

6行目は、使用する「Box」のバージョンを指定します。最新バージョンにするときは、行頭に「#」を付けてコメント行にするか、行を削除します:

-

追記:

上記の設定だと、この後に問題がいくつか出たので、問題なくすぐに立ち上げたい場合は、下記の設定がオススメ:

最終的な「Vagrantfile」の設定は、「こちら」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

4. 「仮想マシン」を(作成して)立ち上げ:

-

1). 現時点で登録されている「Box」を確認:

$ vagrant box list
Endeav-base3  (virtualbox, 0)
fedora39-0225 (virtualbox, 0)

-

2). 現時点で作成されている「仮想マシン」を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base
:

-

3). Vagrant に、「vagrant-vbguest」プラグインがインストールされているか確認:

$ vagrant plugin list
vagrant-vbguest (0.32.0, global)

-


4). 「仮想マシン」の(初回の作成と)立ち上げ:

仮想マシン」に「Guest Additions」がインストールされて、再起動されるので、いつもよりも時間がかかります:

-

(1). 「Vagrantfile」が置かれた「作業フォルダ」に移動して、実行:
$ cd ~/ダウンロード/vm/almalinux/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'almalinux/9' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'almalinux/9'
    default: URL: https://vagrantcloud.com/api/v2/vagrant/almalinux/9
==> default: Adding box 'almalinux/9' (v9.3.20231118) for provider: virtualbox (amd64)
    default: Downloading: https://vagrantcloud.com/almalinux/boxes/9/versions/9.3.20231118/providers/virtualbox/amd64/vagrant.box
Progress: 1% (Rate: 4319k/s, Estimated time remaining: 0:05:58)

→初回のみ、カウントアップ:

    default: Calculating and comparing box checksum...
==> default: Successfully added box 'almalinux/9' (v9.3.20231118) for 'virtualbox (amd64)'!
==> default: Importing base box 'almalinux/9'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'almalinux/9' version '9.3.20231118' is up to date...
==> default: Setting the name of the VM: almalinux_default_1709581540358_50218
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!

「GuestAdditions」のバージョンがチェックされ、

「GuestAdditions」のバージョンアップ(ビルド)に必要な依存がインストール:

[default] GuestAdditions versions on your host (7.0.14) and guest (7.0.12) do not match.
AlmaLinux 9 - AppStream                         2.7 MB/s | 9.1 MB     00:03    
AlmaLinux 9 - BaseOS                            1.5 MB/s | 4.7 MB     00:03    
AlmaLinux 9 - Extras                             19 kB/s |  17 kB     00:00    
Last metadata expiration check: 0:00:01 ago on Mon Mar  4 19:47:10 2024.
Package binutils-2.35.2-42.el9.x86_64 is already installed.
Package perl-interpreter-4:5.32.1-480.el9.x86_64 is already installed.
Package bzip2-1.0.8-8.el9.x86_64 is already installed.
Dependencies resolved.
================================================================================
 Package                  Arch      Version                  Repository    Size
================================================================================
Installing:
 elfutils-libelf-devel    x86_64    0.189-3.el9              appstream     21 k
 gcc                      x86_64    11.4.1-2.1.el9.alma      appstream     32 M
 kernel-devel             x86_64    5.14.0-362.8.1.el9_3     appstream     20 M
 kernel-devel             x86_64    5.14.0-362.18.1.el9_3    appstream     15 M
 make                     x86_64    1:4.3-7.el9              baseos       531 k
Installing dependencies:
 annobin                  x86_64    12.12-1.el9              appstream    976 k
 gcc-plugin-annobin       x86_64    11.4.1-2.1.el9.alma      appstream     45 k
 glibc-devel              x86_64    2.34-83.el9_3.7          appstream     49 k
 kernel-headers           x86_64    5.14.0-362.18.1.el9_3    appstream    1.4 M
 libxcrypt-devel          x86_64    4.4.18-3.el9             appstream     28 k

Transaction Summary
================================================================================
Install  10 Packages

Total download size: 71 M
Installed size: 222 M
Downloading Packages:
(1/10): elfutils-libelf-devel-0.189-3.el9.x86_6 102 kB/s |  21 kB     00:00    
(2/10): gcc-plugin-annobin-11.4.1-2.1.el9.alma. 379 kB/s |  45 kB     00:00    
(3/10): glibc-devel-2.34-83.el9_3.7.x86_64.rpm  552 kB/s |  49 kB     00:00    
(4/10): annobin-12.12-1.el9.x86_64.rpm          1.0 MB/s | 976 kB     00:00    
(5/10): kernel-devel-5.14.0-362.18.1.el9_3.x86_ 2.2 MB/s |  15 MB     00:07    
(6/10): kernel-devel-5.14.0-362.8.1.el9_3.x86_6 2.8 MB/s |  20 MB     00:07    
(7/10): kernel-headers-5.14.0-362.18.1.el9_3.x8 1.8 MB/s | 1.4 MB     00:00    
(8/10): libxcrypt-devel-4.4.18-3.el9.x86_64.rpm 299 kB/s |  28 kB     00:00    
(9/10): make-4.3-7.el9.x86_64.rpm               2.4 MB/s | 531 kB     00:00    
(10/10): gcc-11.4.1-2.1.el9.alma.x86_64.rpm     2.1 MB/s |  32 MB     00:15    
--------------------------------------------------------------------------------
Total                                           4.2 MB/s |  71 MB     00:16     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : make-1:4.3-7.el9.x86_64                               1/10 
  Installing       : elfutils-libelf-devel-0.189-3.el9.x86_64              2/10 
  Installing       : kernel-headers-5.14.0-362.18.1.el9_3.x86_64           3/10 
  Installing       : libxcrypt-devel-4.4.18-3.el9.x86_64                   4/10 
  Installing       : glibc-devel-2.34-83.el9_3.7.x86_64                    5/10 
  Installing       : gcc-11.4.1-2.1.el9.alma.x86_64                        6/10 
  Running scriptlet: gcc-11.4.1-2.1.el9.alma.x86_64                        6/10 
  Installing       : annobin-12.12-1.el9.x86_64                            7/10 
  Running scriptlet: annobin-12.12-1.el9.x86_64                            7/10 
  Installing       : gcc-plugin-annobin-11.4.1-2.1.el9.alma.x86_64         8/10 
  Running scriptlet: gcc-plugin-annobin-11.4.1-2.1.el9.alma.x86_64         8/10 
  Installing       : kernel-devel-5.14.0-362.18.1.el9_3.x86_64             9/10 
  Running scriptlet: kernel-devel-5.14.0-362.18.1.el9_3.x86_64             9/10 
  Installing       : kernel-devel-5.14.0-362.8.1.el9_3.x86_64             10/10 
  Running scriptlet: kernel-devel-5.14.0-362.8.1.el9_3.x86_64             10/10 
  Verifying        : annobin-12.12-1.el9.x86_64                            1/10 
  Verifying        : elfutils-libelf-devel-0.189-3.el9.x86_64              2/10 
  Verifying        : gcc-11.4.1-2.1.el9.alma.x86_64                        3/10 
  Verifying        : gcc-plugin-annobin-11.4.1-2.1.el9.alma.x86_64         4/10 
  Verifying        : glibc-devel-2.34-83.el9_3.7.x86_64                    5/10 
  Verifying        : kernel-devel-5.14.0-362.18.1.el9_3.x86_64             6/10 
  Verifying        : kernel-devel-5.14.0-362.8.1.el9_3.x86_64              7/10 
  Verifying        : kernel-headers-5.14.0-362.18.1.el9_3.x86_64           8/10 
  Verifying        : libxcrypt-devel-4.4.18-3.el9.x86_64                   9/10 
  Verifying        : make-1:4.3-7.el9.x86_64                              10/10 

Installed:
  annobin-12.12-1.el9.x86_64                                                    
  elfutils-libelf-devel-0.189-3.el9.x86_64                                      
  gcc-11.4.1-2.1.el9.alma.x86_64                                                
  gcc-plugin-annobin-11.4.1-2.1.el9.alma.x86_64                                 
  glibc-devel-2.34-83.el9_3.7.x86_64                                            
  kernel-devel-5.14.0-362.8.1.el9_3.x86_64                                      
  kernel-devel-5.14.0-362.18.1.el9_3.x86_64                                     
  kernel-headers-5.14.0-362.18.1.el9_3.x86_64                                   
  libxcrypt-devel-4.4.18-3.el9.x86_64                                           
  make-1:4.3-7.el9.x86_64                                                       

Complete!

gcc 関連のパッケージ名に「.el9.alma.x86_64」が含まれていることに注目:

「GuestAdditions」のバージョンアップ(7.0.12→7.0.14)が実行:

Copy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
Installing Virtualbox Guest Additions 7.0.14 - guest version is 7.0.12
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.14 Guest Additions for Linux  100%  
VirtualBox Guest Additions installer
Removing installed version 7.0.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
5.14.0-362.8.1.el9_3.x86_64.

ビルドに時間がかかります:

VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted or 'rcvboxadd reload' triggered
VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: kernel modules and services 7.0.14 r161095 reloaded
VirtualBox Guest Additions: NOTE: you may still consider to re-login if some 
user session specific services (Shared Clipboard, Drag and Drop, Seamless or 
Guest Screen Resize) were not restarted automatically

再起動が必要というメッセージです:

問題点1:「GuestAdditions」のバージョンアップが完了したようだけど、プロンプトが返ってきません:
問題点2:「仮想マシン」画面は起動途中で停止しています:

マウスで画面をクリックして、中央ボタンでスクロールしたら、真っ暗になりました:

問題点3:「仮想マシン」画面は真っ暗です:

-

問題点4:「マウス統合化」機能が無効なので、右「Ctrl」キーを押下:

-

(2). 再起動が必要だけど、プロンプトが返ってこないので、別の「端末」画面を起動:

確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base   
e93d45b  default virtualbox running  /home/ubn/ダウンロード/vm/almalinux   ←(追加)

-

確認:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant status
Current machine states:

default                   running (virtualbox)

→実行中です。

-

(3). 別の「端末」画面から、コマンドで電源オフ(停止)してみました:
$ cd ~/ダウンロード/vm/almalinux
$ vagrant halt

赤色の警告表示:

An action 'halt' was attempted on the machine 'default',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.

If you believe this message is in error, please check the process
listing for any "ruby" or "vagrant" processes and kill them. Then
try again.

和訳:

アクション「停止」がマシン「デフォルト」で試行されましたが、
別のプロセスがすでにマシン上でアクションを実行しています。
Vagrant は、一度に 1 つのプロセスのみがアクセスできるように
各マシンをロックします。
他の Vagrant プロセスがこのマシンの変更を完了するまで待ってから、
再試行してください。

→コマンドでの「電源オフ」は拒否されました:

-

(4). プロンプトが返ってこない、最初の「端末」画面を右上の「x」で閉じました:

警告「ウィンドウを閉じますか?」画面が表示:

まだプロセスが走っています。
このウィンドウを閉じるとプロセスは終了します。

→「ウィンドウを閉じる」をクリック

-

(5). 残った「端末」画面にて、 「仮想マシン」を電源オフ:
$ cd ~/ダウンロード/vm/almalinux
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→「仮想マシン」画面が閉じました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

5. 「GuestAdditions」の機能を有効にするため、ホストOS を再起動:

-

1). ホストOS を再起動:

「端末」画面以外のウィンドウを閉じてから、

$ reboot

-


2). 登録された「Box」を確認:

$ vagrant box list
Endeav-base3  (virtualbox, 0)
almalinux/9   (virtualbox, 9.3.20231118, (amd64))   ←(追加)
fedora39-0225 (virtualbox, 0)

-


3). 作成された「仮想マシン」を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base   
2d3c9c6  default virtualbox poweroff /home/ubn/ダウンロード/vm/almalinux       

-


4). 「仮想マシン」を立ち上げ:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'almalinux/9' version '9.3.20231118' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!

「GuestAdditions」が実行されていなかったので、起動処理が実行されました:

[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service    ←(vboxadd の実行)
Redirecting to /bin/systemctl start vboxadd-service.service
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
5.14.0-362.8.1.el9_3.x86_64.

時間がかかります:

起動途中だった「仮想マシン」画面が再起動されました:

Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant_data => /home/ubn/ダウンロード/vm/almalinux/data
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→プロンプトが返ってきました:

「GuestAdditions」のバージョンチェックは OK:

「共有フォルダ」(サブフォルダ)がマウントされました:

-

問題点4:「マウス統合化」機能のアイコンはグレー表示で無効です:

→マウスを見失ったら、右「Ctrl」を押します:

-

問題点5:「仮想マシン」画面は起動途中で、「ログイン」画面が表示されません:

-

参考: ちなみに、「GuestAdditions」のバージョンアップ実行時のログを確認:

ssh 接続:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant ssh
[vagrant@localhost ~]$ 

-

ログの確認:

[vagrant@vagrant ~]$ cat /var/log/vboxadd-setup.log
Building the main Guest Additions 7.0.14 module for kernel 5.14.0-362.8.1.el9_3.x86_64.
Building the shared folder support module.
Building the graphics driver module.
Could not find the X.Org or XFree86 Window System, skipping.

→「GuestAdditions」のバージョンアップは正常終了しています:

-

ssh 接続の終了:

[vagrant@localhost ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

-


5). 「仮想マシン」の電源オフ:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→電源オフ時の警告表示はありません。ssh 関連の設定は OK のようです。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

6. 問題点4 の回避: 「マウス統合化」機能の有効化を「Vagrantfile」に反映:

-

仮想マシン」の設定で、ポインティングデバイスを「USB タブレット」に変更する必要があります:

仮想マシン」作成のたびに、「VirtualBox」マネージャで設定を変更しなくても良いように、
「Vagrantfile」に反映させました:

-

参考資料:

VBoxManage modifyvm

-

1). 「ポインティングデバイス」関連の記述を抜粋:

7.8.3. Miscellaneous Settings    ←(その他の設定)

The following hardware settings, such as serial port, audio, clipboard, drag  
and drop, monitor, and USB settings are available through VBoxManage modifyvm:

  --mouse <ps2|usb|usbtablet|usbmultitouch>: Specifies the mode of the mouse to be  
  used in the VM. Available options are: ps2, usb, usbtablet, usbmultitouch. 

-

2). 「VirtualBox」マネージャでの操作:

実際に操作する必要はありません:

-

システム→「マザーボード」タブ

ポインティングデバイス:

PS/2 マウス
USBタブレット                            ←(これを選択)
USBマルチタッチタブレット
USBマルチタッチスクリーンとタッチパッド

3). 選択するパラメータの対応?

ps2
usb
usbtablet
usbmultitouch

→英語の原本を見ると対応が異なるので、「VirtualBox」マネージャの日本語翻訳にミスがある可能性があるので、

「usb」を試してみたら、「VirtualBox」マネージャが「USBマウス」に設定されました:

選択肢にない「USBマウス」が急に現れて設定されたので驚きました:

→翻訳される場所が違うようです

-

翻訳は合っているようなので、以下の対応になりそう:

ps2             →PS/2 マウス
usb             →USBマウス
usbtablet       →USBタブレット
usbmultitouch   →USBマルチタッチスクリーンとタッチパッド

→今まで「USBタブレット」に設定するのは変だ、と思いながら設定していたけど、 それはそれで、合っている(不具合?)みたい:

-

4). 「Vagrantfile」での記述:

 #vb.customize ["modifyvm", :id, "--mouse", "usb"]
 #vb.customize ["modifyvm", :id, "--mouse", "usbtablet"]  ←こちらが正しいみたい

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

6-2. 問題点5 の回避:「仮想マシン」画面は起動途中で、ログイン画面が表示されません:

-

こちらの回避策で下記の問題が解決しました:

問題点1:「GuestAdditions」のバージョンアップが完了したようだけど、プロンプトが返ってきません:
問題点2:「仮想マシン」画面は起動途中で停止しています:
問題点3:「仮想マシン」画面は真っ暗です:

→問題点2で、マウスで画面をクリックして、中央ボタンでスクロールしたら、真っ暗になりました:

問題点5:「仮想マシン」画面は起動途中で、「ログイン」画面が表示されません:

-

仮想マシン」のビデオメモリが小さな値だったのが原因みたい:

→「GUI 表示」を行う設定にしていたので、表面化した問題のようです:
ssh 接続」のみで使うなら、たぶん修正は要りません:

-

今回はその後、デスクトップ環境もインストールするつもりなので、「128」MB に設定:

仮想マシン」作成のたびに、「VirtualBox」マネージャで設定を変更しなくても良いように、
「Vagrantfile」に反映させました:

-

1). 「Vagrantfile」での記述:

    vb.customize ["modifyvm", :id, "--vram", "128"]

-

すでに「Vagrantfile」を作成していたら、nano であれば、

Ctrl+K を押し放しにすれば、すべて削除できます。

一部修正するより、Ctrl+C 後、マウスの中央ボタンで「すべて貼り付ける」のが楽です。

-


2). 「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/almalinux/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "almalinux/9"
  #config.vm.box_version = "9.3.20231118"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  # ホストの作業フォルダ内の data フォルダと
  # 仮想マシン内の /vagrant_data フォルダを共有:
  # 指定のフォルダがない場合は、フォルダを作成:
  config.vm.synced_folder "./data", "/vagrant_data", create: true
  # デフォルトの共有フォルダを無効にします:
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.provider "virtualbox" do |vb|
    # 仮想マシンの起動時に VirtualBox GUI を表示:
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    vb.customize ["modifyvm", :id, "--mouse", "usbtablet"] 
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
    vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
    vb.customize ["modifyvm", :id, "--vram", "128"]
  end
end

説明:

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7〜8行目で、リトライのタイムアウト値を短く調整: ←(ssh 認証時のループ回避)
9〜12行目で、共有フォルダ「/vagrant_data」を設定: ★
13〜14行目で、デフォルトの共有フォルダ「/vagrant」を無効化: ★
17行目で、GUI 表示を有効に設定:
18〜19行目で、メモリ「2048」MB に変更:
20行目で、プロセッサ「2」個 に変更:
21行目で、ポインティングデバイスを「USBタブレット」に変更: ★
22〜23行目で、ディスプレイを 「vmsvga」に変更:
24行目で、デスクトップ表示に備え「3D」オンに変更: ←(追記)
25行目で、ビデオメモリを「128」MB に変更:  ★

-

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:「config.vm.box = "almalinux/9"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

6行目は、使用する「Box」のバージョンを指定します。最新バージョンにするときは、行頭に「#」を付けてコメント行にするか、行を削除します:

-

仮想マシン」をすでに作成していた場合は、修正を反映させるため、後で「vagrant reload」が必要です:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

6-3. 「仮想マシン」に「Vagrantfile」の修正を反映:

-

1). 「仮想マシン」の立ち上げ(Vagrantfile の修正を反映):

$ cd ~/ダウンロード/vm/almalinux
$ vagrant reload
==> default: Checking if box 'almalinux/9' version '9.3.20231118' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions 7.0.14 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant_data => /home/ubn/ダウンロード/vm/almalinux/data
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→プロンプトが返ってきました:

「GuestAdditions」のバージョンチェックは OK:

「共有フォルダ」がマウントされました:

-

問題点4 の解消:「マウス統合化」機能のアイコンが表示され、有効になりました:

-

問題点5 の解消:「仮想マシン」の立ち上げで、ログイン画面が表示されました:
AlmaLinux 9.3 (Shamrock Pampas Cat)
Kernel 5.14.0-362.8.1.el9_3.x86_64 on an x86_64

vagrant login:

-

2). 「仮想マシン」の状態の確認:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

→「仮想マシン」が実行中です:

-

ssh-config」の確認:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/ダウンロード/vm/almalinux/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

ssh 認証キーの行はひとつだけです:

認証キーは、「作業フォルダ」配下に置かれています:

-


3). 「ssh 接続」してみました:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant ssh
Last login: Tue Mar  5 23:03:55 2024 from 10.0.2.2
[vagrant@localhost ~]$ 

→パスワードなしでログインできました:

-

ここで、プロンプトの表示が「vagrant@vagrant」ではありません:

[vagrant@localhost ~]$ uname -n
localhost.localdomain
問題点6: ホスト名が「localhost」です:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

7. 問題点6 の回避: 「ホスト名」をいつもの「vagrant」に変更したい場合:

-

ユーザ名は「vagrant」ですが、「ホスト名」は設定されておらず「localhost」です。

localhost」のままでも、他のホスト名に変更しても、いつもの「vagrant」に変更しても良いです。
この辺りは好みです。

-

ホスト名(コンピュータ名)を他の「Box」と同じ「vagrant」に変更:

-


1). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant up

-


2). 「仮想マシン」に「ssh で接続」:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant ssh
[vagrant@localhost ~]$ 

-


3). 現在の「ホスト名」(コンピュータ)を確認:

[vagrant@localhost ~]$ uname -n
localhost.localdomain

もしくは、

[vagrant@localhost ~]$ sudo hostname
localhost.localdomain

もしくは、

[vagrant@localhost ~]$ sudo hostnamectl
   Static hostname: (unset)                             
Transient hostname: localhost
         Icon name: computer-vm
           Chassis: vm 🖴
        Machine ID: cf3c5420a41c40e1bab79dbb4fcedb6e
           Boot ID: b1a4e7cb2ed744978244efdff9480c8b
    Virtualization: oracle
  Operating System: AlmaLinux 9.3 (Shamrock Pampas Cat) 
       CPE OS Name: cpe:/o:almalinux:almalinux:9::baseos
            Kernel: Linux 5.14.0-362.8.1.el9_3.x86_64
      Architecture: x86-64
   Hardware Vendor: innotek GmbH
    Hardware Model: VirtualBox
  Firmware Version: VirtualBox

-


4). 恒久的に「ホスト名」を変更:

[vagrant@localhost ~]$ sudo hostnamectl set-hostname vagrant
[vagrant@localhost ~]$ 

→すぐには反映されません

-


5). 「仮想マシン」を再起動:

確実な操作は「項番 10).」を参照:

-

下記の操作はオススメしない操作です:

なので、作業は要りません:

[vagrant@localhost ~]$ sudo reboot
Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→すぐにプロンプトが返って来ました。

-

仮想マシン」は電源オフしている最中に、表示が止まっています:

「共有フォルダ」のアンマウントまでは行きました:

:
            Unmounting /vagrant_data...
[  OK  ] Unmounted /vagrant_data.
[  OK  ] Stopped vboxadd.service

-

参考: 「fedora39」の場合の表示:

[vagrant@fedora39 ~]$ sudo reboot
Broadcast message from root@fedora39.localdomain on pts/1 (Sun 2024-02-18 14:14:12 UTC):

The system will reboot now!

[vagrant@fedora39 ~]$ Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

6). なので、「仮想マシン」は再起動されていません:

-

確認:

-

$ vagrant status
Current machine states:

default                   running (virtualbox)

-

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base   
e93d45b  default virtualbox running  /home/ubn/ダウンロード/vm/almalinux          
:

-

7). 「仮想マシン」を電源オフ:

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: Guest communication could not be established! This is usually because
    default: SSH is not running, the authentication information was changed,
    default: or some other networking issue. Vagrant will force halt, if
    default: capable.
==> default: Forcing shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→電源オフ時に、ssh 関連に問題があるときの表示です:

「sudo reboot」で電源オフ途中だったので、sshd が停止したからと思われます:

-


8). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant up

仮想マシン」がログイン画面になりました:

-


9). 「仮想マシン」に「ssh で接続」:

$ cd ~/ダウンロード/vm/almalinux
$ vagrant ssh
Last login: Tue Mar  5 16:05:02 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 
問題点6 の解消: プロンプトがいつもの表示に変わりました:

-

-


10). 参考: 「ssh 接続」での「sudo reboot」での再起動は、不安定なのでやめた方が良さそう:

-

仮想マシン」を再起動したいときは、

-

(1). ssh 接続を終了:
[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

-

(2). 電源オフ:
$ vagrant halt
==> default: Attempting graceful shutdown of VM...

1〜2分ほど時間がかかります:

サーバー使用なので、わざと長くしているのかな?

==> default: Forcing shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/almalinux$ 

→「仮想マシン」画面が閉じました:

-

(3). 「仮想マシン」の立ち上げ:
$ vagrant up

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----

8. 今回の作業で気づいたこと:

-

今回は、「デスクトップ」環境を追加することを考え、「Vagrantfile」で「GUI 表示をする」設定にしていたせいか、 いくつかの問題が表面化しました:

-

ポイントは、「Box」の「仮想マシン」イメージが、最小限の設定(ssh 接続が前提)だったということ:

ssh 接続」のみで使っていれば、たぶん、支障なく使えたと思います。

-

具体的には、「ビデオメモリー」が最小で、「ポインティングデバイス」(マウス)がデフォルトの設定でした:
どちらも GUI 操作で使うなら、設定を変更するのですが、今のところはコンソール画面だけなので、触りませんでした。

まさか、「ビデオメモリー」が少ないと、(文字だけの)コンソール画面で「ログイン」画面が表示されなかったり、画面真っ暗になるとは思っていませんでした。

-

ベースとなる「Box」は、色々な使い方をされるので、最小限の設定が多いです。

今回のような現象は経験していないと、気付かずに迷ってしまい、手間取る可能性が高いかも。

-

-


まとめ

今回は、最新にした「VirtualBox 7.0.14」と「Vagrant 2.4.1」の環境で、公式「Box」に登録された「almalinux/9」をインストールしました。

前回、「vagrant-vbguest」プラグインをインストールしており、おかげで「GuestAdditions」のインストールの手間が省けました。

-

「almalinux/9」の「Box」は、ssh 関連の設定とか、ちゃんと設定されていました。さすがです。

ホスト名は「localhost」でしたが、許容範囲というか、ベースに使う場合は「vagrant」よりもこちらの「localhost」の方が良さそう。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

Vagrant 実践編8: 公式「Box」にある「generic/fedora39」をインストール〈H170-11〉

登録日: 2024-03-04 更新日: 2024-03-14

Xubuntu 22.04.4 LTS」、および「Windows11」(22H2) の「VirtualBox 7.0.14」にて、「Vagrant」(ベイグラント) という仮想マシンの管理ツールを使えるようにしました。

-

(実践編8):

今回は、その環境で、公式「Box」にある「generic/fedora39」を「バージョン指定」でインストールしました。

いつものやり方だと最新のイメージのインストールですが、 以前のバージョンを使いたいとか、ダウンロード サイズを抑えたいとか、あるかもしれません。

それに合わせて、登録した「Box」の更新を行う「vagrant box update」コマンドも使ってみました。

-

また、自動で「Guest Additions」の更新やインストールをしてくれる、Vagrant の「プラグイン」があったので(ホストOS 側に)追加しました。自動でチェックして実行されるので確実だし、楽ができます。

VirtualBox」で使うなら、最初からインストールしておくべき「プラグイン」だと思います。

-

その備忘録です。

-

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

今回の作業:

  1.  目的の「Box」を検索:

  2. 「作業フォルダ」を作成:

  3.  バージョンを指定して、「Vagrantfile」を作成:

  4. 「仮想マシン」の(初回の作成と)立ち上げ:

  5. 「vagrant box update」で「Box」を更新:

  6. 「Vagrantfile」を修正:

  7. 「仮想マシン」の再作成:

  8. 「ホスト名」を「vagrant」に変更したい場合:

  9.  作業中の「仮想マシン」で、「Box」を作成:

  10.  最終的な設定を終えた「仮想マシン」で、「Box」を作成:

  11.  最終的な「Box」の、「Vagrantfile」の修正:

  12. 「今回の作業で気づいたこと:

-

Vagrant」での参考:

  1. 「Vagrant」コマンドについて:

  2. 「Vagrant」コマンドの使用例:

  3. 「Vagrant」コマンドの使用例:(目次)

  4.  修正版3: 使い回し可能な「Vagrantfile」:

  5. 「vagrant box update」で「Box」を更新する場合:

  6. 「vagrant box update」のヘルプを表示:

  7. 「vagrant vbguest」のヘルプを表示:

  8. 「vagrant box remove」のヘルプを表示:

  9.  Vagrant に「vagrant-vbguest」プラグインをインストールする場合:

  10.  もし、PC のディスクに余裕がない場合:

  11. 「ssh 接続」で使うテキストエディタ「nano」:

  12. 「ssh 接続」で、日本語表示にするには:

 →事前に「デスクトップの日本語化」が必要です

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

Vagrant で「Fedora39」の「仮想マシン」を立ち上げ:

-

1). 公式「Box」の「generic/fedora39」を「vagrant up」で立ち上げ:

事前に「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/fedora39
$ vagrant up

-

GUI のデスクトップは組み込まれていないので、コンソール画面が表示されました:

→「コンソール画面」だと切り貼りができないので、「ssh 接続」での操作が便利です:

-

ちなみに、画面右側のグレーの領域が、VirtualBox の通知領域です:

右上もしくは右下の「オレンジ色」のアイコンをクリックすると消去できます:

-

(1). ログインのプロンプトに注目:
Fedora39  login:

→ホスト名が、デフォルトの「Vagrant」ではありません:

-

(2). 画面下のステータスバーに注目:

→「マウス統合化」機能のアイコンがグレーで無効です:

マウスを見失うので、その都度、右「Ctrl」キーが必要です。

-

(3). 「共有フォルダ」機能は無効です:

仮想マシン」の画面の、「Devices」→「Shared Folders」→「Shared Folders Settings...」で確認:

→「共有フォルダ」は、定義されていません

-


2). 上記を使い勝手が良いようにカスタマイズ:

通常は「ssh 接続」で使うので、カスタマイズしなくても支障ありません:

-

(1). カスタマイズ中の「仮想マシン」の一覧:
$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
408fb2f  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39  ←(generic/fedora39)
a5fdb3e  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-test  ←(カスタマイズ中)
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base  ←(カスタマイズ後)

画面下のスクロールバーを移動して右側のコメントを確認して下さい:

-

(2). カスタマイズ中の「Box」の一覧:
$ vagrant box list
fedora39-0224 (virtualbox, 0)  ←(カスタマイズ中)
fedora39-0225 (virtualbox, 0)  ←(カスタマイズ後)

→カスタマイズの途中で「Box」を作成して、やり直しが楽にできるようにしました:

また、ディスク容量が足りなくなるので、不要な「Box」は削除:

-

3). カスタマイズ後の「fedora39-0225」を「vagrant up」で立ち上げ:

事前に「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/fedora39-base
$ vagrant up

-

左側のウィンドウが、ホストOS の「端末」(xfce4-terminal) 画面で、

右側のウィンドウが、「仮想マシン」の(Fedora39)の画面(自動起動)です:

-

(1). ログインのプロンプトに注目:
Vagrant  login:

→ホスト名が「Vagrant」に変わりました:

-

(2). 画面下のステータスバーに注目:

→「マウス統合化」機能が有効です:

-

(3). 「共有フォルダ」機能を有効にできたので、「作業フォルダ」配下の「data」フォルダを共有に設定:

仮想マシン」の画面の、「Devices」→「Shared Folders」→「Shared Folders Settings...」で確認:

→こちらは「Vagrantfile」にて設定しています:

-


4). その後すぐに、ジャーナル関連のメッセージが表示され、上書きされました:

-

注目すると:

→上書きされて見づらいですが、Enter を押せばプロンプトに戻ります。

-

通常は「ssh 接続」で使うのでこちらの画面が乱れても支障ありません:

解消のしかたは今のところわかりません:

-


5). 「vagrant ssh」で ssh 接続して、ホストOS の「端末」で操作:

「端末」画面にて、コマンドやメッセージの切り貼りができるので、「クリップボードの共有」機能が使えなくても便利です:

-


6). ログアウト後、「vagrant halt」で、電源オフ中:

-


7). 電源オフされました:

Vagrant では、VirtualBox の「VirtualBox マネージャ」は起動されず、
仮想マシン」の画面のみが起動したり、閉じたりします:

つまり、「VirtualBox マネージャ」をマウスで操作する代わりに、Vagrant コマンドがあるわけです。

操作を代行しているだけなので、「VirtualBox マネージャ」で(補助的に設定などを)操作することもできます。

-

-


現在のバージョンを表示:

-

ホストOS : 「Xubuntu 22.04.4 LTS」

2024-03-04 現在

カーネル:

$ uname -r
5.15.0-97-generic

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

→ついに「22.04.4」に上がりました。

安定しているので、次のLTS が落ち着いた Ubuntu 24.04.1 LTS(noble)になる頃(1年後)までは使いたいところ。

-

Vagrant」のバージョン:

$ vagrant --version
Vagrant 2.4.1

-

-

ゲストOS : 「Fedora 39」

2024-03-04 現在

カーネル:

$ uname -r
6.7.5-200.fc39.x86_64

リリース:

$ cat /etc/fedora-release
Fedora release 39 (Thirty Nine)
$ cat /etc/redhat-release
Fedora release 39 (Thirty Nine)
$ cat /etc/os-release
:
NAME="Fedora Linux"
VERSION="39 (Thirty Nine)"
ID=fedora
VERSION_ID=39
VERSION_CODENAME=""
PLATFORM_ID="platform:f39"
PRETTY_NAME="Fedora Linux 39 (Thirty Nine)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:39"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=39
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=39
SUPPORT_END=2024-11-12

→「サポート終了日付」が表示されています:

Fedora は約 6ヶ月ごとに新しいバージョンがリリース、リリース後 1年ちょっとでサポートが切れるスパンです。
サポート期間が短いけど、LTS 版ではない Ubuntu も似たようなものです。

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

参考: RHEL クローンのサポート期間:

RHEL クローン(100% 互換?)の「AlmaLinux 9.3」(+ EPEL リポジトリ)であれば、2032年(リリースから10年)までサポートされます。ただし、RHELRHEL クローンは(サーバー向けなので)Fedora に比べて安定度は増しても、リポジトリの使用に制限があるので面倒です。デスクトップで使うときは使い勝手が落ちます。

ちなみに、Vagrant の公式「Box」には、公式に「AlmaLinux 9.3」が「almalinux/9」として登録されており、安心して使え便利です。

一方の「Rocky Linux 9」は、公式の登録ではなく、個人での登録の「boxomatic/rocky-9」などを使うことになります。セキュリティ面では不利ですが、実機で使う前の確認であれば関係ありませんし、自分で「Box」を作成してもOK。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

VirtualBox」について:

-

VirtualBox」は、Oracle が開発している「仮想マシン」を構築するためのソフトウェアです。

-

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

Vagrant」 (ベイグラント) について:

-

公式サイト:

Vagrant by HashiCorp

-

仮想マシン」の管理や操作をコマンドで行うことで、作業効率を上げてくれる「フロントエンド」のソフトウェアです:

-

→詳細は、以前に投稿した「こちら 」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

Fedora」について:

-

公式サイト:

Fedora へようこそ

Fedora」(フェドラ)は、Redhat 社が支援するコミュニティによって開発されている Linux ディストリビューションです。最新の技術を積極的に取り込む「先進性」が特徴です。以前の「CentOS」とは開発の流れが変わって、現在は、Fedora で採用された最新の技術の一部が「CentOS Stream」 で更に試された後に、Redhat 社の商用 LinuxRHEL (Red Hat Enterprise Linux) に反映されています。

-

Fedora には、サーバ向けの「Fedora Server」と、デスクトップPC 向けの「Fedora Workstation」があります:

  • 「Server」版は、詳細なインストール設定が行えます。デスクトップ環境はインストールされず、再起動後の設定はコンソール画面(または、ssh 接続)でコマンドで行います。

  • 「Workstation」版は、デフォルトで「GNOME」(発音: グノーム ?)デスクトップ環境(他の環境も提供あり)がインストールされます。再起動で「セットアップ」が起動されるので、「ユーザ設定」を行い、インストールが完了します。

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

インストールの参考になりそう?な投稿:

Fedora 34 GNOME をUSB メモリにインストール〈H130〉

-

投稿当時の Fedora 33 GNOMEカーネル 5.8)は、個人で持っている古いPC だと、搭載された(インテル)CPU に内蔵の「ハードウェアアクセラレータ」が未サポートで、「GNOME」デスクトップが表示(描画)しきれず使えませんでした。

ちなみに、「GNOME」デスクトップや「VSCode」アプリは重いので「ハードウェアアクセラレータ」が前提なのでもろに影響が出ました。こちらの投稿は、それが解消された辺りの Fedora 34 GNOMEカーネル 5.11)の頃なので、記事中の「ハードウェアアクセラレータ」辺りの記述は無視できます。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

1. 公式の「Box」にて、目的の「Box」を検索:

-

公式の「Box」の検索サイト:

Discover Vagrant Boxes

-

「検索キー」の入れ方で、微妙に、表示される「Box」が変わります:

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

「fedora39」で検索:

-

generic/fedora39」サイトの記述:

クロスプラットフォーム開発で使用するためのビルド環境みたい:

-

(1). New: タブ
vagrant init generic/fedora39
vagrant up

→作業フォルダで上記のコマンドを実行すると、仮想マシンが作成されます

-

(2). Vagrantfile: タブ
Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora39"
end

→上記の「Vagrantfile」を作業フォルダに作成して「vagrant up」すると、仮想マシンが作成されます

-

(3). 下記をクリックすると「.box」ファイルがダウンロードされますが、今回は直接のダウンロードは要りません:

-

virtualbox v4.3.12

Vagrant Cloud (707 MB) に登録

最新、1ヶ月前の登録:

-

virtualbox v4.3.10

Vagrant Cloud (605 MB) に登録

2ヶ月前の登録:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

2. 「作業フォルダ」の作成:

-

作業フォルダに移動してコマンドを実行すると、コマンドで「仮想マシン名」や「id」番号を省略できます:

-

作業フォルダ名は分かりやすい名前にしました:

$ mkdir -p ~/ダウンロード/vm/fedora39/

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

3. バージョンを指定して、「Vagrantfile」を作成:

-

バージョンを指定を省略すると、最新のバージョンが選ばれます:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

3-a. 「vagrant init」コマンドで「Box」のバージョンを指定して、自動で「Vagrantfile」を作成する場合:

-

最小限の設定:

→「仮想マシン」作成後に修正が必要かも:

-


1). コマンドで「Box」のバージョンを指定して、自動で「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant init -m generic/fedora39 --box-version 4.3.10
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

→決まり文句のメッセージが表示:

-

「-m」は作成される「Vagrantfile」ファイルのコメント行を削除します

→「Vagrantfile」ファイルの使い方を知りたい場合は、「-m」は付けない方がわかりやすいかも

-


2). 確認:

$ cd ~/ダウンロード/vm/fedora39/
$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora39"
  config.vm.box_version = "4.3.10"
end

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

3-b. 「Vagrantfile」を作成して、「Box」のバージョンを指定する場合:

-

最小限の設定:

→「仮想マシン」作成後に修正が必要かも:

-


「Box」のバージョンを指定した「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/fedora39/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora39"
  config.vm.box_version = "4.3.10"
end

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

3-c. 「Vagrantfile」を手動で作成して、「Box」のバージョンを指定する場合:

-

個人的にオススメの設定:

→「仮想マシン」作成後に発生した問題に対応:

-


「Box」のバージョンを指定した「Vagrantfile」を作成:

$ cd ~/ダウンロード/vm/fedora39/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora39"
  config.vm.box_version = "4.3.10"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7、8行目で、リトライのタイムアウト値を短く変更: ←(問題点1 の取りあえずの回避)
12、13行目で、メモリ「2048」MB に変更:
15、16行目で、ディスプレイを 「vmsvga」に変更:

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:

最終的な「Vagrantfile」は「こちら」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

4. 「仮想マシン」の(初回の作成と)立ち上げ:

-

1). 現時点で登録されている「Box」を確認:

$ vagrant box list
Endeav-base3 (virtualbox, 0)

-

$ vagrant global-status
id       name   provider state  directory                           
--------------------------------------------------------------------
There are no active Vagrant environments on this computer! Or,
you haven't destroyed and recreated Vagrant environments that were
started with an older version of Vagrant.

-


2). 「仮想マシン」の(初回の作成と)立ち上げ:

「Vagrantfile」が置かれた「作業フォルダ」に移動して、実行:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'generic/fedora39' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: 4.3.10           ←(バージョンに注目)
==> default: Loading metadata for box 'generic/fedora39'
    default: URL: https://vagrantcloud.com/api/v2/vagrant/generic/fedora39
==> default: Adding box 'generic/fedora39' (v4.3.10) for provider: virtualbox (amd64)
    default: Downloading: https://vagrantcloud.com/generic/boxes/fedora39/versions/4.3.10/providers/virtualbox/amd64/vagrant.box
Progress: 7% (Rate: 9629k/s, Estimated time remaining: 0:01:30)

→初回のみ、カウントアップ:

    default: Calculating and comparing box checksum...
==> default: Successfully added box 'generic/fedora39' (v4.3.10) for 'virtualbox (amd64)'!
==> default: Importing base box 'generic/fedora39'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'generic/fedora39' version '4.3.10' is up to date...
==> default: Setting the name of the VM: fedora39_default_1708251431977_35141
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

認証失敗のリトライがループ:
→回避策でタイムアウトを設定したので、強制停止で、赤色の警告表示:

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

→回避策として、Vagrantfile の 7行目でタイムアウトを短く設定しているので、ループせずに、プロンプトに戻りました

-

→問題点1: 「仮想マシン」の立ち上げ時に ssh 関連のリトライ。その後警告が表示されます

-


3). 「vagrant ssh-config」を確認:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/.vagrant.d/insecure_private_keys/vagrant.key.ed25519
  IdentityFile /home/ubn/.vagrant.d/insecure_private_keys/vagrant.key.rsa
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

ssh 認証キーの設定が 2行あります

-


4). 「仮想マシン」に ssh で接続:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
vagrant@127.0.0.1's password: 

→パスワードに「vagrant」を入力

Last login: Sun Feb 18 10:25:32 2024
[vagrant@fedora39 ~]$ 

→問題点2: ゲストOS 側のプロンプトが表示されましたが、いつもとプロンプト表示が違います:

-


5). 「仮想マシン」の状態を確認:

[vagrant@fedora39 ~]$ uname -a
Linux fedora39.localdomain 6.5.6-300.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct  6 19:57:21 UTC 2023 x86_64 GNU/Linux

-

[vagrant@fedora39 ~]$ uname -r
6.5.6-300.fc39.x86_64

-

[vagrant@fedora39 ~]$ uname -n
fedora39.localdomain

→ユーザ名は「vagrant」ですが、ホスト名が「vagrant」ではありません。

これは好み

-


6). 「ssh 接続」を抜けました:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-


7). 「仮想マシン」を確認:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

-

$ vagrant global-status
id       name    provider   state   directory                           
------------------------------------------------------------------------
66cc5fa  default virtualbox running /home/ubn/ダウンロード/vm/fedora39        
:

-


8). 電源オフ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: Guest communication could not be established! This is usually because
    default: SSH is not running, the authentication information was changed,
    default: or some other networking issue. Vagrant will force halt, if
    default: capable.
==> default: Forcing shutdown of VM...
→問題点3: 「仮想マシン」の電源オフ時に ssh 関連の警告が表示されました

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

5. 「vagrant box update」で「Box」を更新:

-

vagrant box update」コマンドの動作を確認しました:

-


1). 「vagrant box update」のヘルプを表示:

$ vagrant box update --help

和訳:

使い方: vagrant box update [オプション]

利用可能な更新がある場合、現在の Vagrant 環境で使用されているボックスを更新します。
これによりマシンが削除/再作成されるわけではないため、変更を確認するには
それを行う必要があります。

 (Vagrant 環境に関連付けられていない) 特定のボックスを更新するには、「--box」フラグを使用します。


オプション:

        --box BOX                    特定の box を更新
        --architecture ARCHITECTURE  特定のアーキテクチャの box を更新
        --provider PROVIDER          特定のプロバイダの box を更新
    -f, --force                      既存のボックスが存在する場合は上書きします
        --insecure                   SSL証明書を検証しません
        --cacert FILE                SSLダウンロード用のCA証明書
        --capath DIR                 SSLダウンロード用のCA証明書ディレクトリ
        --cert FILE                  クライアント SSL 証明書 (必要な場合)
        --[no-]color                 カラー表示を有効または無効にします
        --machine-readable           Enable machine readable output
    -v, --version                    Display Vagrant version
        --debug                      Enable debug output
        --timestamp                  Enable timestamps on log output
        --debug-timestamp            Enable debug output with timestamps
        --no-tty                     Enable non-interactive output
    -h, --help                       このヘルプを表示

-


2). 現在、登録されている「Box」を確認:

$ vagrant box list
Endeav-base3     (virtualbox, 0)
generic/fedora39 (virtualbox, 4.3.10, (amd64))   ←(バージョンに注目)

-

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant status
Current machine states:

default                   poweroff (virtualbox)

The VM is powered off. To restart the VM, simply run `vagrant up`

-

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
ea0a002  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39        

-


3). 「Box」の更新1:

$ cd
$ vagrant box update
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

和訳:

このコマンドを実行するには、Vagrant 環境またはターゲット マシンが必要です。
「vagrant init」を実行して、新しい Vagrant 環境を作成します。
または、このコマンドを実行するターゲット マシンの ID を「vagrant global-status」から取得します。
最後のオプションは、Vagrantfile のあるディレクトリに変更して再試行することです。

→「仮想マシン」の ID を指定するか、「作業フォルダ」に移動して実行する必要があります。

-


4). 「Box」の更新2:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant box update
==> default: Checking for updates to 'generic/fedora39'
    default: Latest installed version: 4.3.10
    default: Version constraints: 4.3.10
    default: Provider: virtualbox
    default: Architecture: "amd64"
==> default: Box 'generic/fedora39' (v4.3.10) is running the latest version.

→このやり方だと、Vagrantfile にあるバージョン指定行が、最新のバージョンとして認識されて、更新は実行されませんでした。

-


5). 「Box」の更新3:

Vagrantfile に以前のバージョン指定行がある場合、最新に実行されないと思っていたら、

バージョン指定なしで「Box」指定したら、最新バージョンで実行されました:

$ cd
$ vagrant box update --box "generic/fedora39"
Checking for updates to 'generic/fedora39'
Latest installed version: 4.3.10
Version constraints: > 4.3.10
Provider: virtualbox
Architecture: "amd64"
Updating 'generic/fedora39' with provider 'virtualbox' from version
'4.3.10' to '4.3.12'...
Loading metadata for box 'https://vagrantcloud.com/api/v2/vagrant/generic/fedora39'
Adding box 'generic/fedora39' (v4.3.12) for provider: virtualbox (amd64)
Downloading: https://vagrantcloud.com/generic/boxes/fedora39/versions/4.3.12/providers/virtualbox/amd64/vagrant.box
Progress: 56% (Rate: 9.7M/s, Estimated time remaining: 0:00:38)

カウントアップ:

Calculating and comparing box checksum...
Successfully added box 'generic/fedora39' (v4.3.12) for 'virtualbox (amd64)'!
ubn@ubn-box:~$ 

→完了

-


6). 登録されている「Box」を確認:

$ vagrant box list
Endeav-base3     (virtualbox, 0)
generic/fedora39 (virtualbox, 4.3.10, (amd64))
generic/fedora39 (virtualbox, 4.3.12, (amd64))   ←(追加されました)

→「更新」(入替え)されず、ホームへの「追加」になりました:

これは「Box」の登録についてのコマンドであって、「仮想マシン」の作成で使われるバージョンは、「Vagrantfile」のバージョン指定行で指定されている(指定がない場合は最新の)バージョンになります。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

6. ホームにバージョンがアップした「Box」が追加されたので、「Vagrantfile」を修正して使えるように対応:

-

やり方は、

「Vagrantfile」にて、バージョンの指定行を最新バージョンに修正:

もしくは、

「Vagrantfile」にて、バージョンの指定行を削除:

-


「Vagrantfile」の修正:

$ cd ~/ダウンロード/vm/fedora39/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/fedora39"
  config.vm.box_version = "4.3.12"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7、8行目で、リトライのタイムアウト値を短く変更: ←(問題点1 の取りあえずの回避)
12、13行目で、メモリ「2048」MB に変更:
15、16行目で、ディスプレイを 「vmsvga」に変更:

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----

7. 「Box」のバージョンアップに伴う、「仮想マシン」の再作成:

-

「Vagrantfile」を修正して「vagrant up」すると、既存の「仮想マシン」とは別の「仮想マシン」が追加されます。ディスクの空きが減るので、「Vagrantfile」を修正して「仮想マシン」に反映させたいときは、

vagrant destroy」して「vagrant up」するか、「vagrant reload」を使います:

-

仮想マシン」を初期化したいときは、「vagrant destroy」して「vagrant up」するやり方が良さそう。

また、再起動したい場合は、「sudo reboot」するのが楽です。

-


1). 「仮想マシン」を削除してから、再作成:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

-

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'generic/fedora39'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'generic/fedora39' version '4.3.12' is up to date...  ←(バージョンに注目)
==> default: Setting the name of the VM: fedora39_default_1708264072018_31208
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
→問題点1: ssh 認証失敗でリトライしてループ。端末にプロンプト返らず:
取りあえずの、問題点1 の回避:

短いタイムアウト値を設定したことで端末が強制停止され、

赤色の警告表示:

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 
→赤色の警告表示はありますがループが解除され、プロンプトに戻りました:

-

→問題点2: 「仮想マシン」の立ち上げ時に、ssh 認証のリトライの回避策で警告表示して、ループ解除:

バージョンが変わっても、改善されていません

-


2). 「仮想マシン」に ssh で接続:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
vagrant@127.0.0.1's password: 

→パスワードに「vagrant」を入力

Last login: Sun Feb 18 13:56:27 2024 from 10.0.2.2
[vagrant@fedora39 ~]$ 

→ゲストOS 側のプロンプトが表示されましたが、「ホスト名」がいつもの「vagrant」と違います:

-


3). 「仮想マシン」の状態を確認:

[vagrant@fedora39 ~]$ uname -r
6.5.6-300.fc39.x86_64

-

[vagrant@fedora39 ~]$ uname -n
fedora39.localdomain
→問題点4: ユーザ名は「vagrant」ですが、「ホスト名」がいつもの「vagrant」と違います:

-


4). 「ssh 接続」を抜けました:

[vagrant@fedora39 ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-


5). 電源オフ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: Guest communication could not be established! This is usually because
    default: SSH is not running, the authentication information was changed,
    default: or some other networking issue. Vagrant will force halt, if
    default: capable.
==> default: Forcing shutdown of VM...
→問題点3: 「仮想マシン」の電源オフ時に、ssh 関連の警告が表示されます:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -----

8. 問題点4 の回避: 「ホスト名」をいつもの「vagrant」に変更したい場合:

-

こちらの「Box」は、

問題点4: ユーザ名は「vagrant」ですが、「ホスト名」がいつもの「vagrant」と違います:

「Box」の作成者がわかりやすいようにしたと思われます。 このままでも良いし、統一しても良いかな。好みです。

-

ホスト名(コンピュータ名)を他の「Box」と同じ「vagrant」に変更:

他のホスト名に変更してもかまいません:

-


1). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up

-


2). 「仮想マシン」に「ssh で接続」:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
vagrant@127.0.0.1's password:
Last login: Sun Feb 18 14:10:13 2024 from 10.0.2.2
[vagrant@fedora39 ~]$ 

-


3. 現在の「ホスト名」(コンピュータ)を確認:

[vagrant@fedora39 ~]$ uname -n
fedora39.localdomain

もしくは、

[vagrant@fedora39 ~]$ sudo hostname
fedora39.localdomain

もしくは、

[vagrant@fedora39 ~]$ sudo hostnamectl
     Static hostname: fedora39.localdomain
           Icon name: computer-vm
             Chassis: vm 🖴
          Machine ID: 04aeabe8a6dc482eaa2fc9401893da6f
             Boot ID: a953c1f79fa64ad585269c387321fc9a
      Virtualization: oracle
    Operating System: Fedora Linux 39 (Thirty Nine)   
         CPE OS Name: cpe:/o:fedoraproject:fedora:39
      OS Support End: Tue 2024-05-14
OS Support Remaining: 2month 3w 3d
              Kernel: Linux 6.5.6-300.fc39.x86_64
        Architecture: x86-64
     Hardware Vendor: innotek GmbH
      Hardware Model: VirtualBox
    Firmware Version: VirtualBox
       Firmware Date: Fri 2006-12-01
        Firmware Age: 17y 2month 2w 4d         

-


4). 恒久的な「ホスト名」の変更:

[vagrant@fedora39 ~]$ sudo hostnamectl set-hostname vagrant
[vagrant@fedora39 ~]$

→すぐには反映されません

-

5). 「仮想マシン」を再起動:

[vagrant@fedora39 ~]$ sudo reboot
Broadcast message from root@fedora39.localdomain on pts/1 (Sun 2024-02-18 14:14:12 UTC):

The system will reboot now!

[vagrant@fedora39 ~]$ Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

6). 「仮想マシン」の画面が立ち上がるまで待ちます:

-

確認:

-

$ vagrant status
Current machine states:

default                   running (virtualbox)

-

$ vagrant global-status
id       name    provider   state   directory                           
------------------------------------------------------------------------
408fb2f  default virtualbox running /home/ubn/ダウンロード/vm/fedora39        
:

-

7). 「仮想マシン」に ssh で接続:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
vagrant@127.0.0.1's password: 

→パスワードに「vagrant」を入力

Last login: Fri Feb 23 14:41:06 2024 from xx.xx.xx.xx
[vagrant@vagrant ~]$ 

→ゲストOS 側のプロンプトが、いつもの表示になりました:

-

8). 「仮想マシン」の状態を確認:

[vagrant@vagrant ~]$ uname -n
vagrant

もしくは、

[vagrant@vagrant ~]$ sudo hostname
vagrant

もしくは、

[vagrant@vagrant ~]$ sudo hostnamectl
     Static hostname: vagrant
           Icon name: computer-vm
             Chassis: vm 🖴
          Machine ID: 1e5e2c0e93a949fcb8143caccbb0dad7
             Boot ID: 58d83f9a85b742e8965d8b22dca69de1
      Virtualization: oracle
    Operating System: Fedora Linux 39 (Thirty Nine)   
         CPE OS Name: cpe:/o:fedoraproject:fedora:39
      OS Support End: Tue 2024-05-14
OS Support Remaining: 2month 2w 5d
              Kernel: Linux 6.5.6-300.fc39.x86_64
        Architecture: x86-64
     Hardware Vendor: innotek GmbH
      Hardware Model: VirtualBox
    Firmware Version: VirtualBox
       Firmware Date: Fri 2006-12-01
        Firmware Age: 17y 2month 3w 2d            

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- -

9. 問題点1、2、3 の回避: ssh 関連の警告表示の対応:

-

問題点1: 「仮想マシン」の立ち上げ時に、ssh 認証失敗でリトライしてループ。端末にプロンプト返らず:

問題点2: 「仮想マシン」の立ち上げ時に、ssh 認証のリトライの回避策で警告表示して、ループ解除:

問題点3: 「仮想マシン」の電源オフ時に ssh 関連の警告が表示。に対応:

-


1). sshd サービスが起動されているか確認:

[vagrant@vagrant ~]$ sudo systemctl status sshd
● sshd.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Sun 2024-02-18 14:14:50 UTC; 16min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 693 (sshd)
      Tasks: 1 (limit: 2309)
     Memory: 5.9M
        CPU: 772ms
     CGroup: /system.slice/sshd.service
             └─693 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Feb 18 14:14:49 vagrant systemd[1]: Starting sshd.service - OpenSSH server daemon...
Feb 18 14:14:49 vagrant (sshd)[693]: sshd.service: Referenced but unset environment variable evaluat>
Feb 18 14:14:50 vagrant sshd[693]: Server listening on 0.0.0.0 port 22.
Feb 18 14:14:50 vagrant sshd[693]: Server listening on :: port 22.
Feb 18 14:14:50 vagrant systemd[1]: Started sshd.service - OpenSSH server daemon.

「q」で、表示を終了

-


2). パスワードなしでsudo が使えるかと、ssh 関連の設定を確認:

[vagrant@vagrant ~]$ sudo ls -lAp
-rw-------. 1 vagrant vagrant 108 Feb 18 14:14 .bash_history
-rw-r--r--. 1 vagrant vagrant  18 Jul 19  2023 .bash_logout
-rw-r--r--. 1 vagrant vagrant 144 Jul 19  2023 .bash_profile
-rw-r--r--. 1 vagrant vagrant 522 Jul 19  2023 .bashrc

→「~/.ssh」がありません

-


3). 「~/.ssh」を作成して、Vagrant 用公開鍵認証キーを取得:

$ mkdir -p /home/vagrant/.ssh
$ chmod 700 /home/vagrant/.ssh
$ cd /home/vagrant/.ssh
$ curl -k -L -o authorized_keys 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
$ chmod 600 /home/vagrant/.ssh/authorized_keys
$ chown -R vagrant:vagrant /home/vagrant/.ssh

-


4). ホームに移動:

[vagrant@vagrant ~]$ cd

-


5). 確認:

[vagrant@vagrant ~]$ ls -lAp /home/vagrant/ | grep ssh
:
drwx------. 2 vagrant vagrant  29 Feb 18 14:34 .ssh/

→ファイル属性は「700」で、「vagrant:vagrant」の所有です

-

[vagrant@vagrant ~]$ ls -lAp /home/vagrant/.ssh
:
-rw-------. 1 vagrant vagrant 409 Feb 18 14:34 authorized_keys

→ファイル属性は「600」で、「vagrant:vagrant」の所有

[vagrant@vagrant ~]$ ls -lAp
:
-rw-------. 1 vagrant vagrant 108 Feb 18 14:14 .bash_history
-rw-r--r--. 1 vagrant vagrant  18 Jul 19  2023 .bash_logout
-rw-r--r--. 1 vagrant vagrant 144 Jul 19  2023 .bash_profile
-rw-r--r--. 1 vagrant vagrant 522 Jul 19  2023 .bashrc
drwx------. 2 vagrant vagrant  29 Feb 18 14:34 .ssh/

-


6). 「仮想マシン」の再起動:

[vagrant@vagrant ~]$ sudo reboot
Broadcast message from root@vagrant on pts/1 (Sun 2024-02-18 14:38:40 UTC):

The system will reboot now!

[vagrant@vagrant ~]$ Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

仮想マシン」が立ち上がるまで待ちます:

-


7). 電源オフ:

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

和訳:

==> default: 仮想マシンを正常にシャットダウンしようとしています...
    default:
    default: Vagrant の安全でないキーが検出されました。Vagrant はセキュリティを向上
    default: させるために、これを新しく生成されたキーペアに自動的に置き換えます。
    default:
    default: キーが挿入されました!切断し、新しい SSH キーを使用して再接続しています...

-


8). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/fedora39' version '4.3.12' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 6.0.0 r127566
    default: VirtualBox Version: 7.0
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 
→問題点1、2、3 が解消: 「仮想マシン」の立ち上げ時の ssh 関連のリトライと、その後の警告表示が解消されました:

-

→問題点5: 「Guest Additions」のバージョンチェックで、6.0.0 と古いです:
→問題点6: 「マウスの統合化」が無効で、マウスを見失うので、右Ctrl キーが必要です:
→問題点7: 「共有フォルダ」が無効です:

-


9). 「vagrant ssh-config」を確認:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/ダウンロード/vm/fedora39/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

ssh 認証キーの行が 1行に変更されました:

ssh 認証キーは「作業フォルダ」の「.vagrant」フォルダ配下に置かれています:

-

10). 「仮想マシン」に「ssh 接続」:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
Last login: Sun Feb 18 14:16:38 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

→パスワードを入れなくてもログインできました:

-

11). ssh 接続を終了:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

12). 「仮想マシン」を電源オフ:

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 
→問題点3 の解消: 「仮想マシン」の電源オフ時の ssh 関連の警告が表示されなくなりました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- --

10. 問題点5、6、7 の回避: 「仮想マシン」を、最新の「Guest Additions」に更新しました:

-

問題点5: 「Guest Additions」のバージョンチェックで、6.0.0 と古いです:

問題点6: 「マウスの統合化」が無効で、マウスを見失うので、右Ctrl キーが必要です:

問題点7: 「共有フォルダ」が無効です:

-

参考:

CentOS、RHEL、Fedora に VirtualBox Guest Additions をインストールする

-

1). ホストOS を再起動:

「端末」以外のウィンドウを閉じてから、

$ reboot

-

2). 「仮想マシン」を立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up

-

3). 「仮想マシン」に「ssh 接続」:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
Last login: Sun Feb 18 15:16:43 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

→パスワードなしでログインできました:

-

4). 「仮想マシン」で、システム更新:

[vagrant@vagrant ~]$ sudo dnf update

もしくは、(dnf では、どちらも同じ機能)

[vagrant@vagrant ~]$ sudo dnf upgrade
:
Transaction Summary
===========================================================================
Install   12 Packages
Upgrade  172 Packages

Total download size: 370 M
Is this ok [y/N]: 

→「y」Enterで実行

「Enter」のみだと実行されないので注意。

:
Importing GPG key xxxxxxxxx:
 Userid     : "Fedora (39) <fedora-39-primary@fedoraproject.org>"
 Fingerprint: xxxx xxxx xxxx ......xxxx xxxx
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-39-x86_64
Is this ok [y/N]: 

→「y」Enterで実行

:
Complete!
[vagrant@vagrant ~]$ 

-

5). 「仮想マシン」を再起動:

[vagrant@vagrant ~]$ sudo reboot
Broadcast message from root@vagrant on pts/1 (Fri 2024-02-23 15:35:54 UTC):

The system will reboot now!

[vagrant@vagrant ~]$ Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

6). ホストOS の端末から、「ssh 接続」:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant ssh
Last login: Fri Feb 23 14:55:12 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

-

7). カーネルバージョンの確認:

$ uname -r
6.7.5-200.fc39.x86_64

-

8). カーネルヘッダーと、必要なツールのインストール:

Fedora」の場合:

$ sudo dnf install make gcc kernel-headers kernel-devel perl dkms bzip2
:
Transaction Summary
===========================================================================
Install  291 Packages

Total download size: 127 M
Installed size: 415 M
Is this ok [y/N]: 

→「y」Enterで実行

:
Complete!
[vagrant@vagrant ~]$ 

-

9). 「仮想マシン」の電源オフ:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

$ vagrant status
Current machine states:

default                   poweroff (virtualbox)

The VM is powered off. To restart the VM, simply run `vagrant up`

-

10). 「光学ドライブ」の準備:

-

(1). 「VirtualBox」マネージャを起動:

-

(2). ウィンドウの左側で、仮想マシンの「fedora39_default_xxxx...」をクリック

-

(3). ストレージ→「コントローラー: IDE Controller...」の右にある「光学ドライブの追加」アイコンをクリック

-

(4). 「光学ドライブ選択」画面が表示:

.iso がない場合は、右下の「空のままにする」をクリック

「VBoxGustAdditions.iso」が表示されていたら、それを選んで、右下の「選択」をクリック

→「OK」

-

-

これで「光学ドライブ」が認識されるようになります:

/dev/cdrom
/dev/sr0

どちらのドライブを使っても良いですが、これがないと、iso イメージをマウントできません:

-

(5). 「VirtualBox」マネージャを右上の「x」で閉じます:

-

11). ホストOS を再起動:

「端末」以外のウィンドウを閉じてから、

$ reboot

-

12). 「仮想マシン」の立ち上げ

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up

-

13). 「仮想マシン」の画面が立ち上がったら、操作:

マウスを見失ったら、右「Ctrl」キーを押します:

-

仮想マシン」の画面の左上の「Devices」 →「Insert Guest Additions CD Image ...」をクリック

→ウィンドウの右下の「CD-ROM」のアイコンが表示されていることを確認:

-

14). ホストOS の「端末」から「ssh 接続」にて、「光学ドライブ」を確認:

$ vagrant ssh
Last login: Fri Feb 23 15:37:35 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

-

[vagrant@vagrant ~]$ ls /dev/cd*
/dev/cdrom

-

15). iso を「光学ドライブ」にマウント:

[vagrant@vagrant ~]$ sudo mount -r /dev/cdrom /media
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.

→マウントのヒントが表示されます

これは、恒久的にマウントする場合のヒントなので無視します:

-

16). スクリプトの実行:

[vagrant@vagrant ~]$ cd /media/
[vagrant@vagrant media]$ ls *.run
VBoxLinuxAdditions.run

-

[vagrant@vagrant media]$ sudo ./VBoxLinuxAdditions.run install
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.14 Guest Additions for Linux  100%  
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
6.7.5-200.fc39.x86_64.
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted or 'rcvboxadd reload' triggered
VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: kernel modules and services 7.0.14 r161095 reloaded
VirtualBox Guest Additions: NOTE: you may still consider to re-login if some 
user session specific services (Shared Clipboard, Drag and Drop, Seamless or 
Guest Screen Resize) were not restarted automatically
[vagrant@vagrant media]$ 

→インストールが完了:

-

スクリプト実行時のログは、「/var/log/vboxadd-setup.log」に登録されています:
[vagrant@vagrant ~]$ cat /var/log/vboxadd-setup.log
Building the main Guest Additions 7.0.14 module for kernel 6.7.5-200.fc39.x86_64.
Building the shared folder support module.
Building the graphics driver module.
Could not find the X.Org or XFree86 Window System, skipping.

-

→「共有フォルダ」機能と「グラフィックドライバー」のモジュールがビルドされました。
ただし、GUI がインストールされていないとスキップされるところ?があるみたい。

エラーの登録はないみたい。

-

17). アンマウント:

[vagrant@vagrant media]$ cd
[vagrant@vagrant ~]$ sudo umount /media

-

18). 取外し:

[vagrant@vagrant ~]$ sudo eject

-

19). ssh 接続を終了:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

20). 「仮想マシン」の電源オフ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

21). ホストOS を再起動:

「端末」以外のウィンドウを閉じてから、

$ reboot

-

22). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/fedora39' version '4.3.12' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

→問題点5: 「guest additions」のチェックが OK になりました:

→問題点6: 「マウスの統合化」機能が有効になっていません:

マウスが消えるのでマウスを見失います。 そのたびに手動で右「Ctrl」キーが必要。マウスを見失います。右Ctrl キーが必要です。マウスの統合化が効いていません:

-

→問題点7:「共有フォルダ」が有効になっておらず、「共有フォルダ」がマウントされていません

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ---

11. 問題点6 の回避: 「マウスの統合化」機能を有効にしました:

-

問題点6: 「マウスの統合化」が無効です:

マウスが消えるのでマウスを見失います。 そのたびに手動で右「Ctrl」キーが必要。マウスを見失います。右Ctrl キーが必要です。

マウスの統合化が効いていません:

-

有効にするには、「仮想マシン」にて「Guest Additions」のインストールが必要です:

それ以外に、ポインティングデバイス:「PS/2 マウス」→「USB タブレット」に変更する必要があります:

-

1). 「仮想マシン」を電源オフ:

$ cd ~/ダウンロード/vm/fedora39
$ vagrant halt

-

2). 「VirtualBox」マネージャを起動して、右側の「システム」の文字をクリック →「マザーボード」タブ

-

3). ポインティングデバイス:「PS/2 マウス」→「USB タブレット」に変更:

→「OK」

-

4). 「VirtualBox」マネージャを右上の「x」で閉じます:

-

5). 「仮想マシン」を立ち上げ:

$ cd ~/ダウンロード/vm/fedora39
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/fedora39' version '4.3.12' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

6). 「仮想マシン」画面の右下の「マウスのアイコン」に緑色の「>」(マウス統合が有効)があることを確認:

→「仮想マシン」画面の中(コンソール画面)にマウスを持って行くと、マウスポインターが消えますが、

仮想マシン」画面の上下のバーでは、マウスポインターが表示され、ホストOS 側にマウスを持っていくと、

マウスカーソルが表示されることを確認。

-

問題点6 の解消: 「マウスの統合化」が有効になりました:
→マウスを動かすたびに、手動で右「Ctrl」キーを押す必要がなくなりました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----

12. 問題点7 の回避: 「共有フォルダ」機能が使えるようにトライ:

-

参考: 「vagrant init」で作成した「Vagrantfile」のコメント行から抜粋:

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Disable the default share of the current code directory. Doing this
  # provides improved isolation between the vagrant box and your host
  # by making sure your Vagrantfile isn't accessable to the vagrant box.
  # If you use this you may want to enable additional shared subfolders as
  # shown above.
  # config.vm.synced_folder ".", "/vagrant", disabled: true

和訳:

  # ゲスト VM で追加のフォルダを共有します:
  # 1 番目の引数は、ホスト上の実際のフォルダへのパスです。
  # 2 番目の引数は、フォルダをマウントするゲスト上のパスです。
  # 3 番目の引数は、必須ではないオプションのセットです。
  # config.vm.synced_folder "../data", "/vagrant_data"

  # 現在の共有ディレクトリを無効にします:
  # これを行うと、Vagrantfile が vagrant box にアクセスできなくなるので、
  # vagrant box とホスト間の分離が強化されます。
  # これを使うと、上に示したように追加の共有サブフォルダを有効にできます。
  # config.vm.synced_folder ".", "/vagrant", disabled: true

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- -----

12-1. 問題点7 の回避: 「共有フォルダ」機能が使えるように、vagrant コマンドで「共有フォルダ」を有効化する場合:

-

参考: Vagrant 事始め 05 - 共有フォルダを設定する

-

1). 「仮想マシン」が立ち上がっていたら、電源オフ:

$ cd ~/ダウンロード/vm/fedora39
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39$

-

2). 「共有フォルダ」の利用に必要な「プラグイン」があるか確認:

$ vagrant plugin list
No plugins installed.

→「プラグイン」なし

-

3). 「プラグイン」がない場合は、「vagrant-vbguest」プラグインをインストール:

$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching micromachine-3.0.0.gem
Fetching vagrant-vbguest-0.32.0.gem
Installed the plugin 'vagrant-vbguest (0.32.0)'!

-

4). 「プラグイン」がインストールされたか確認:

$ vagrant plugin list
vagrant-vbguest (0.32.0, global)

-

5). 「仮想マシン」を立ち上げ:

$ cd ~/ダウンロード/vm/fedora39
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/fedora39' version '4.3.12' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
6.7.5-200.fc39.x86_64.
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...

「GuestAdditions」が自動でインストールされて、再起動されました:

==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

$ vagrant status
Current machine states:

default                   running (virtualbox)
:

-

6). 「vbguest」の状態を確認:

$ vagrant vbguest --status

茶色で表示:

[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.

和訳:

[default] GuestAdditions (7.0.14) は正しくインストールされていますが、実行されていません。

-

7). 「vagrant vbguest」の実行:

ステータス表示が下記の「インストールが見つかりません」の場合:
[default] No installation found.

vagrant vbguest」を実行すると、
vbguest の利用に必要なパッケージをインストールしてくれるみたい:

-

ステータス表示が下記の「GuestAdditions が実行されていません 」の場合:
[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.

vagrant vbguest」を実行すると、

$ vagrant vbguest
[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
6.7.5-200.fc39.x86_64.
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
Guest Additions got installed. However, they seem not be loaded correctly. Please restart the box running `vagrant reload default`
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

最終行の和訳:

ゲスト追加機能がインストールされました。ただし、正しく読み込まれていないようです。
 「vagrant reload default」を実行してボックスを再起動してください。

-

$ vagrant vbguest --status
[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- -

12-2. この時点の「仮想マシン」で、「Box」を作成:

-

仮想マシン」が初期化されると、今までの苦労が水の泡なので、このタイミングで「Box」を作成しました:

-

次の項番にて「共有フォルダ」を使えるようにする予定ですが、事前の作業中に「作業フォルダ」の中身が消去されてしまって、イチから作業をやり直す羽目になったので、その対策です:

「共有フォルダ」を使えるようにすると、デフォルトだと「仮想マシン」の「/vagrant」に 「作業フォルダ」がマウントされます。

→何気に「/vagrant」を触っていたら、 「作業フォルダ」の中身を消してしまい、最初からやり直しになりました:

ちなみに、「作業フォルダ」そのものでなく、「作業フォルダ」の中のサブフォルダを使うようにするとリスクが低くなります:

-

1). 「仮想マシン」の電源オフ:

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

2). Vagrant にて、「仮想マシン」の名前(フォルダ名)を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
408fb2f  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39        

→id は「408fb2f」です

-

3). 「.box」ファイルを作成したい場所を準備:

すでに作成済みです:

$ mkdir -p ~/ダウンロード/vm/box-share/

-

4). 「.box」ファイルを作成する場所に移動:

$ cd ~/ダウンロード/vm/box-share/

-

$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box

-

5). 「仮想マシン」から「.box」ファイルを作成:

$ vagrant package 408fb2f --output pkg-fedora39_2024-0224.box
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...

時間がかかります:

==> default: Compressing package to: /home/ubn/ダウンロード/vm/box-share/pkg-fedora39_2024-0224.box
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

-

確認:

$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box
-rw-rw-r-- 1 ubn ubn  1781468080  2月 24 23:37 pkg-fedora39_2024-0224.box ←(追加)

-

6). できた「Box」ファイルをホームの「Box」一覧に追加:

$ cd ~/ダウンロード/vm/box-share/
$ vagrant box add --name fedora39-0224 pkg-fedora39_2024-0224.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'fedora39-0224' (v0) for provider: 
    box: Unpacking necessary files from: file:///home/ubn/%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89/vm/box-share/pkg-fedora39_2024-0224.box
==> box: Successfully added box 'fedora39-0224' (v0) for ''!
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

-

7). 「Box」の一覧に追加されたか確認:

$ vagrant box list
Endeav-base3     (virtualbox, 0)
fedora39-0224    (virtualbox, 0)                     ←(追加)
generic/fedora39 (virtualbox, 4.3.10, (amd64))
generic/fedora39 (virtualbox, 4.3.12, (amd64))

-

8). 「Box」の一覧から、古いバージョンの「Box」を削除:

$ vagrant box remove generic/fedora39 --box-version 4.3.10
Removing box 'generic/fedora39' (v4.3.10) with provider 'virtualbox'...

-

9). 「Box」の一覧を確認:

$ vagrant box list
Endeav-base3     (virtualbox, 0)
fedora39-0224    (virtualbox, 0)
generic/fedora39 (virtualbox, 4.3.12, (amd64))

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- --

12-3. 問題点7 の回避: 「共有フォルダ」機能が使えるように、新しい「仮想マシン」でトライ:

-

やり直しが楽になるように、設定の途中で、「Box」(fedora39-0224)を作成したので、

この「Box」を使って、設定を継続します:

-

1). 「仮想マシン」を管理する別の「作業フォルダ」を準備:

$ mkdir -p ~/ダウンロード/vm/fedora39-test/

→「仮想マシン」を管理する場所になります

-

「作業フォルダ」は使い回すのでなく、新しい名前で作成した方が混乱しないと思います。

-

2). 「Vagrantfile」の作成:

$ cd ~/ダウンロード/vm/fedora39-test/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "fedora39-0224"
  #config.vm.box_version = "4.3.12"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  # ホストの作業フォルダ内の data フォルダと
  # 仮想マシン内の /vagrant_data フォルダを共有
  # 指定のフォルダがない場合は、フォルダを作成
  config.vm.synced_folder "./data", "/vagrant_data", create: true
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7、8行目で、リトライのタイムアウト値を短く変更: ←(問題点1 の取りあえずの回避)
9〜12行目で、「共有フォルダ」を設定: ★
16、17行目で、メモリ「2048」MB に変更:
19、20行目で、ディスプレイを 「vmsvga」に変更:

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:「config.vm.box = "fedora39-0224"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

6行目は、使用する「Box」のバージョンを指定しているので、行頭に「#」を付けてコメント行にするか、削除します: 

-

3). 「仮想マシン」を(作成して)立ち上げ:

$ cd ~/ダウンロード/vm/fedora39-test/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'fedora39-0224'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: fedora39-test_default_1708790535185_33852
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!

自動で「GuestAdditions」がインストールされました:

[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
6.7.5-200.fc39.x86_64.
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...

自動で「仮想マシン」が再起動されました:

==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /home/ubn/ダウンロード/vm/fedora39-test
    default: /vagrant_data => /home/ubn/ダウンロード/vm/fedora39-test/data
ubn@ubn-box:~/ダウンロード/vm/fedora39-test$ 
→問題点7 の解消: 「共有フォルダ」機能が使えるようになりました:

-

→問題点8: 「共有フォルダ」がマウントされましたが、 2つのフォルダがマウントされました:
VirtualBox マネージャを起動して「共有フォルダ」の設定を確認:

→「作業フォルダ」と、その「サブフォルダ」の 2つを「共有フォルダ」にする定義があります

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ---

12-4. 問題点8 の回避: 「共有フォルダ」機能でサブフォルダのみを有効にするように変更:

-

デフォルトの「作業フォルダ」(直下)を共有すると、誤操作で「作業フォルダ」内のファイルを消してしまう(vagrant up できなくなる)リスクが高いので、無効にしました:

ちなみに、「作業フォルダ」にある「サブフォルダ」の共有であればリスクが減ります:

-

指定することで「仮想マシン」側の「共有フォルダ」が自動で作成されるか確認するため、「仮想マシン」を作り直してからトライしました:

-


1). 「仮想マシン」を電源オフ:

$ cd ~/ダウンロード/vm/fedora39-test/
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39-test$ 

-


2). 削除する「仮想マシン」を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
408fb2f  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39        
99bbb9b  default virtualbox running  /home/ubn/ダウンロード/vm/fedora39-test   

-


3). 「仮想マシン」の削除:

$ vagrant destroy 99bbb9b
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...
ubn@ubn-box:~/ダウンロード/vm/fedora39-test$ 

-


4). 「作業フォルダ」の整理:

$ cd ~/ダウンロード/vm/fedora39-test/

-

$ ls -1Ap
.vagrant/
Vagrantfile
data/

-

$ rm -r .vagrant
$ rm -r data

-

$ ls -1Ap
Vagrantfile

-


5). 「Vagrantfile」の修正:

$ cd ~/ダウンロード/vm/fedora39-test/
$ nano Vagrantfile

↓ すべて置換:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "fedora39-0224"
  #config.vm.box_version = "4.3.12"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  # ホストの作業フォルダ内の data フォルダと
  # 仮想マシン内の /vagrant_data フォルダを共有:
  # 指定のフォルダがない場合は、フォルダを作成:
  config.vm.synced_folder "./data", "/vagrant_data", create: true
  # デフォルトの共有フォルダを無効にします:
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7〜8行目で、リトライのタイムアウト値を短く調整: ←(問題点1 の取りあえずの回避)
9〜12行目で、共有フォルダ「/vagrant_data」を設定: ★
13〜14行目で、共有フォルダ「/vagrant」を無効化: ★
15行目で、GUI 表示を有効に設定:
16〜17行目で、メモリ「2048」MB に変更:
18行目で、プロセッサ「2」個 に変更:
19〜20行目で、ディスプレイを 「vmsvga」に変更:

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:「config.vm.box = "fedora39-0224"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

6行目は、使用する「Box」のバージョンを指定しているので、行頭に「#」を付けてコメント行にするか、削除します:

-


6). 「仮想マシン」を(作成して)立ち上げ:

仮想マシン」に「Guest Additions」がインストールされて、再起動されるので、いつもよりも時間がかかります:

$ cd ~/ダウンロード/vm/fedora39-test/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'fedora39-0224'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: fedora39-test_default_1708794572898_69860
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!

自動で「GuestAdditions」がインストールされました:

[default] GuestAdditions seems to be installed (7.0.14) correctly, but not running.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 
6.7.5-200.fc39.x86_64.
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant_data => /home/ubn/ダウンロード/vm/fedora39-test/data
ubn@ubn-box:~/ダウンロード/vm/fedora39-test$ 
→問題点8 の解消: 使える「共有フォルダ」が 1つになりました:

-


7). VirtualBox マネージャを起動して「共有フォルダ」の設定を確認:

-


8). 「仮想マシン」のメニューバーからも「共有フォルダ」の設定が確認できます:

「Devices」→「Shared Folders」→「Shared Folders Settings...」

→「作業フォルダ」(~/ダウンロード/vm/fedora39-test/) 配下の「サブフォルダ」(data/) を「共有フォルダ」にする定義がひとつだけあります

-


9). 「vagrant ssh-config」を確認:

$ cd ~/ダウンロード/vm/fedora39-test/
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/.vagrant.d/boxes/fedora39-0224/0/virtualbox/vagrant_private_key
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

-


10). 「仮想マシン」に ssh 接続して、「共有フォルダ」を確認:

-

仮想マシン」 側に ssh 接続:
$ cd ~/ダウンロード/vm/fedora39-test/
$ vagrant ssh
Last login: Fri Feb 23 16:03:28 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

-

[vagrant@vagrant ~]$ date
Sat Feb 24 05:43:10 PM UTC 2024

→日本語化されてません

-

[vagrant@vagrant ~]$ uname -r
6.7.5-200.fc39.x86_64
[vagrant@vagrant ~]$ ls -Ap /
afs/   dev/   lib     mnt/   root/  srv/  usr/
bin    etc/   lib64   opt/   run/   sys/  vagrant_data/
boot/  home/  media/  proc/  sbin   tmp/  var/

→「/」がお尻に付かないのはリンクです

仮想マシン」側の「共有フォルダ」である「/vagrant_data」フォルダがありました:

-

「/vagrant_data」フォルダを確認:

[vagrant@vagrant ~]$ ls -Ap /vagrant_data/
[vagrant@vagrant ~]$

→ファイルなし

-

ファイルを作成してみました:

[vagrant@vagrant ~]$ sudo nano /vagrant_data/test01.txt
sudo: nano: command not found

→「nano」コマンドはインストールされていません

-

vim」の使い方を忘れないように、「nano」をインストールせずに、「vim」 で編集:

[vagrant@vagrant ~]$ sudo vim /vagrant_data/test01.txt

-

「Esc」「Esc」「i」で、挿入モード にして、

「test 」Enter

「Esc」「Esc」「:wq」で、書込み後に終了

-

編集した内容を確認:

[vagrant@vagrant ~]$ sudo cat /vagrant_data/test01.txt
test

-

仮想マシン」の ssh 接続を終了:
[vagrant@vagrant ~]$ exit
logout

-


11). ホストOS 側で、「共有フォルダ」を確認:

$ pwd
/home/ubn/ダウンロード/vm/fedora39-test

→作業フォルダです:

-

$ ls -1Ap
.vagrant/
Vagrantfile
data/

→「data」フォルダがあります

-

「data」フォルダを確認:

$ ls -1Ap data/
test01.txt

→「仮想マシン」の「/vagrant_data」フォルダと同じファイルがあります

-

「test01.txt」の内容を確認:

$ cat data/test01.txt
test

→内容は同じです

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----

12-5. 最終的な設定を終えた時点の「仮想マシン」で、「Box」を作成:

-

仮想マシン」が使える状態になったので、このタイミングで「Box」を作成しました:

これ以降は、この作成した「Box」を使って、デスクトップ環境の追加などにトライの予定。

-


1). 「仮想マシン」の電源オフ:

$ cd ~/ダウンロード/vm/fedora39-test
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/fedora39-test$ 

-


2). Vagrant にて、「仮想マシン」の名前(フォルダ名)を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
408fb2f  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39        
a5fdb3e  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-test   
:

→id は「a5fdb3e」です

-


3). 「.box」ファイルを作成したい場所を準備:

すでに作成済みです:

$ mkdir -p ~/ダウンロード/vm/box-share/

-


4). 「.box」ファイルを作成する場所に移動:

$ cd ~/ダウンロード/vm/box-share/

-

$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box
-rw-rw-r-- 1 ubn ubn  1781468080  2月 24 23:37 pkg-fedora39_2024-0224.box

-


5). 「仮想マシン」から「.box」ファイルを作成:

$ vagrant package a5fdb3e --output pkg-fedora39_2024-0225.box
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...

時間がかかります:

==> default: Compressing package to: /home/ubn/ダウンロード/vm/box-share/pkg-fedora39_2024-0225.box
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

-

確認:

$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box
-rw-rw-r-- 1 ubn ubn  1781468080  2月 24 23:37 pkg-fedora39_2024-0224.box
-rw-rw-r-- 1 ubn ubn  1780229003  2月 25 10:34 pkg-fedora39_2024-0225.box ←(追加)

-


6). できた「Box」ファイルをホームの「Box」一覧に追加:

$ cd ~/ダウンロード/vm/box-share/
$ vagrant box add --name fedora39-0225 pkg-fedora39_2024-0225.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'fedora39-0225' (v0) for provider: 
    box: Unpacking necessary files from: file:///home/ubn/%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89/vm/box-share/pkg-fedora39_2024-0225.box
==> box: Successfully added box 'fedora39-0225' (v0) for ''!
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

-


7). 「Box」の一覧に追加されたか確認:

$ vagrant box list
Endeav-base3     (virtualbox, 0)
fedora39-0224    (virtualbox, 0)
fedora39-0225    (virtualbox, 0)                  ←(追加)
generic/fedora39 (virtualbox, 4.3.12, (amd64))

-


8). 「Box」の一覧から、不要な「Box」を削除:

$ vagrant box remove generic/fedora39
Removing box 'generic/fedora39' (v4.3.12) with provider 'virtualbox'...

-


9). 「Box」の一覧を確認:

$ vagrant box list
Endeav-base3  (virtualbox, 0)
fedora39-0224 (virtualbox, 0)
fedora39-0225 (virtualbox, 0)

→個人的にカスタマイズした「Box」のみになりました

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- -----

12-6. 最終的な設定を終えた「Box」から、「仮想マシン」を作成:

-

ここで作成された「仮想マシン」を使って、次の投稿の作業をする予定です:

-


1). 「作業フォルダ」を作成:

$ mkdir -p ~/ダウンロード/vm/fedora39-base/

-


2). 「Vagrantfile」の修正:

$ cd ~/ダウンロード/vm/fedora39-base/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "fedora39-0225"
  #config.vm.box_version = "4.3.12"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  # ホストの作業フォルダ内の data フォルダと
  # 仮想マシン内の /vagrant_data フォルダを共有:
  # 指定のフォルダがない場合は、フォルダを作成:
  config.vm.synced_folder "./data", "/vagrant_data", create: true
  # デフォルトの共有フォルダを無効にします:
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

説明:

5行目で、使用する「Box」を指定:
6行目で、使用する「Box」のバージョンを指定: ★
7〜8行目で、リトライのタイムアウト値を短く調整: ←(ssh 認証時のループ回避)
9〜12行目で、共有フォルダ「/vagrant_data」を設定: ★
13〜14行目で、デフォルトの共有フォルダ「/vagrant」を無効化: ★
17行目で、GUI 表示を有効に設定:
18〜19行目で、メモリ「2048」MB に変更:
20行目で、プロセッサ「2」個 に変更:
21〜22行目で、ディスプレイを 「vmsvga」に変更:

-

→Crtl+O で、保存。保存先を確認して、Enter

→Crtl+X で、終了

-

参考:「config.vm.box = "fedora39-0225"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

6行目は、使用する「Box」のバージョンを指定します。最新バージョンにするときは、行頭に「#」を付けてコメント行にするか、行を削除します:

-


3). 「仮想マシン」を(作成して)立ち上げ:

仮想マシン」に「Guest Additions」がインストールされて、再起動されるので、いつもよりも時間がかかります:

$ cd ~/ダウンロード/vm/fedora39-base/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'fedora39-0225'...     ←(読み込む「Box」)
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: fedora39-base_default_1708841405443_68193
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions 7.0.14 running --- OK.      ←(注目)実行確認:
==> default: Checking for guest additions in VM...   ←(注目)バージョン確認:
==> default: Mounting shared folders...              ←(注目)マウント:
    default: /vagrant_data => /home/ubn/ダウンロード/vm/fedora39-base/data
ubn@ubn-box:~/ダウンロード/vm/fedora39-base$ 

→読み込まれた「Box」の「fedora39-0225」は、すでに自動で「GuestAdditions」がインストールされているので、 スッキリした立ち上げです:

また、「共有フォルダ」の設定をデフォルトと違い、「サブフォルダ」指定にしたので、
仮想マシン」から vagrant の管理ファイルを消してしまうリスクが減ったと思います:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- -

12-7. 気になるところ:「仮想マシン」の立ち上げ時のログイン画面で、メッセージが上書きされ見づらいです:

-

1). 「仮想マシン」の立ち上げ:

-


2). 「ログイン」画面が表示:

Fedora Linux 39 (Thirty Nine)

vagrant login: 

-


3). ログイン画面に、下記のメッセージが続けて表示:

[   27.010407] systemd-journald[536]: /var/log/journal/1e5e2c0e93.../user-1000.journal: Journal file uses a different sequence number ID, rotating.

-


4). 改行がないので、「項番 2)」と「項番 3)」のメッセージが重なって表示:

-

vagrant login: [   27.010407] systemd-journald[536]: /var/log/journal/1e5e2c0e93.../user-1000.journal: 
Journal file uses a different sequence number ID, rotating.

和訳:

vagrant login: [   27.010407] systemd-journald[536]: /var/log/journal/1e5e2c0e93.../user-1000.journal: 
ジャーナル ファイルは、循環する異なるシーケンス番号 ID を使用します。

-


5). →Enter を押せば良いだけですが、見づらくなります:

-


6). 「ssh 接続」:

$ cd ~/ダウンロード/vm/fedora39-base
$ vagrant ssh
Last login: Sun Feb 25 06:57:44 2024
[vagrant@vagrant ~]$ 

-


7). journal ファイルの確認:

[vagrant@vagrant ~]$ ls -lAp /var/log/journal/
:
drwxr-sr-x+ 2 root systemd-journal 8192 Feb 25 06:10 1e5e2c0e93a949fcb8143caccbb0dad7/
drwxr-sr-x+ 2 root systemd-journal 4096 Jan 10 11:26 a499bd5e49b54edd849c15804c9834b4/

-

[vagrant@vagrant ~]$ ls -lAp /var/log/journal/1e5e2c0e93a949fcb8143caccbb0dad7/user-1000.journal
-rw-r-----+ 1 root systemd-journal 8388608 Feb 25 07:11 /var/log/journal/1e5e2c0e93a949fcb8143caccbb0dad7/user-1000.journal

-


8). 「.journal」ファイルを確認:

-

(1). 「.journal」ファイルについて:

「systemd」環境では、ログ収集のサービスとして「systemd-journald」が動いているみたい。

-

(2). 「.journal」ファイルを確認:
[vagrant@vagrant ~]$ cat /var/log/journal/1e5e2c0e93a949fcb8143caccbb0dad7/user-1000.journal

→表示させると、バイナリファイルのようで文字化けします:

-

(3). ASCII 文字が含まれるファイルで、ASCII 文字を表示:
[vagrant@vagrant ~]$ od -Ax -tx1z /var/log/journal/1e5e2c0e93a949fcb8143caccbb0dad7/user-1000.journal

わかりやすい部分を抜粋:

3a51e0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  >................<
3a51f0 00 00 00 00 00 00 00 00 5f 53 4f 55 52 43 45 5f  >........_SOURCE_<
3a5200 52 45 41 4c 54 49 4d 45 5f 54 49 4d 45 53 54 41  >REALTIME_TIMESTA<
3a5210 4d 50 3d 31 37 30 38 38 34 35 30 39 38 36 38 32  >MP=1708845098682<
3a5220 38 37 30 00 00 00 00 00 03 00 00 00 00 00 00 00  >870.............<
3a5230 d0 00 00 00 00 00 00 00 32 be 00 00 00 00 00 00  >........2.......<

-

(4). 「journalctl」コマンドを使うと、「less」でジャーナルの内容を表示できます:

これが現実的な使い方:

$ journalctl
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Queued start job for default target default.target.
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Created slice app.slice - User Application Slice.
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Started grub-boot-success.timer - Mark boot as successful after>
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Started systemd-tmpfiles-clean.timer - Daily Cleanup of User's >
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Reached target paths.target - Paths.
Feb 23 14:38:33 fedora39.localdomain systemd[894]: Reached target timers.target - Timers.
Feb 23 14:38:34 fedora39.localdomain systemd[894]: Starting dbus.socket - D-Bus User Message Bus Socket...
:
Feb 25 07:06:21 vagrant systemd[2605]: Startup finished in 357ms.
Feb 25 07:08:38 vagrant systemd[2605]: Starting grub-boot-success.service - Mark boot as successful...
Feb 25 07:08:38 vagrant systemd[2605]: Finished grub-boot-success.service - Mark boot as successful.
Feb 25 07:11:38 vagrant systemd[2605]: Created slice background.slice - User Background Tasks Slice.
Feb 25 07:11:38 vagrant systemd[2605]: Starting systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files>
Feb 25 07:11:38 vagrant systemd[2605]: Finished systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files>
lines 1379-1397/1397 (END)

「半角スペース」で、改ページ
Enter で、改行

「q」で、表示を終了

-

(5). 「journalctl」コマンドで、日時の範囲を指定して表示:
[vagrant@vagrant ~]$ journalctl -S "2024-02-25 07:08:00" -U "2024-02-25 12:00:00"
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
Feb 25 07:08:38 vagrant systemd[2605]: Starting grub-boot-success.service - Mark boot as successful...
Feb 25 07:08:38 vagrant systemd[2605]: Finished grub-boot-success.service - Mark boot as successful.
Feb 25 07:11:38 vagrant systemd[2605]: Created slice background.slice - User Background Tasks Slice.
Feb 25 07:11:38 vagrant systemd[2605]: Starting systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories...
Feb 25 07:11:38 vagrant systemd[2605]: Finished systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories.
[vagrant@vagrant ~]$ 

-


9). 参考:「systemd-journald」の設定ファイルを確認:

[vagrant@vagrant ~]$ cat /etc/systemd/journald.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the journald.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/journald.conf' to display the full config.
#
# See journald.conf(5) for details.

[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes
#Audit=yes

和訳:

#  このファイルは systemd の一部です。
#
#  systemd はフリーソフトウェアです。 
# Free Software Foundation によって公開されている GNU Lesser General Public License の条件に基づいて、
# 再配布したり変更したりすることができます。
# ライセンスのバージョン 2.1、または (オプションで) それ以降のバージョンのいずれか。
#
# このファイル内のエントリには、コンパイル時のデフォルトが表示されます。
# ローカル構成は、このファイルを変更するか、journald.conf.d/ サブディレクトリに
# 「ドロップイン」を作成することによって作成する必要があります。一般的には後者が推奨されます。
# このファイルとすべてのドロップインを削除するだけでデフォルトに戻すことができます。
#
# 完全な構成を表示するには、「systemd-analyze cat-config systemd/journald.conf」を使用します。
#
# 詳細については、journald.conf(5) を参照してください。

[Journal]

#ストレージ=自動
#圧縮=はい
#シール=はい
#分割モード=uid
#同期間隔秒=5m
#レート制限間隔秒=30秒
#レート制限バースト=10000
#システム最大使用量=
#システムフリーキープ=
#システム最大ファイルサイズ=
#システム最大ファイル数=100
#ランタイム最大使用量=
#ランタイムキープフリー=
#実行時の最大ファイルサイズ=
#実行時の最大ファイル数=100
#最大保持秒=
#最大ファイル秒=1か月
#Syslog に転送=いいえ
#KMsg に転送=いいえ
#コンソールに転送=いいえ     ←(注目)
#壁に転送=はい
#TTY パス=/dev/console    ←(注目)
#最大レベルストア=デバッグ
#最大レベル Syslog=デバッグ
#最大レベルKMsg=注意
#最大レベルコンソール=情報
#最大レベルの壁=emerg
#最大行数=48K
#KMsgの読み取り=はい
#監査=はい

-

参考:(注目)のどちらも試してみましたが、変化なし:

[vagrant@vagrant ~]$ sudo vim /etc/systemd/journald.conf

→「nano」はインストールされていませんでした

-

変更を保存したら、journald を再起動:

$ sudo systemctl restart systemd-journald

-


10). ログイン画面に、「systemd-journald」のメッセージが表示されることの回避策は、今のところ不明:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- --

13. 参考:「vagrant vbguest」のヘルプを表示:

-

プラグイン」をインストールすることで、

VirtualBox 「GuestAdditions」を Vagrant から制御するサブコマンドが追加され、使えます:

-


vagrant vbguest」のヘルプを表示:

$ vagrant vbguest --help

和訳:

使い方: vagrant vbguest [vm-name] [--do start|rebuild|install] [--status] 
                  [-f|--force] [-b|--auto-reboot] [-R|--no-remote]
                  [--iso VBoxGuestAdditions.iso] [--no-cleanup]

      --do COMMAND           GuestAdditions を手動で「開始」(start) 、「再構築」
                               (rebuild) 、または「インストール」(install) します
      --status               現在の GuestAdditions ステータスを表示して終了します
  -f, --force                インストールを強制するかどうか(--do start|rebuild|install によって暗示されます)
  -b, --auto-reboot          インストール後に VM を再起動できるようにします(GuestAdditions が起動しない場合)
  -R, --no-remote            Web サーバーから ISO ファイルをダウンロードしません
      --iso file_or_uri      VBoxGuestAdditions.iso へのフルパスまたは URI
      --no-cleanup           インストール後にクリーンアップ タスクを実行しません(デバッグ用)
      --[no-]provision       プロビジョニングを有効または無効にします
      --provision-with x,y,z タイプまたは名前によって、特定のプロビジョナーのみを有効にします
  -h, --help                 このヘルプを表示

→オプションを付けずに「vagrant vbguest」を実行した場合の例は、「こちら」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- ---

14. 参考:「vagrant box remove」のヘルプを表示:

-

ホームに登録した「Box」を削除します:

-


vagrant box remove」のヘルプを表示:

$ vagrant box remove --help

和訳:

使い方: vagrant box remove <name>

オプション:

  -f, --force                確認せずに削除
  -a, --architecture ARCH    削除する box の特定のアーキテクチャを指定
      --provider PROVIDER    削除する box の特定のプロバイダー名を指定
      --box-version VERSION  削除する box の特定のバージョンを指定  ←(★ 注目)
      --all                  box の利用可能なバージョンをすべて削除
      --all-providers        box のバージョン内のすべてのプロバイダーを削除
      --all-architectures    box のプロバイダーおよびバージョン内のすべての
                               アーキテクチャを削除
      --[no-]color           カラー出力を有効または無効にします
      --machine-readable     機械可読出力を有効にします
  -v, --version              Vagrant のバージョンを表示
      --debug                デバッグ出力を有効にします
      --timestamp            ログ出力のタイムスタンプを有効にします
      --debug-timestamp      タイムスタンプ付きのデバッグ出力を有効にします
      --no-tty               非対話型出力を有効にします
  -h, --help                 このヘルプを表示

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- ----

15. 参考: 「共有フォルダ」機能が使えるように、VirtualBox マネージャで「共有フォルダ」を設定する場合:

-

動作が不安定ですし、「プラグイン」で使えるようになるので、こちらの作業は要りません:

-


1). 「共有フォルダ」機能を有効にするには、「仮想マシン」に「Guest Additions」のインストールが必要です:

-


2). 自動で使えるようにならないので、VirtualBox マネージャで、「仮想マシン」に「共有フォルダ」を設定しました:

プラグイン」を使わなくても、「共有フォルダ」を設定できます。

ただし、「仮想マシン」を作成し直すと、設定が消えるので、

恒久的な設定にするなら、「共有フォルダ」を設定してから、「Box」を作成して、「仮想マシン」を作成し直す必要があります。

-

設定は、

公式「Box」にある、「nercceh/ubuntu22.04-desktop」が参考になりそう:

「nercceh/ubuntu22.04-desktop」は、「共有フォルダ」機能が有効です:

-

(1). 「vagrant up」で「仮想マシン」を立ち上げるときのメッセージより抜粋:

「Guest Additions」のバージョンの確認後に、下記のメッセージが表示:

==> default: Mounting shared folders...
    default: /vagrant => /home/ubn/ダウンロード/vm/ubn2204

「作業フォルダ」が「仮想マシン」に共有フォルダ「/vagrant」としてマウントされました:

-

(2). VirtualBox マネージャを起動:

→画面下の「共有フォルダー」に、「共有フォルダ」の設定が 1つ登録されています:

-

(3). 「共有フォルダー」をクリックして、設定を確認:

→「共有フォルダ」が自動で登録されたというよりも、

「共有フォルダ」が登録されているイメージが「Box」として作成されたのかも?

-


3). 上記の「項番 (3).」の設定を参考に、 VirtualBox マネージャで 「共有フォルダー」を登録:

登録する作業フォルダ名: 「~/ダウンロード/vm/fedora39/」

-

ここで「ubn」はユーザ名です

デスクトップを日本語化していない場合は、「/home/ubn/Downloads/vm/fedora39/」

-

(1). VirtualBox マネージャを起動:

-

(2). 左で、仮想マシンの「fedora39_default_1708264072018_31208」を選択:

-

(3). 右下の「共有フォルダー」の文字をクリック

「マシンフォルダー」の文字だけが表示されています:

-

(4). 右の水色の「+」(追加)アイコンをクリック

-

(5). 「共有フォルダーの追加」画面が表示:

フォルダーのパス: ホストOS の「~/ダウンロード/vm/fedora39/」を選択

右の「▼」アイコンをクリック→「その他」→「ダウンロード」→「vm」→「fedora39」→右上の「開く」

-

フォルダー名: fedora39 →「vagrant

マウントポイント: 「/vagrant

「自動マウント」にチェック

-

→「OK」

-


4). VirtualBox マネージャを右上の「x」で閉じました:

-


5). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up

-


6). 「仮想マシン」に ssh 接続:

$ vagrant ssh
Last login: Fri Feb 23 11:34:36 2024 from 10.0.2.2
[vagrant@vagrant ~]$ ls

-


7). 「仮想マシン」に共有のための「/vagrant」フォルダを作成:

[vagrant@vagrant ~]$ sudo mkdir -p /vagrant
[vagrant@vagrant ~]$ ls -1A / | grep v
dev
srv
vagrant
var

-


8). 「仮想マシン」の電源オフ:

-

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/fedora39$ 

-

ubn@ubn-box:~/ダウンロード/vm/fedora39$ vagrant halt
==> default: Attempting graceful shutdown of VM...

-


9). ホストOS を再起動:

「端末」以外のウィンドウを閉じてから、

$ reboot

-


10). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/fedora39/
$ vagrant up

-


11). テスト用のファイルを作成:

[vagrant@vagrant ~]$ sudo touch /vagrant/test.txt
[vagrant@vagrant ~]$ ls -1A /vagrant
test.txt
ここで、「共有フォルダ」を色々といじっていたら、「作業フォルダ」内のファイルが飛んでしまいました:

おかげで(今まで行った設定は水の泡になり)、「仮想マシン」を作り直すしか手段がなくなりました:

→「共有フォルダ」は直接「作業フォルダ」を指定せず、その「サブフォルダ」を指定するのが安全です:

-

Vagrant を使うと「仮想マシン」の復旧は楽になりますが、「Vagrant の管理用ファイル」は対象外なので、それも考えておくべきです:

→「管理用ファイル」(「作業フォルダ」配下のファイル)が消えると、「仮想マシン」が Vagrant で管理できなくなります。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- -----

16. 今回の作業(投稿)で気づいたこと:

-

ホストOS 側に「Vagrant」をインストールしたとき、

VirtualBox」で使うなら、すぐに「vagrant-vbguest」プラグインをインストールしておくべきでした:

-


1). vagrant-vbguest プラグインのインストール:

$ vagrant plugin install vagrant-vbguest

-


2). プラグインをインストールすると、「vagrant up」や「vagrant reload」時、及び「vagrant vbguest」実行時に

「Guest Additions」のバージョンをチェックして、 自動で「Guest Additions」のインストールが行われます

-


3). これまでの作業(投稿)での問題点は、「プラグイン」をインストールしていれば楽に解消された(もしくは、気付かなかった?)かもしれません。

つまり、(デスクトップ使用であれば)簡単に「クリップボードの共有」機能などが動いたかも。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----- ----- -

17. 参考: 後始末:

-

確認作業が完了したので、ディスクの空きを増やすため、不要になった「Box」を削除しました:

-


1). 不要な「仮想マシン」の削除:

確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
408fb2f  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39        
a5fdb3e  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-test   
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base   

-

削除1:

$ vagrant destroy 408fb2f
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

-

削除2:

$ vagrant destroy a5fdb3e
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

-

確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
62a436d  default virtualbox poweroff /home/ubn/ダウンロード/vm/fedora39-base   

-


2). 不要な「Box」の削除:

確認:

$ vagrant box list
Endeav-base3  (virtualbox, 0)
fedora39-0224 (virtualbox, 0)
fedora39-0225 (virtualbox, 0)

-

削除:

$ vagrant box remove fedora39-0224
Removing box 'fedora39-0224' (v0) with provider 'virtualbox'...

-

確認:

$ vagrant box list
Endeav-base3  (virtualbox, 0)
fedora39-0225 (virtualbox, 0)

-


3). 不要な「作業フォルダ」の削除:

作業フォルダ名の確認:

$ ls -1 ~/ダウンロード/vm/
:
box-share
endeavour-base
endeavour-base-jp
endeavour-base2
endeavour-base3
endeavour-openbox
fedora39
fedora39-base
fedora39-test
ubn2204

-

削除1:

$ rm -r ~/ダウンロード/vm/endeavour-base2

-

削除2:

$ rm -r ~/ダウンロード/vm/fedora39

-

削除3:

$ rm -r ~/ダウンロード/vm/fedora39-test

-

確認:

$ ls -1 ~/ダウンロード/vm/
:
box-share
endeavour-base
endeavour-base-jp
endeavour-base3
endeavour-openbox
fedora39-base
ubn2204

-


4). 不要な「Box」イメージの削除:

確認:

$ ls -1 ~/ダウンロード/vm/box-share
:
pkg-EndeavourOS_base-inst.box
pkg-EndeavourOS_base3.box
pkg-fedora39_2024-0224.box
pkg-fedora39_2024-0225.box

削除:

$ rm -r ~/ダウンロード/vm/box-share/pkg-fedora39_2024-0224.box

-

確認1:

$ ls -1 ~/ダウンロード/vm/box-share
:
pkg-EndeavourOS_base-inst.box
pkg-EndeavourOS_base3.box
pkg-fedora39_2024-0225.box

-

確認2:

$ ls -1 ~/ダウンロード/vm/
:
box-share
endeavour-base
endeavour-base-jp
endeavour-base3
endeavour-openbox
fedora39-base
ubn2204

→その都度消さずに、しばらく間を置いたのでどれが不要なのかわかりづらくなりました。

-

-


まとめ

今回は、最新にした「VirtualBox 7.0.14」と「Vagrant 2.4.1」の環境で、公式「Box」に登録された「generic/fedora39」をインストールしました。

個人的に(Vagrant で)使うには補完したいところがあって勉強になりました。

-

公式「Box」での推奨は、ベースとなる最小限の「Box」と思うので、どこまで手を加えるかは(サイズを抑えたい人もいるので)難しいところ。

基本のルール(慣習)?は必要だろうけど、手を加えたのが「余計なこと」なのか、「有り難いこと」なのかは、使う人次第。

好みで選べば良いだけですが、一度インストールして使ってみないとわかりません。
作り込み方は、ひとつ試してみるとわかるので、自分好みの「Box」の作り込み方をする「登録者」を見つけるのが良さそう。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

Vagrant 実践編7: 「EndeavourOS」(Openbox) の「Box」を作り直し〈H170-10〉

登録日: 2024-02-14 更新日: 2024-03-14

Xubuntu 22.04.3 LTS」、および「Windows11」の「VirtualBox 7.0.14」にて、仮想マシンの管理に「Vagrant」(ベイグラント) というツールを使えるようにしました。

-

実践編5 の投稿で、以前に作成したデスクトップなしの「Box」(Endeav-base-jp) を使って、コミュニティ版の「OpenBox」を追加インストールしました。

-

その作業の中で、「クリップボードの共有」機能が使える「仮想マシン」が(何とか)できました。

再び設定できるかわからないので、余計なファイルを除いて、「Box」(Endeav-base3) を作成し直しました。 サイズが大きすぎるのが難点かな。

その備忘録です。

-

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

前回の作業:

Vagrant 実践編5: 「EndeavourOS」の「Box」で、「OpenBox」をインストール〈H170-6〉

-

今回の作業:

  1. 「EndeavourOS」の「Box」の作成準備:

  2.  すぐに「仮想マシン」から「Box」を作成:

  3. 「vagrant」ユーザで、「Openbox」デスクトップ環境を設定:

  4.  GUI で使う「mine」ユーザを削除:

  5. 「仮想マシン」のメモリを「2048 MB」に設定:

  6.  Vagrant で管理された「仮想マシン」から「Box」を作成:

  7.  作業で使用した「仮想マシン」等を削除:

-

Vagrant」での参考:

  1. 「Vagrant」コマンドについて:

  2. 「Vagrant」コマンドの使用例:

  3. 「Vagrant」コマンドの使用例:(目次)

  4.  修正版3: 使い回し可能な「Vagrantfile」:

  5.  もし、PC のディスクに余裕がない場合:

  6. 「ssh 接続」で使うテキストエディタ「nano」:

  7. 「ssh 接続」時、または日本語化されていない「vagrant」で、日本語化できるファイルを準備:

  8. 「仮想マシン」の立ち上げや、電源オフ時に ssh の警告が表示される件の回避:

-

「EndeavourOS」での参考:

  1.  ミラーの更新:

  2. 「Welcome」画面に、「個人用コマンド」(Personal Commands) タブを追加:

  3. 「仮想マシン」にて、「GuestAdditions」を再インストール:

  4. 「仮想マシン」にて、ログイン時の「エラー通知」の解消、および、「クリップボード共有」機能が改善:

  5. 「eos-packagelist」で使える「デスクトップ」環境の一覧:

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

Vagrant で「EndeavourOS」の「仮想マシン」を立ち上げ:

-

追加インストールした「OpenBox」の「デスクトップ環境」:

→「EndeavourOS」のデスクトップなしの「Box」を利用して、「OpenBox」を追加後、 日本語化しました

-

参考:

VirtualBox」の「クリップボードの共有」機能が使えるかは、「Box」の作成前に、「仮想マシン」でちゃんと「GuestAdditions」のインストールがうまく行ったかが鍵です:

-

→ログイン後、デスクトップの右下に、下記の表示があると失敗してます:

VBoxClient: the VirtualBox kernel service is not running. Exiting.

-

また、「こちらの表示」で成功したかが確認できます:

-

-


現在のバージョンを表示:

-

ホストOS : 「Xubuntu 22.04.3 LTS」

2024-02-14 現在

カーネル:

$ uname -r
5.15.0-94-generic

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

→「22.04.3」にアップしています。

-

-

ゲストOS : 「EndeavourOS」

2024-02-14 現在

カーネル:

$ uname -r
6.7.3-arch1-2

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID="EndeavourOS"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="EndeavourOS Linux"
DISTRIB_CODENAME="rolling"
$ cat /etc/os-release
:
NAME="EndeavourOS"
PRETTY_NAME="EndeavourOS"
ID="endeavouros"
ID_LIKE="arch"
BUILD_ID="2023.11.17"             ←(注目)
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://endeavouros.com"
DOCUMENTATION_URL="https://discovery.endeavouros.com"
SUPPORT_URL="https://forum.endeavouros.com"
BUG_REPORT_URL="https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports"
PRIVACY_POLICY_URL="https://endeavouros.com/privacy-policy-2"
LOGO="endeavouros"

→注目: インストール時に使用したイメージの作成日付だったり、 「BUILD_ID=rolling」の表示だったりします。

-

「Welcome」のバージョン:

$ eos-welcome --version
:
24.3-1

→バージョン表示にて、「ログの登録」の行が表示される場合は「こちら 」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

(前回の作業):

-

Vagrant 実践編5: 「EndeavourOS」の「Box」で、「OpenBox」をインストール〈H170-6〉

-

-

(その続き):

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

1. 「EndeavourOS」の「Box」の作成準備:

-

前回、「クリップボードの共有」機能と、「リアルタイムの自動解像度の調整」が使える「仮想マシン」が作成できました。

-

ただし、(カーネルの更新とタイミングが合う必要がありそうなので、)確実にその設定ができるかわかりません。

なので、その「仮想マシン」から(余計な部分を除き、)「Box」を作成し直しました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

1-1. 「Virtualbox」で、「仮想マシン」のクローンを作成:

-

まずは、「クリップボードの共有」機能が動作する「仮想マシン」を保存するために、クローンを作成しました:

-

Virtualbox」マネージャを起動して、「仮想マシン」を右クリック→「クローンの作成」

作成したクローンの「仮想マシン」が動作するか確認:

こちらは使用せずに、保存しておくつもり。

-

VirtualBox にて、「仮想マシン」の名前(フォルダ名)を確認:

$ ls -1 ~/'VirtualBox VMs'/
endeavour-base-jp_default_1706478454111_19314  ←「Vagrant」の原本
endeavour-base-jp_mine                         ←クローン: 保存用 ★

→「★」は、クローンしたので「Vagrant」で管理されていません:

-

以降の作業は、上記の原本の「endeavour-base-jp_default_1706478454111_19314」を使いました:

→ところが、色々試していたら、動くけど不具合が出て、「Box」の作成に向かなくなりました。

-

すぐにクローンを作成して保存したのは正解でした:
ただし、実際の作業は「Box」を作成して、それで作業すべきでした:

-

ちなみに、クローンした(「Vagrant」で管理されない)「仮想マシン」から(仮想マシン名で)「Box」を作成した場合:

設定していた ssh の認証キーが梱包されず、「仮想マシン」の立ち上げ時と電源オフ時に、ssh 関連の警告メッセージが表示されます。

-

警告メッセージの解消には、ssh の設定をやり直して、(「Vagrant」で管理されている)「仮想マシン」を「id」指定で「Box」を作成すれば、ssh の認証キーが梱包されます。

→ 2度手間だし、使われるディスクサイズも倍です。

そして、ひとつの「仮想マシン」で 25 GB ほど。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

1-2. 参考: 余計な「仮想マシン」と「Box」を削除:

-

ホストOS のディスクの空きが少なくて「Box」の作成時に失敗したので、空きを増やしました:

-

1). 「VirtualBox」マネージャにて、「仮想マシン」を確認:

→下 2つの「仮想マシン」は削除するつもり

-

2). コマンドで、「仮想マシン」を確認:

$ ls -1Ap ~/'VirtualBox VMs'
endeavour-base-jp_2/
endeavour-base-jp_mine/
endeavour-base2_default_1707740696453_91326/

→原本をクローンした「endeavour-base-jp_mine」のみ残して、それ以外はすべて削除のつもり:

-

3). 「仮想マシン」の確認:

$ vagrant global-status
id       name    provider   state   directory
------------------------------------------------------------------------
32de53b  default virtualbox running /home/ubn/ダウンロード/vm/endeavour-base2 
:

→「vagrant」で管理されているのは、ひとつ

-

4). ホームに登録された「Box」:

$ vagrant box list
Endeav-base-jp (virtualbox, 0)
Endeav-base2   (virtualbox, 0)

→こちらの 2つも削除するつもり

-

5). 「vagrant」で管理されている「仮想マシン」の状態:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant status
Current machine states:

default                   poweroff (virtualbox)

The VM is powered off. To restart the VM, simply run `vagrant up`

-

6). 「仮想マシン」の削除:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

-

7). 「仮想マシン」の確認:

$ ls -1Ap ~/'VirtualBox VMs'
endeavour-base-jp_2/
endeavour-base-jp_mine/

-

8). 「endeavour-base-jp_2」は、Vagrant で管理されていないので、「VirtualBox」マネージャにて削除:

仮想マシン」を右クリック→「除去」→「すべてのファイルを削除」で削除:

-

9). 「仮想マシン」の確認:

$ ls -1Ap ~/'VirtualBox VMs'
endeavour-base-jp_mine/

→これだけ残しました。

-

10). 「Box」の確認:

$ vagrant box list
Endeav-base2 (virtualbox, 0)

-

11). 「Box」の削除:

$ vagrant box remove Endeav-base2
Removing box 'Endeav-base2' (v0) with provider 'virtualbox'...

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

1-3. 現在の「仮想マシン」の状態を確認:

-

1). 「Box」の確認:

$ vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.

→すべてなし

-

2). 「仮想マシン」の確認:

$ vagrant global-status
id       name   provider state  directory
--------------------------------------------------------------------
There are no active Vagrant environments on this computer! Or,
you haven't destroyed and recreated Vagrant environments that were
started with an older version of Vagrant.

→すべてなし

-

3). 「仮想マシン」の確認:

→「仮想マシン」は 1つ

-

4). 「仮想マシン」を起動して確認:

-

ログイン画面:

→ユーザが 2つ

-

(1).「vagrant」ユーザでログインした場合:

→デスクトップを追加しただけだと、パネルが重複していました。

vagrant」ユーザは「ssh 接続」で使うので、GUI 側の修正はしてません。

-

クリップボードの共有」機能、「共有フォルダ」機能、「リアルタイムの自動解像度の調整」が使えます。

-

(2). GUI で使うために、追加した「mine」ユーザでログインした場合:

→パネルの重複を解消して、日本語化と日本語入力の設定をしました。

-

クリップボードの共有」機能、「共有フォルダ」機能、「リアルタイムの自動解像度の調整」が使えます。

-

せっかく設定しましたが、「Box」の公開を考えた場合はイメージサイズを小さくするために、「vagrant」ユーザのみにするつもり。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

2. 何もせずに、すぐに「仮想マシン」から「Box」を作成:

-

まずは、「仮想マシン」を「Vagrant」で管理される状態にします:

-

参考:

Vagrant 実践編2: 既存の「EndeavourOS」(Openbox) から「Box」を作成〈H170-3〉

-

参考:

クローンした(「Vagrant」で管理されない)「仮想マシン」から(仮想マシン名で)「Box」を作成した場合:

ssh の認証キーを設定していても、それは「Box」に梱包されないので、
仮想マシン」を立ち上げたり、電源オフした時に、ssh 関連の警告メッセージが表示されます。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

2-1. 「仮想マシン」から「Box」を作成:

-

1). VirtualBox にて、「仮想マシン」の名前(フォルダ名)を確認:

$ ls -1 ~/'VirtualBox VMs'/
endeavour-base-jp_mine         ←原本のクローン: 保存用

-

→「仮想マシン」の「endeavour-base-jp_mine」から「Box」を作成します:

-


2). 「.box」ファイルを作成したい場所を準備:

すでに作成済みです:

$ mkdir -p ~/ダウンロード/vm/box-share/

-


3). 「.box」ファイルを作成する場所に移動:

$ cd ~/ダウンロード/vm/box-share/

-

$ ls -lA
-rw-rw-r-- 1 ubn ubn 2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box

→上記は、EndeavourOS (デスクトップなし)をインストールした直後に作成(保存)した「Box」です

「EndeavourOS」の最小構成で、3 GB ほどです

-


4). 「.box」ファイルを作成:

$ vagrant package --base endeavour-base-jp_mine --output pkg-EndeavourOS_base2.box

「endeavour-base-jp_mine」は、「virtualbox」での「仮想マシン」名です。 これからベースとなる「Box」ファイルが作成されます。

==> endeavour-base-jp_mine: Clearing any previously set forwarded ports...
==> endeavour-base-jp_mine: Exporting VM...

↓ 時間がかかりました:

==> endeavour-base-jp_mine: Compressing package to: /home/ubn/ダウンロード/vm/box-share/pkg-EndeavourOS_base2.box

↓ 時間がかかりました:

ubn@ubn-box:~/ダウンロード/vm/box-share$ 

→プロンプトに戻りました。

-


5). 作成された「.box」ファイルを確認:

$ cd ~/ダウンロード/vm/box-share/
$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10104176322  2月 14 01:29 pkg-EndeavourOS_base2.box ←(追加)

→作業フォルダに、「pkg-EndeavourOS_base2.box」ファイルが作成されました:

サイズは、「10 GB」ほど

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

2-2. 作成された「Box」ファイルを「Box」の一覧に追加:

-


1). 作成された「Box」ファイルをホームの「Box」一覧に追加:

$ cd ~/ダウンロード/vm/box-share/

-

$ vagrant box add --name Endeav-base2 pkg-EndeavourOS_base2.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'Endeav-base2' (v0) for provider: 
    box: Unpacking necessary files from: file:///home/ubn/%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89/vm/box-share/pkg-EndeavourOS_base2.box

↓ ファイルを解凍中: カウントUP

==> box: Successfully added box 'Endeav-base2' (v0) for ''!
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

プロンプトに戻りました。

-


2). 「Box」の一覧に追加されたか確認:

$ vagrant box list
Endeav-base2   (virtualbox, 0)            ←(追加)

-


3). 参考: ホームの「Box」の一覧にあるファイルを確認:

$ ls -lA ~/.vagrant.d/boxes/Endeav-base2/0/virtualbox
-rw-rw-r-- 1 ubn ubn         505  2月 14 05:15 Vagrantfile
-rw-rw-r-- 1 ubn ubn 10195222528  2月 14 05:18 box-disk001.vmdk
-rwx------ 1 ubn ubn        9169  2月 14 05:18 box.ovf
-rw-rw-r-- 1 ubn ubn          25  2月 14 05:18 metadata.json

→「ssh の認証キー」である「vagrant_private_key」がありません

-

参考: ホームにある「Vagrantfile」の内容を確認:
$ cat ~/.vagrant.d/boxes/Endeav-base2/0/virtualbox/Vagrantfile
Vagrant::Config.run do |config|
  # This Vagrantfile is auto-generated by `vagrant package` to contain
  # the MAC address of the box. Custom configuration should be placed in
  # the actual `Vagrantfile` in this box.
  config.vm.base_mac = "080027B2BB06"
end

# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

→次々に組み込まれる(上書きされる)基本の「Vagrantfile」ファイルです:

こちらでは、「仮想マシン」のネット接続に必要な「Mac アドレス」が指定されています:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

2-3. 「Vagrantfile」の作成:

-

1). 「仮想マシン」を管理する「作業フォルダ」を準備:

別の「作業フォルダ」を準備:

$ mkdir -p ~/ダウンロード/vm/endeavour-base2/

→「仮想マシン」を管理する場所になります

-

「作業フォルダ」は使い回すのでなく、新しい名前で作成した方が混乱しないと思います。

-


2). 「Vagrantfile」の作成:

$ cd ~/ダウンロード/vm/endeavour-base2/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "Endeav-base2"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

→メモリ「2048」MB に、ディスプレイを 「vmsvga」に修正しました

→Crtl+O で、保存

→Ctrl+X で、終了

-

参考:「config.vm.box = "Endeav-base2"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

追記: GUI(デスクトップ環境)を使う場合の設定(修正版):
(1).「Ubuntu」の場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]」の行を有効にすると、
ウィンドウサイズの拡大で、リアルタイムに解像度が調整されます。

-

(2).「EndeavourOS」で、リアルタイムに解像度が調整される場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]」の行を有効にすると、
ウィンドウサイズの拡大で、リアルタイムに解像度が調整されます。

-

(3).「EndeavourOS」で、リアルタイムに解像度が調整されない場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]」の行を有効にすると、
ログアウト直前の解像度に調整されます。つまり、仮対応と言えます。

-

リアルタイムに解像度が調整されない場合は、「GuestAdditions」のインストールで失敗している可能性があります:

→例えば、ログイン後、デスクトップ画面で、一瞬だけ下記の「エラー通知」が表示されるときは注意:

VBoxClient: the VirtualBox kernel service is not running. Exiting.

→回避策は、「GuestAdditions」の再インストールですが、 それでもダメなときは「こちら」を参照:

-


3). 作成されたか確認:

$ ls -1Ap
Vagrantfile         ←(注目)

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

2-4. 「仮想マシン」を(作成して)立ち上げ:

-


1). 「仮想マシン」を(作成して)立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base2/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'Endeav-base2'...
Progress: 20%

→初回のみ、カウントUP

==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: endeavour-base2_default_1707859316586_36421
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
認証失敗のリトライがループ:
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
(回避策でタイムアウトを設定:)強制停止で、赤色の警告表示:
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→プロンプトに戻りました

回避策でVagrantfile の 7行目でタイムアウトを短く設定していなければ、ループしてプロンプトに戻りません:

-

→「仮想マシン」の立ち上げ時に「ssh 関連の警告」が表示されました:

-

Vagrant で管理されていない「仮想マシン」から「Box」を作成したので、ssh 認証キーが.box に同梱されていないからと思います:

-

警告表示があると、それ以降のメッセージが確認できないのが難点です:

-


2). 登録された「Box」で確認:

$ ls -lA ~/.vagrant.d/boxes/Endeav-base2/0/virtualbox/
:
-rw-rw-r-- 1 ubn ubn         505  2月 14 05:15 Vagrantfile
-rw-rw-r-- 1 ubn ubn 10195222528  2月 14 05:18 box-disk001.vmdk
-rwx------ 1 ubn ubn        9169  2月 14 05:18 box.ovf
-rw-rw-r-- 1 ubn ubn          25  2月 14 05:18 metadata.json

→「vagrant_private_key」ファイルがありません

-


3). 「vagrant ssh-config」の確認:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/.vagrant.d/insecure_private_keys/vagrant.key.ed25519
  IdentityFile /home/ubn/.vagrant.d/insecure_private_keys/vagrant.key.rsa
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

ssh 認証のための(vagrant 共通で使われるキー)が 2行あります

-

指定されている「認証キー」があるか確認:
$ ls -lA /home/ubn/.vagrant.d/insecure_private_keys/
:
-rw------- 1 ubn ubn  411 11月 18 18:31 vagrant.key.ed25519
-rw------- 1 ubn ubn 1675 11月 18 18:31 vagrant.key.rsa

-


4). 「vagrant ssh」で、ssh 接続:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant ssh
vagrant@127.0.0.1's password: 
Last login: Mon Feb  5 13:47:21 2024 from 10.0.2.2
[vagrant@vagrant ~]$

-

[vagrant@vagrant ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

→英語名のフォルダが作成されています

-

[vagrant@vagrant ~]$ sudo date
2024年  2月 14日 水曜日 06:37:25 JST

→パスワードなしで「sudo」が使えます

-

隠しファイルを表示:
[vagrant@vagrant ~]$ ls -1Ap
:
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache/
.config/
Desktop/
.dmrc
Documents/
Downloads/
.gtkrc-2.0
.local/
.mozilla/
Music/
Pictures/
Public/
.ssh/
Templates/
.themes/
.vboxclient-clipboard-tty7-control.pid   ←(クリップボードの共有が使えてます)
.vboxclient-draganddrop-tty7-control.pid
.vboxclient-hostversion-tty7-control.pid
.vboxclient-seamless-tty7-control.pid
.vboxclient-vmsvga-session-tty7-control.pid
Videos/
.Xauthority
.xsession-errors
.xsession-errors.old

-

[vagrant@vagrant ~]$ ls /home/vagrant/.ssh/
authorized_keys

→キーはあるけど、更新が必要みたい

-


5). 「ssh 接続」の終了:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→ホストOS のプロンプトに戻りました

-


6). 「仮想マシン」の状態の確認:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

→「仮想マシン」の「default」が実行中

-

$ vagrant global-status
id       name    provider   state   directory                           
------------------------------------------------------------------------
93eef7c  default virtualbox running /home/ubn/ダウンロード/vm/endeavour-base2 
 
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

→「id」と「作業フォルダのパス」がわかります

こちらでも「実行中」がわかりますが、キャッシュなので不確かです

-


7). 「仮想マシン」の電源オフ:

id を指定しない場合は、作業フォルダに移動します:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: Guest communication could not be established! This is usually because
    default: SSH is not running, the authentication information was changed,
    default: or some other networking issue. Vagrant will force halt, if
    default: capable.
==> default: Forcing shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→「仮想マシン」の電源オフ時に「ssh 関連の警告」が表示されました:

-


8). ホストOS を再起動:

「共有フォルダ」機能を有効にします:

-

ホストOS で、「端末」以外のウィンドウを閉じてから、

$ reboot

-


9). ホストOS が立ち上がったら、「VirtualBox」マネージャを起動して確認:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

3. 「vagrant」ユーザで、「Openbox」デスクトップ環境を設定:

-

GUI で使う「mine」ユーザの削除を行うので、「vagrant」ユーザで GUI を使えるように設定:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

3-1. 「仮想マシン」を立ち上げて、ssh 接続で「vagrant」ユーザにアクセス:

-


1). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base2/
$ vagrant up

→プロンプトが返るまで待ちます

-


2). 「ssh 接続」:

$ vagrant ssh
vagrant@127.0.0.1's password: 

→パスワードに「vagrant」を入力

Last login: Mon Feb 12 21:48:07 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

→プロンプトが変わりました

-

3). id 確認:

[vagrant@vagrant ~]$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----

3-2. 「Openbox」デスクトップ環境について:

-

1). 「クリップボードの共有」機能と、「リアルタイムの自動解像度の調整」が使えます:

-

2). 日本語キーボード

-

3). AUR ヘルパーは「paru」に変更:

-

4). アプリ:

Web ブラウザは、「ESR 版 firefox」(日本語版):

テキストエディタは、「xed」と「featherpad」:

-

5). 日本語フォント:

下記がインストールされています:

(noto-fonts、noto-fonts-cjk、noto-fonts-emoji、noto-fonts-extra)

-

[vagrant@vagrant ~]$ paru -Ss noto | grep Install
extra/noto-fonts 1:24.2.1-1 [0 B 108.42 MiB] [Installed]
extra/noto-fonts-cjk 20230817-1 [0 B 298.08 MiB] [Installed]
extra/noto-fonts-emoji 1:2.042-1 [0 B 10.11 MiB] [Installed]
extra/noto-fonts-extra 1:24.2.1-1 [0 B 318.79 MiB] [Installed]

-

[vagrant@vagrant ~]$ paru -Ss fonts | grep Install
extra/adobe-source-code-pro-fonts 2.042u+1.062i+1.026vf-1 [0 B 1.86 MiB] [Installed]
extra/cantarell-fonts 1:0.303.1-1 [0 B 189.66 KiB] [Installed]
extra/noto-fonts 1:24.2.1-1 [0 B 108.42 MiB] [Installed]
extra/noto-fonts-cjk 20230817-1 [0 B 298.08 MiB] [Installed]
extra/noto-fonts-emoji 1:2.042-1 [0 B 10.11 MiB] [Installed]
extra/noto-fonts-extra 1:24.2.1-1 [0 B 318.79 MiB] [Installed]
extra/ttf-bitstream-vera 1.10-15 [0 B 570.63 KiB] [Installed]
extra/ttf-dejavu 2.37+18+g9b5d1b2f-6 [0 B 9.79 MiB] [Installed]
extra/ttf-nerd-fonts-symbols 3.1.1-1 [0 B 1.82 MiB] [Installed] (nerd-fonts)
extra/ttf-nerd-fonts-symbols-common 3.1.1-1 [0 B 48.45 KiB] [Installed]
extra/xorg-fonts-encodings 1.0.7-1 [568.71 KiB 628.47 KiB] [Installed] (xorg-fonts xorg)
extra/xorg-mkfontscale 1.2.2-1 [0 B 47.67 KiB] [Installed] (xorg-apps xorg)
    Installs all the soundfont packages in the AUR

→「adobe-source-code-pro-fonts」は追加でインストールしていますが、

イメージのサイズを小さくするなら、アンインストール

-

6). 「vagrant」側は、日本語化していません:

[vagrant@vagrant ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

-

7). 日本語入力は「ibus-anthy」と「ibus-mozc」をインストールしていますが、「vagrant」側は使える設定にしていません:

[vagrant@vagrant ~]$ paru -Ss ibus | grep Install | grep ibus-
extra/ibus-anthy 1.5.15-1 [0 B 9.09 MiB] [Installed]
aur/ibus-mozc 2.29.5374.102-1 [+16 ~0.02] [Installed: 2.29.5346.102-2]

→イメージのサイズを小さくするなら、「ibus-mozc」をアンインストール

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -----

3-3. 参考:「ssh 接続」時、または日本語化されていない「vagrant」で、日本語化できるファイルを準備:

-

デスクトップを日本語化しなくても、「ssh 接続」時に日本語化できます:

-

1). 作成:

[vagrant@vagrant ~]$ nano /home/vagrant/.jp
export LANG=ja_JP.UTF-8

→Ctrl+O で保存
→Ctrl+X で終了

-

2). 「ssh 接続」時に日本語表示したいときに実行:

[vagrant@vagrant ~]$ source .jp

→ピリオド「.」があるので注意:

-

3). ロケールが変更されます:

[vagrant@vagrant ~]$ locale
LANG=ja_JP.UTF-8          ←(注目)
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC=ja_JP.UTF-8
LC_TIME=ja_JP.UTF-8
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY=ja_JP.UTF-8
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER=ja_JP.UTF-8
LC_NAME=ja_JP.UTF-8
LC_ADDRESS=ja_JP.UTF-8
LC_TELEPHONE=ja_JP.UTF-8
LC_MEASUREMENT=ja_JP.UTF-8
LC_IDENTIFICATION=ja_JP.UTF-8
LC_ALL=

-

4). 実行後の使用例:

-

例1:
[vagrant@vagrant ~]$ pacman -Ss paru
endeavouros/paru 2.0.1-1 [インストール済み]
    Feature packed AUR helper

→「Installed」の部分が日本語表示になりました

-

例2:

デスクトップで Windows+Enter で「端末」を起動して、

[vagrant@vagrant ~]$ featherpad

→「featherpad」が日本語で起動されます:

設定が楽にできます

-

5). 参考: ログアウトすると日本語化は解除されます:

[vagrant@vagrant ~]$ exit
ログアウト
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- -

3-4. 「vagrant」ユーザで、「Openbox」デスクトップ環境を設定:

-

1). デスクトップ周りの設定の手順は、下記を参照:

〈H170-6〉デスクトップ周りの設定:

-

2). 作業フォルダは、

$ cd ~/ダウンロード/vm/endeavour-base-jp/

でなく、

$ cd ~/ダウンロード/vm/endeavour-base2/

に置き換えてください

-

3). 「mine」ユーザでなく、「vagrant」ユーザに対して同じ設定をします

-

4). 「アプリ」の設定は、「vagrant」ユーザにログインして、アプリを起動して設定します

「↑」「↓」キーで「vagrant」ユーザを選んで、パスワードは「vagrant」を入力します。

-

5). 「端末」でのプロンプト:

[vagrant@vagrant ~]$ 

-

6). 「featherpad」の設定時:

[vagrant@vagrant ~]$ source .jp

→ピリオド「.」があるので注意:

-

[vagrant@vagrant ~]$ featherpad

→日本語で設定できます

-

7). 設定が完了:

→パネルの表示が正常です

-

8). 設定が終わったら、「仮想マシン」を再起動:

[vagrant@vagrant ~]$ sudo reboot
Broadcast message from root@vagrant on pts/2 (Wed 2024-02-14 09:54:23 JST):

The system will reboot now!

[vagrant@vagrant ~]$ Connection to 127.0.0.1 closed by remote host.
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→「ssh 接続」は解除されて、ホストOS のプロンプトに戻ります:

-

9). 「仮想マシン」は再起動されるので、ログイン画面が表示されるまで待ちます:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- --

4. GUI で使う「mine」ユーザを削除:

-

「Box」を公開する場合を考え、余計なものを削除して、「vagrant」ユーザのみにしました:

-


1). ssh 接続して、操作:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vgrant ssh
vagrant@127.0.0.1's password: 
Last login: Wed Feb 14 08:09:45 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

→パスワードは「vagrant」を入力

-


2). 「home」の確認:

[vagrant@vagrant ~]$ ls -lAp /home/
drwx------ 16 mine    mine    4096  2月 13 19:06 mine/
drwx------ 16 vagrant vagrant 4096  2月 14 10:21 vagrant/

-


3). 「mine」ユーザの確認:

[vagrant@vagrant ~]$ id mine
uid=1001(mine) gid=1001(mine) groups=1001(mine),3(sys),998(wheel),981(rfkill)

→ユーザを追加するときの参考にすると良いです

-

[vagrant@vagrant ~]$ sudo ls -lAp /home/mine
drwx------  3 mine mine 4096  2月 13 19:06 .anthy/
-rw-------  1 mine mine 5411  2月 13 19:05 .bash_history
-rw-r--r--  1 mine mine   21  1月 16 19:48 .bash_logout
-rw-r--r--  1 mine mine   58  1月 31 19:12 .bash_profile
-rwxr-xr-x  1 mine mine 2691 11月 17 20:33 .bashrc
drwx------ 12 mine mine 4096  2月  1 10:58 .cache/
drwxr-xr-x 18 mine mine 4096  2月  1 13:28 .config/
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Desktop/
-rw-r--r--  1 mine mine   26  1月 30 17:24 .dmrc
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Documents/
drwxr-xr-x  3 mine mine 4096  1月 30 16:50 Downloads/
-rw-r--r--  1 mine mine  575  1月 30 16:55 .gtkrc-2.0
drwx------  4 mine mine 4096  1月 30 17:37 .local/
drwx------  4 mine mine 4096  1月 31 15:34 .mozilla/
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Music/
drwxr-xr-x  2 mine mine 4096  1月 31 13:46 Pictures/
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Public/
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Templates/
drwxr-xr-x  3 mine mine 4096  1月 30 16:55 .themes/
-rw-r-----  1 mine mine    5  2月 13 19:04 .vboxclient-clipboard-tty7-control.pid
-rw-r-----  1 mine mine    5  2月  5 10:08 .vboxclient-display-svga-x11-tty7-control.pid
-rw-r-----  1 mine mine    5  2月 13 19:04 .vboxclient-draganddrop-tty7-control.pid
-rw-r-----  1 mine mine    5  2月 13 19:04 .vboxclient-hostversion-tty7-control.pid
-rw-r-----  1 mine mine    5  2月 13 19:04 .vboxclient-seamless-tty7-control.pid
-rw-r-----  1 mine mine    5  2月 13 19:04 .vboxclient-vmsvga-session-tty7-control.pid
drwxr-xr-x  2 mine mine 4096  1月 30 16:47 Videos/
-rw-------  1 mine mine    0  2月 13 19:06 .Xauthority
-rw-r--r--  1 mine mine  103  2月  1 10:43 .xprofile
-rw-------  1 mine mine 8426  2月 13 19:06 .xsession-errors
-rw-------  1 mine mine 8597  2月 13 19:02 .xsession-errors.old

-


4). 「mine」ユーザを削除:

削除対象のユーザがログインしている場合削除出来ません:

[vagrant@vagrant ~]$ sudo userdel -r mine
userdel: mine mail spool (/var/spool/mail/mine) not found

→「-r」は、ユーザ削除と同時に、ユーザの「ホーム」フォルダを削除します

-


5). 「mine」フォルダが削除されたことを確認:

[vagrant@vagrant ~]$ ls -lAp /home/
drwx------ 16 vagrant vagrant 4096  2月 14 10:21 vagrant/

→削除されました

-


6). 「仮想マシン」を再起動:

[vagrant@vagrant ~]$ sudo reboot

-


7). GUI の「ログイン」画面が表示:

→「mine」が表示されず、「vagrant」ユーザだけが表示されるかを確認:

-

vagrant」ユーザでログイン

→パスワードは「vagrant」を入力

-


8). デスクトップ画面が表示:

Window+Enter で「端末」を起動して、ホストOS のエディタやブラウザ間で、

クリップボードの共有」機能が使えるか確認:

右クリック→「C」で、コピー

マウスの中央ボタンで、貼付け

または、右クリック→「V」で、貼付け

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ---

5. 参考:「仮想マシン」の立ち上げや、電源オフ時に ssh の警告が表示される件の回避:

-

こちらの作業は実施しなくても問題ありません:

本来は、「認証失敗」でリトライしっ放しでループします。
こちらは回避策で「Vagrantfile」の7行目でタイムアウトするように設定したので、警告が表示される だけです。

-

Vagrant で管理されていない、「VirtualBox」の通常の「仮想マシン」から「Box」を作成すると、ssh 認証キーが.box に同梱されません

Vagrant 用公開鍵認証キーの取得をやり直せば 解消します:
そして、Vagrant で管理している、id 指定で「Box」を作成すれば同梱されます

vagrant ssh-config」の認証キーのパス指定が 1行 であれば 、同梱されています。

-


1). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base2/
$ vagrant up

-


2). 「ssh 接続」:

$ cd ~/ダウンロード/vm/endeavour-base2/
$ vagrant ssh
vagrant@127.0.0.1's password: 
Last login: Mon Feb 12 21:48:07 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

-

3). Vagrant 用公開鍵認証キーの取得をやり直し:

$ mkdir -p /home/vagrant/.ssh
$ chmod 700 /home/vagrant/.ssh

$ cd /home/vagrant/.ssh 
$ curl -k -L -o authorized_keys 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
$ chmod 600 /home/vagrant/.ssh/authorized_keys
$ chown -R vagrant:vagrant /home/vagrant/.ssh

-


4). 「ssh 接続」の終了:

[vagrant@vagrant .ssh]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→ホストOS のプロンプトに戻りました

-

5). 「仮想マシン」の電源オフ:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

和訳:

==> default: 仮想マシン を正常にシャットダウンしようとしています...
    default: 
    default: Vagrant の安全でないキーが検出されました。 Vagrant は、セキュリティを
    default: 向上させるために、これを新しく生成されたキーペアに自動的に置き換えます。
    default: 
    default: 生成された公開キーをゲスト内に挿入しています...
    default: 安全でないキーが存在する場合はゲストから削除しています...
    default: キーが挿入されました!切断し、新しい SSH キーを使用して再接続しています...
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→「仮想マシン」の電源オフ時に、ssh の認証キーが「自動的に更新」されました:

これは Vagrant の機能で、この機能が働いたのは、「項番 3).」でわざと「安全でないキー」を設定したからです。通常であれば、ゲストOS でキーを生成してセットする必要があります。

-


6). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /home/ubn/ダウンロード/vm/endeavour-base2
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→「仮想マシン」の立ち上げ時の「警告表示」が解消:

「共有フォルダ」がマウントされました:

-


7). 「仮想マシン」の電源オフ(シャットダウン):

$ cd ~/ダウンロード/vm/endeavour-base2
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
==> default: Forcing shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/endeavour-base2$ 

→「仮想マシン」の電源オフ時の「警告表示」が解消:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----

6. 「仮想マシン」のメモリを「2048 MB」に設定:

-

「Box」を公開する場合を考え、「4096 MB」だと大きいので「2048 MB」に変更:

-


1). 「VirtualBox」マネージャの画面にて、

システム →メインメモリー

4096 MB →「2048 MB」に変更されていることを確認:

-


2). 変更した場合は、「仮想マシン」を起動して、正常に立ち上がるか確認:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- -----

7. Vagrant で管理された「仮想マシン」から「Box」を作成:

-

参考:

Vagrant 実践編2: 既存の「EndeavourOS」(Openbox) から「Box」を作成〈H170-3〉

-

1). VirtualBox にて、「仮想マシン」の名前(フォルダ名)を確認:

$ ls -1 ~/'VirtualBox VMs'/
endeavour-base-jp_mine     ←原本のクローン: 保存用
endeavour-base2_default_1707859316586_36421 ←(注目)

-

2). Vagrant にて、「仮想マシン」の名前(フォルダ名)を確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
93eef7c  default virtualbox poweroff /home/ubn/ダウンロード/vm/endeavour-base2 
:

→id は「93eef7c」です

-

→「仮想マシン」の「endeavour-base2_default_1707859316586_36421」から「Box」を作成します:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- -

7-1. 「仮想マシン」から「Box」を作成:

-

1). 「.box」ファイルを作成したい場所を準備:

すでに作成済みです:

$ mkdir -p ~/ダウンロード/vm/box-share/

-

2). 「.box」ファイルを作成する場所に移動:

$ cd ~/ダウンロード/vm/box-share/

-

$ ls -lA
:
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10104176322  2月 14 01:29 pkg-EndeavourOS_base2.box

-

3). 「.box」ファイルを作成:

$ vagrant package 93eef7c --output pkg-EndeavourOS_base3.box
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...

「93eef7c」は、「Vagrant」の仮想マシンの「id」です。 これからベースとなる「Box」ファイルが作成されます。

↓ 時間がかかりました

==> default: Compressing package to: /home/ubn/ダウンロード/vm/box-share/pkg-EndeavourOS_base3.box

「Box」の元となる仮想マシン名は「default」です。

↓ 時間がかかりました

ubn@ubn-box:~/ダウンロード/vm/box-share$ 

→プロンプトに戻りました。

-

4). 作成された「.box」ファイルを確認:

$ ls -lA
:
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10104176322  2月 14 01:29 pkg-EndeavourOS_base2.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box ←(注目)

→作業フォルダに、「pkg-EndeavourOS_base3.box」ファイルが作成されました:

サイズは、「10 GB」ほど

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- --

7-2. 作成された「Box」ファイルを「Box」の一覧に追加:

-

参考:

Vagrant 実践編2: 既存の「EndeavourOS」(Openbox) から「Box」を作成〈H170-3〉

-


1). できた「Box」ファイルをホームの「Box」一覧に追加:

$ cd ~/ダウンロード/vm/box-share/
$ vagrant box add --name Endeav-base3 pkg-EndeavourOS_base3.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'Endeav-base3' (v0) for provider: 
    box: Unpacking necessary files from: file:///home/ubn/%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89/vm/box-share/pkg-EndeavourOS_base3.box
Progress: 21% (Rate: 84.7M/s, Estimated time remaining: 0:01:00)

↓ ファイルを解凍中: カウントUP

==> box: Successfully added box 'Endeav-base3' (v0) for ''!
ubn@ubn-box:~/ダウンロード/vm/box-share$ 

プロンプトに戻りました。

-


2). 「Box」の一覧に追加されたか確認:

$ vagrant box list
Endeav-base2 (virtualbox, 0)
Endeav-base3 (virtualbox, 0)           ←(追加)

-


3). 参考: ホームの「Box」の一覧にあるファイルを確認:

$ ls -lA ~/.vagrant.d/boxes/Endeav-base3/0/virtualbox
-rw-rw-r-- 1 ubn ubn         630  2月 14 15:10 Vagrantfile
-rw-rw-r-- 1 ubn ubn 10172759552  2月 14 15:13 box-disk001.vmdk
-rwx------ 1 ubn ubn        9232  2月 14 15:13 box.ovf
-rw-rw-r-- 1 ubn ubn          25  2月 14 15:13 metadata.json
-rw------- 1 ubn ubn         400  2月 14 15:13 vagrant_private_key

→「vagrant_private_key」があります

-

参考: ホームにある「Vagrantfile」の内容を確認:
$ cat ~/.vagrant.d/boxes/Endeav-base3/0/virtualbox/Vagrantfile
Vagrant::Config.run do |config|
  # This Vagrantfile is auto-generated by `vagrant package` to contain
  # the MAC address of the box. Custom configuration should be placed in
  # the actual `Vagrantfile` in this box.
  config.vm.base_mac = "080027B2BB06"
end

# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
  config.ssh.private_key_path = File.expand_path("../vagrant_private_key", __FILE__)
end

→次々に組み込まれるベースとなる「Vagrantfile」ファイルです:

こちらで、「Mac アドレス」が指定されています:
また、「認証キー」の読み込みが追加されています:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ---

7-3. 「Vagrantfile」の作成:

-

1). 「仮想マシン」を管理する「作業フォルダ」を準備:

別の「作業フォルダ」を準備:

$ mkdir -p ~/ダウンロード/vm/endeavour-base3/

→「仮想マシン」を管理する場所になります

-

「作業フォルダ」は使い回すのでなく、新しい名前で作成した方が混乱しないと思います。

-


2). 「Vagrantfile」の作成:

$ cd ~/ダウンロード/vm/endeavour-base3/
$ nano Vagrantfile

↓ すべて貼付け:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "Endeav-base3"
  #config.vm.boot_timeout = 300
  config.vm.boot_timeout = 60
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
    vb.memory = "2048"
    #vb.memory = "4096"
    vb.cpus = 2
    #vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
end

→メモリ「2048」MB に、ディスプレイを 「vmsvga」に修正しました

→Crtl+O で、保存

→Crtl+X で、終了

-

参考:「config.vm.box = "Endeav-base3"」の行を変更すれば、他の「仮想マシン」でも使い回し出来ます:

-

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

追記: GUI(デスクトップ環境)を使う場合の設定(修正版):
(1).「Ubuntu」の場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]」の行を有効にすると、
ウィンドウサイズの拡大で、リアルタイムに解像度が調整されます。

-

(2).「EndeavourOS」で、リアルタイムに解像度が調整される場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]」の行を有効にすると、
ウィンドウサイズの拡大で、リアルタイムに解像度が調整されます。

-

(3).「EndeavourOS」で、リアルタイムに解像度が調整されない場合:

vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxsvga"]」の行を有効にすると、
ログアウト直前の解像度に調整されます。つまり、仮対応と言えます。

-

リアルタイムに解像度が調整されない場合は、「GuestAdditions」のインストールで失敗している可能性があります:

→例えば、ログイン後、デスクトップ画面で、一瞬だけ下記の「エラー通知」が表示されるときは注意:

VBoxClient: the VirtualBox kernel service is not running. Exiting.

→回避策は、「GuestAdditions」の再インストールですが、 それでもダメなときは「こちら」を参照:

-


3). 作成されたか確認:

$ ls -1Ap
Vagrantfile         ←(注目)

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- ----

7-4. 「仮想マシン」を(作成して)立ち上げ:

-


1). 「仮想マシン」を(作成して)立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base3/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'Endeav-base3'...
Progress: 10%

→カウントUP

==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: endeavour-base3_default_1707892565141_70097
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /home/ubn/ダウンロード/vm/endeavour-base3
ubn@ubn-box:~/ダウンロード/vm/endeavour-base3$ 

赤色の警告表示が解消:

→プロンプトに戻りました

-


2). 「vagrant ssh-config」の確認:

$ cd ~/ダウンロード/vm/endeavour-base3
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/ubn/.vagrant.d/boxes/Endeav-base3/0/virtualbox/vagrant_private_key
  IdentitiesOnly yes
  LogLevel FATAL
  PubkeyAcceptedKeyTypes +ssh-rsa
  HostKeyAlgorithms +ssh-rsa

ssh 認証キーの行が 1つになりました

-


3). 「vagrant ssh」で、ssh 接続:

$ cd ~/ダウンロード/vm/endeavour-base3
$ vagrant ssh
Last login: Wed Feb 14 11:14:42 2024 from 10.0.2.2
[vagrant@vagrant ~]$ 

→パスワードなしでログインできました:

-

[vagrant@vagrant ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

-

[vagrant@vagrant ~]$ sudo date
2024年  2月 14日 水曜日 15:45:09 JST

-

[vagrant@vagrant ~]$ ls -1Ap
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache/
.config/
Desktop/
.dmrc
Documents/
Downloads/
.gtkrc-2.0
.jp
.local/
.mozilla/
Music/
Pictures/
Public/
.ssh/
Templates/
.themes/
.vboxclient-clipboard-tty7-control.pid
.vboxclient-draganddrop-tty7-control.pid
.vboxclient-hostversion-tty7-control.pid
.vboxclient-seamless-tty7-control.pid
.vboxclient-vmsvga-session-tty7-control.pid
Videos/
.Xauthority
.xsession-errors
.xsession-errors.old

-


4). 「ssh 接続」の終了:

[vagrant@vagrant ~]$ exit
logout
ubn@ubn-box:~/ダウンロード/vm/endeavour-base3$ 

→ホストOS のプロンプトに戻りました

-


5). 電源オフ:

$ cd ~/ダウンロード/vm/endeavour-base3
$ vagrant halt
==> default: Attempting graceful shutdown of VM...

時間がかかります:

==> default: Forcing shutdown of VM...
ubn@ubn-box:~/ダウンロード/vm/endeavour-base3$ 

→電源オフ時の警告表示が解消されました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ----- -----

8. 作業で使用した「仮想マシン」等を削除:

-

仮想マシン」を使った作業は、ディスクの空きの減りが早いので、注意が必要です:

-

ディスクの空きが少ないと、システムが不調になるのと、「Box」の作成で失敗するようになるので、消してもよい「仮想マシン」等を削除しました:

-

1). VirtualBox にて、「仮想マシン」の名前(フォルダ名)を確認:

$ ls -1 ~/'VirtualBox VMs'/
endeavour-base-jp_mine                       ←原本の保存
endeavour-base2_default_1707859316586_36421  ← ★
endeavour-base3_default_1707892565141_70097  ←完成

→ ★ は、作業用なので削除可能です

-

2). 「仮想マシン」の確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
93eef7c  default virtualbox poweroff /home/ubn/ダウンロード/vm/endeavour-base2 ← ★
7770cd7  default virtualbox poweroff /home/ubn/ダウンロード/vm/endeavour-base3
:

→ ★ は、作業用なので削除可能です

-

3). 「仮想マシン」の削除:

$ vagrant destroy 93eef7c
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

→「作業フォルダ」に移動すれば、id の指定は要りません

-

確認:

$ vagrant global-status
id       name    provider   state    directory                           
-------------------------------------------------------------------------
7770cd7  default virtualbox poweroff /home/ubn/ダウンロード/vm/endeavour-base3
:

-

4). 登録された「Box」の確認:

$ vagrant box list
Endeav-base2 (virtualbox, 0)  ← ★
Endeav-base3 (virtualbox, 0)  ←完成品

→ ★ は、作業用なので削除可能です

-

5). 「Box」の削除:

$ vagrant box remove Endeav-base2
Removing box 'Endeav-base2' (v0) with provider 'virtualbox'...

-

確認:

$ vagrant box list
Endeav-base3 (virtualbox, 0)

-

6). 「.box」ファイルを作成した場所を確認:

$ cd ~/ダウンロード/vm/box-share/
$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box ←保存
-rw-rw-r-- 1 ubn ubn 10104176322  2月 14 01:29 pkg-EndeavourOS_base2.box     ← ★
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box     ←完成品

→ ★ は、作業用なので削除可能です

-

7). 「.box」ファイルを削除:

$ cd ~/ダウンロード/vm/box-share/
$ rm pkg-EndeavourOS_base2.box

-

確認:

$ ls -lA
-rw-rw-r-- 1 ubn ubn  2958974232 12月 20 21:30 pkg-EndeavourOS_base-inst.box
-rw-rw-r-- 1 ubn ubn 10081605005  2月 14 14:06 pkg-EndeavourOS_base3.box

→「EndeavourOS」のデスクトップなしの「Box」で 3 GB 弱。「Openbox」デスクトップありの「Box」で 10 GB ほどのサイズになりました:

サイズが大きいと、無料のサイトを使っての公開(「Box」の URL を登録)は難しそうですね。

-

8). ディスクの空きの確認:

Xubuntu 22.04 LTS」のファイルマネージャ「thunar」であれば、
コマンドを使うより簡単に、おおよその空きを確認できます:

→「ホーム」をクリックすると、空きが確認できます:

-

-


まとめ

過去に「EndeavourOS」の「Community Edition」のデスクトップ環境は、CD ライブ立ち上げで、インストーラを使用してインストールできました:

現在はそれができなくなったので、その中でお気に入りの「Openbox」で、色々と試してみました。

-

Vagrant であれば、何度もトライしやすいのが利点ですが、ディスクの空きには注意が必要です。

「EndeavourOS」でデスクトップなしの「Box」で 3 GB ほどだし、デスクトップありの「Box」で 10 GB、デスクトップを追加した「仮想マシン」は 25GB ほどになるので、「Box」の作成を繰り返すと、すぐにディスクの空きが減って行きます。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

Vagrant 実践編6: 「EndeavourOS」の「Box」を利用するときの補足〈H170-9〉

登録日: 2024-02-12 更新日: 2024-03-14

Xubuntu 22.04.3 LTS」の「VirtualBox 7.0.14」にて、仮想マシンの管理に「Vagrant」(ベイグラント) というツールを使えるようにしました。

-

実践編5 の投稿で、以前に作成したデスクトップなしの「Box」(Endeav-base-jp) を使って、コミュニティ版の「OpenBox」を追加インストールしました。

-

その作業の中で、「Fedora」のグループインストールと似た機能を持つ「eos-packagelist」というツールを見つけました。「EndeavourOS」のデスクトップなしの「Box」を使うとき、「仮想マシン」に(公式の)デスクトップを追加するときに活躍しそうです。

その備忘録です。

-

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

今回の補足情報:

  1. 「eos-packagelist」で使える「デスクトップ」環境の一覧:

  2. 「Desktop-Base + Common packages」環境のパッケージ一覧:

  3. 「EndeavourOS applications」環境のパッケージ一覧:

  4. 「Recommended applications selection」環境のパッケージ一覧:

  5. 「Firefox and language package」環境のパッケージ一覧:

  6. 「Firewall」環境のパッケージ一覧:

  7. 「LTS kernel in addition」環境のパッケージ一覧:

  8. 「Printing support」環境のパッケージ一覧:

  9. 「HP printer/scanner support」環境のパッケージ一覧:

  10. 「XFCE4-Desktop」環境のパッケージ一覧:

  11. 「i3-Window-Manager」環境のパッケージ一覧:

  12. 「デスクトップ環境」の設定ファイルの一覧:

-

Vagrant」での参考:

  1. 「Vagrant」コマンドについて:

  2. 「Vagrant」コマンドの使用例:

  3. 「Vagrant」コマンドの使用例:(目次)

  4.  修正版3: 使い回し可能な「Vagrantfile」:

  5.  もし、PC のディスクに余裕がない場合:

  6. 「ssh 接続」で使うテキストエディタ「nano」:

  7. 「ssh 接続」で、日本語表示にするには:

 →事前に「デスクトップの日本語化」が必要です

-

「EndeavourOS」での参考:

  1.  ミラーの更新:

  2. 「Welcome」画面に、「個人用コマンド」(Personal Commands) タブを追加:

  3. 「仮想マシン」にて、「GuestAdditions」を再インストール:

  4. 「仮想マシン」にて、ログイン時の「エラー通知」の解消、および、「クリップボード共有」機能が改善:

-

前回の「EndeavourOS」での作業:

  1. 「Vagrantfile」の修正:

  2. 「仮想マシン」の作成と立ち上げ:

  3.  GUI のみで使うユーザ「mine」を作成:

  4. 「Openbox」のインストール:

  5. 「AUR ヘルパー」を「paru」に変更:

  6.  デスクトップ周りの設定:

  7.  テキストエディタの「featherpad」をインストール:

  8.  ESR 版の「Firefox」をインストール:

  9. 「アプリ」や「フォント」をインストール:

  10.  デスクトップの日本語化:

  11.  日本語入力:「ibus-anthy」の場合:

  12.  日本語入力:「ibus-mozc」の場合:

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

Vagrant で「EndeavourOS」の「仮想マシン」を立ち上げ:

-

追加インストールした「OpenBox」の「デスクトップ環境」:

→「EndeavourOS」のデスクトップなしの「Box」を利用して、「OpenBox」を追加後、 日本語化しました

-

VirtualBox」の「クリップボードの共有」機能が使えるかは、デスクトップなしの「Box」を作成するときに、ちゃんと「GuestAdditions」をインストールできたかが鍵

-

-


現在のバージョンを表示:

-

ホストOS : 「Xubuntu 22.04.3 LTS」

2024-02-12 現在

カーネル:

$ uname -r
5.15.0-94-generic

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

→「22.04.3」にアップしています。

-

-

ゲストOS : 「EndeavourOS」

2024-02-12 現在

カーネル:

$ uname -r
6.7.3-arch1-2

リリース:

$ cat /etc/lsb-release
:
DISTRIB_ID="EndeavourOS"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="EndeavourOS Linux"
DISTRIB_CODENAME="rolling"
$ cat /etc/os-release
:
NAME="EndeavourOS"
PRETTY_NAME="EndeavourOS"
ID="endeavouros"
ID_LIKE="arch"
BUILD_ID="2023.11.17"             ←(注目)
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://endeavouros.com"
DOCUMENTATION_URL="https://discovery.endeavouros.com"
SUPPORT_URL="https://forum.endeavouros.com"
BUG_REPORT_URL="https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports"
PRIVACY_POLICY_URL="https://endeavouros.com/privacy-policy-2"
LOGO="endeavouros"

→注目: インストール時に使用したイメージの作成日付だったり、 「BUILD_ID=rolling」の表示だったりします。

-

「Welcome」のバージョン:

$ eos-welcome --version
:
24.3-1

→バージョン表示にて、「ログの登録」の行が表示される場合は「こちら 」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

1. 「EndeavourOS」のパッケージについて確認:

-

前回の〈H170-6〉でインストールした「OpenBox」で 「ssh 接続」して、確認:

-

1). 「EndeavourOS」関連のパッケージを検索:

[mine@vagrant ~]$ paru -Ss eos | grep 済
endeavouros/arc-gtk-theme-eos 20221218-1 [0 B 7.39 MiB] [インストール済み]
endeavouros/eos-apps-info 24.1-1 [0 B 379.91 KiB] [インストール済み]
endeavouros/eos-bash-shared 24.7-1 [0 B 139.18 KiB] [インストール済み]
endeavouros/eos-dracut 1.3-1 [0 B 3.41 KiB] [インストール済み]
endeavouros/eos-hooks 1.15-1 [11.06 KiB 3.17 KiB] [インストール済み]
endeavouros/eos-lightdm-slick-theme 3.2-1 [0 B 382 B] [インストール済み]
endeavouros/eos-log-tool 23-3 [0 B 25.25 KiB] [インストール済み]
endeavouros/eos-packagelist 2.2-1 [0 B 6.86 KiB] [インストール済み]
endeavouros/eos-qogir-icons 5-1 [0 B 22.42 MiB] [インストール済み]
endeavouros/eos-quickstart 1.3.1-2 [0 B 110.26 KiB] [インストール済み]
endeavouros/eos-rankmirrors 2.26-1 [0 B 26.93 KiB] [インストール済み]
endeavouros/eos-translations 24.2-1 [0 B 421.52 KiB] [インストール済み]
endeavouros/eos-update-notifier 24-1 [0 B 40.37 KiB] [インストール済み]
extra/libcamera 0.2.0-1 [0 B 1.39 MiB] [インストール済み]
extra/libcamera-ipa 0.2.0-1 [0 B 379.62 KiB] [インストール済み]

→「公式リポジトリ」だけで、「AUR リポジトリ」には登録がありません

-

2). 「eos-packagelist」に着目:

[mine@vagrant ~]$ pacman -Si eos-packagelist
リポジトリ             : endeavouros
名前                  : eos-packagelist
バージョン             : 2.2-1
説明                  : An application to gather and optionally install
                       package lists from the EndeavourOS installer
アーキテクチャ          : any
URL                   : なし
ライセンス             : GPL3
グループ               : なし
提供                  : なし
依存パッケージ          : python-pyaml
提案パッケージ          : sudo
衝突パッケージ          : なし
置換パッケージ          : なし
ダウンロード容量        : 13.01 KiB
インストール容量        : 6.86 KiB
パッケージ作成者        : EndeavourOS <info@endeavouros.com>
ビルド日時             : 2023年08月25日 01時19分42秒
検証方法               : MD5 Sum  SHA-256 Sum  署名

→説明の和訳:
EndeavourOS インストーラからパッケージ リストを収集し、オプションでインストールするアプリケーション

-

3). ネットで「EndeavourOS eos-packagelist」を検索:

ヒットしました:

Introducing eos-packagelist から抜粋:

-

和訳:

eos-packagelist の紹介:

2022年 2月

新しいパッケージ「eos-packagelist」をリポジトリに追加しました。
これは、インストーラからのパッケージ リストを解析し、pacman を使用して
パッケージの一覧を表示したり、必要に応じてインストールできる簡単なスクリプトです。

-

どのパッケージが「plasma」とともにインストールされているかを知りたい場合:
eos-packagelist KDE-Desktop


利用可能なプロファイルのリストが必要な場合:
eos-packagelist --list

インストーラの「gnome セレクション」からすべてのパッケージをインストールしたい場合:
eos-packagelist --install GNOME-Desktop

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

2.「eos-packagelist」で使える「デスクトップ」環境の一覧を表示:

-

「eos-packagelist」コマンドを使ってみました:

-

「プロファイル」の一覧を表示:

コマンド使用時に指定できる、デスクトップの環境の名前:

[mine@vagrant ~]$ eos-packagelist --list
Desktop-Base + Common packages        ★
EndeavourOS applications              ★
Recommended applications selection    ★
Firefox and language package          ★
Firewall                              ★
LTS kernel in addition
Printing support
HP printer/scanner support
KDE-Desktop
GNOME-Desktop
XFCE4-Desktop
Cinnamon-Desktop
MATE-Desktop
Budgie-Desktop
LXQT-Desktop
LXDE-Desktop
i3-Window-Manager

→★ インストーラで「No Desktop」を選んだときに、
デフォルトで選択される、インストールされるパッケージ群(グループ):

実際のインストール画面は「こちら」を参照:

-

以前のリリースにあった「Openbox Edition」のパッケージはなくなりました:

→現在は、Github からダウンロードしてインストールが必要です。

-

ちなみに、ダウンロードしたインストール用のスクリプト「openbox/openbox-install.sh」では、

スクリプトの最後の方に「Openbox Edition」のインストールの記述がありましたが、現在はコメント化されています:

# eos-packagelist --install "Openbox Edition"

-

過去に「Openbox Edition」でインストールされた内容は、「項番 4-b」を参照:
現在の手動インストールとの違い(差分)は、「項番 4-2」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

2-1.「Desktop-Base + Common packages」環境のパッケージ一覧を表示:

-

★デスクトップの基本 + 共通パッケージ:

[mine@vagrant ~]$ eos-packagelist 'Desktop-Base + Common packages'
libwnck3
mesa-utils
xf86-input-libinput
xorg-xdpyinfo
xorg-server
xorg-xinit
xorg-xinput
xorg-xkill
xorg-xrandr
xf86-video-amdgpu
xf86-video-ati
b43-fwcutter
broadcom-wl-dkms
dhclient
dnsmasq
dnsutils
ethtool
iwd
modemmanager
networkmanager
networkmanager-openconnect
networkmanager-openvpn
nss-mdns
openssh
usb_modeswitch
wpa_supplicant
xl2tpd
downgrade
pacman-contrib
pkgfile
rebuild-detector
reflector
yay
accountsservice
bash-completion
bluez
bluez-utils
ffmpegthumbnailer
gst-libav
gst-plugin-pipewire
gst-plugins-bad
gst-plugins-ugly
libdvdcss
libgsf
libopenraw
mlocate
poppler-glib
xdg-user-dirs
xdg-utils
efitools
haveged
nfs-utils
nilfs-utils
ntp
smartmontools
unrar
unzip
xz
cantarell-fonts
freetype2
noto-fonts
noto-fonts-emoji
noto-fonts-cjk
noto-fonts-extra
ttf-bitstream-vera
ttf-dejavu
ttf-liberation
ttf-opensans
alsa-firmware
alsa-plugins
alsa-utils
pavucontrol
pipewire-pulse
wireplumber
pipewire-alsa
pipewire-jack
rtkit
dmidecode
dmraid
hdparm
hwdetect
lsscsi
mtools
sg3_utils
sof-firmware
power-profiles-daemon
upower
amd-ucode
intel-ucode

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

2-2.「EndeavourOS applications」環境のパッケージ一覧を表示:

-

★「EndeavourOS」のアプリケーション集:

[mine@vagrant ~]$ eos-packagelist 'EndeavourOS applications'
endeavouros-theming
eos-apps-info
eos-log-tool
eos-packagelist
eos-quickstart
eos-rankmirrors
eos-update-notifier
reflector-simple
welcome

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

2-3.「Recommended applications selection」環境のパッケージ一覧を表示:

-

★推奨されるアプリケーション集:

[mine@vagrant ~]$ eos-packagelist 'Recommended applications selection'
duf
findutils
fsarchiver
git
glances
hwinfo
inxi
meld
nano-syntax-highlighting
pv
python-defusedxml
python-packaging
rsync
tldr
sed
vi
wget

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

2-4.「Firefox and language package」環境のパッケージ一覧を表示:

-

Firefox と言語パッケージ:

[mine@vagrant ~]$ eos-packagelist 'Firefox and language package'
firefox

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

2-5.「Firewall」環境のパッケージ一覧を表示:

-

ファイアウォール:

[mine@vagrant ~]$ eos-packagelist 'Firewall'
firewalld
python-pyqt5
python-capng

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

2-6.「LTS kernel in addition」環境のパッケージ一覧を表示:

-

LTS カーネル:

[mine@vagrant ~]$ eos-packagelist 'LTS kernel in addition'
linux-lts
linux-lts-headers

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

2-7.「Printing support」環境のパッケージ一覧を表示:

-

印刷サポート:

[mine@vagrant ~]$ eos-packagelist 'Printing support'
cups
cups-browsed
cups-filters
cups-pdf
foomatic-db
foomatic-db-engine
foomatic-db-gutenprint-ppds
foomatic-db-nonfree
foomatic-db-nonfree-ppds
foomatic-db-ppds
ghostscript
gsfonts
gutenprint
splix
system-config-printer

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

2-8.「HP printer/scanner support」環境のパッケージ一覧を表示:

-

HP プリンター/スキャナーのサポート:

[mine@vagrant ~]$ eos-packagelist 'HP printer/scanner support'
cups
cups-browsed
cups-filters
cups-pdf
foomatic-db
foomatic-db-engine
foomatic-db-gutenprint-ppds
foomatic-db-nonfree
foomatic-db-nonfree-ppds
foomatic-db-ppds
ghostscript
gsfonts
gutenprint
splix
system-config-printer

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

2-9.「XFCE4-Desktop」環境のパッケージ一覧を表示:

-

Xfce4 デスクトップ:

-

[mine@vagrant ~]$ eos-packagelist XFCE4-Desktop
blueman
file-roller
galculator
gvfs
gvfs-afc
gvfs-gphoto2
gvfs-mtp
gvfs-nfs
gvfs-smb
lightdm
lightdm-slick-greeter
mousepad
network-manager-applet
parole
ristretto
thunar-archive-plugin
thunar-media-tags-plugin
xdg-user-dirs-gtk
xfce4
xfce4-battery-plugin
xfce4-datetime-plugin
xfce4-mount-plugin
xfce4-netload-plugin
xfce4-notifyd
xfce4-pulseaudio-plugin
xfce4-screensaver
xfce4-screenshooter
xfce4-taskmanager
xfce4-wavelan-plugin
xfce4-weather-plugin
xfce4-whiskermenu-plugin
xfce4-xkb-plugin
arc-gtk-theme-eos
eos-lightdm-slick-theme
eos-qogir-icons
eos-settings-xfce4                ←(ユーザ作成前にセットアップ)
endeavouros-xfce4-terminal-colors

→デフォルトのテキストエディタは「mousepad」です

-

普通に検索すると:
[mine@vagrant ~]$ pacman -Ss Desktop | grep xfce4
extra/exo 4.18.0-1 (xfce4) [インストール済み]
extra/garcon 4.18.1-1 (xfce4)
extra/libxfce4ui 4.18.4-1 [インストール済み]
extra/xfce4-artwork 0.1.1a_git20110420-6 (xfce4-goodies)
extra/xfce4-notifyd 0.9.3-1 (xfce4-goodies)
extra/xfce4-panel 4.18.5-1 (xfce4)
extra/xfce4-terminal 1.1.1-2 (xfce4) [インストール済み]
extra/xfdesktop 4.18.1-1 (xfce4)

→これだと、さっぱりですね

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

2-10.「i3-Window-Manager」環境のパッケージ一覧を表示:

-

[mine@vagrant ~]$ eos-packagelist i3-Window-Manager
acpi
arandr
arc-gtk-theme-eos
archlinux-xdg-menu
awesome-terminal-fonts
dex
dmenu
dunst
eos-settings-i3wm                ←(ユーザ作成前にセットアップ)
endeavouros-xfce4-terminal-colors
eos-lightdm-slick-theme
eos-qogir-icons
feh
galculator
gvfs
gvfs-afc
gvfs-gphoto2
gvfs-mtp
gvfs-nfs
gvfs-smb
i3-wm
i3blocks
i3lock
i3status
jq
lightdm
lightdm-slick-greeter
lxappearance-gtk3
mpv
network-manager-applet
numlockx
playerctl
polkit-gnome
rofi
scrot
sysstat
thunar
thunar-archive-plugin
thunar-volman
tumbler
unzip
xarchiver
xbindkeys
xdg-user-dirs-gtk
xed
xfce4-terminal
xorg-xbacklight
xorg-xdpyinfo
zip

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----

3. 「デスクトップ環境」の設定ファイルの一覧:

-

公式の「デスクトップ環境」の一覧となります:

[mine@vagrant ~]$ pacman -Ss eos-settings
endeavouros/eos-settings-budgie 1.6-2
    Budgie settings for EndeavourOS
endeavouros/eos-settings-cinnamon 2.0-1
    Cinnamon settings for EndeavourOS
endeavouros/eos-settings-gnome 2.1-1
    GNOME settings for EndeavourOS
endeavouros/eos-settings-i3wm 1.8-1
    pre user creation skel setup for i3-wm under EndeavourOS
endeavouros/eos-settings-lxde 1.1-1
    LXDE settings for EndeavourOS
endeavouros/eos-settings-lxqt 1.1-1
    LXQT settings for EndeavourOS
endeavouros/eos-settings-mate 1.1-2
    MATE settings for EndeavourOS
endeavouros/eos-settings-plasma 1.5-1
    Plasma settings and theme for EndeavourOS
endeavouros/eos-settings-xfce4 1.5-1
    pre user creation skel setup for xfce4 under EndeavourOS

→「pre user creation ...」の行の和訳:

EndeavourOS での「i3-wm」のユーザ作成前のセットアップ

EndeavourOS での「xfce4」のユーザ作成前のセットアップ

→ユーザ作成後でないことに注意:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -----

4. 参考: インストールされる「Openbox」のパッケージの一覧:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- -

4-a. 参考: 以前の、iso のインストーラでインストールできた「Openbox Edition」のパッケージの一覧:

-

過去に「Community Edition」は、CD ライブ立ち上げで、インストーラ(calamares packagechooser モジュール)を使用してインストールできました:

-

Web サイト:

EndeavourOS-Community-Editions/Community-Edition-installer-files

→最新の ISO イメージから削除されたので、2023年 09月 06日からサイトは「読み取り専用」になりました:

-

サイトにある、「Community-Edition-installer-files/packagechooser_ce.conf」から抜粋:

「Openbox Edition」を選んだときにインストールされるパッケージ群:

2023-09-06 以前:

acpi
arandr
arc-gtk-theme-eos
arc-x-icons-theme
archlinux-xdg-menu
capitaine-cursors
dex
dmenu
dunst
eos-skel-ce-openbox
feh
gtk-engine-murrine
gvfs
gvfs-afc
gvfs-gphoto2
gvfs-mtp
gvfs-nfs
gvfs-smb
jgmenu
jq
lightdm
lightdm-slick-greeter
lxappearance-gtk3
network-manager-applet
nitrogen
obconf
openbox
pasystray
picom
polkit-gnome
rofi
scrot
slock
sysstat
thunar
thunar-archive-plugin
thunar-media-tags-plugin
thunar-volman
tint2
ttf-nerd-fonts-symbols
tumbler
xbindkeys
xcursor-neutral
xdg-user-dirs-gtk
xed
xfce4-terminal
xorg-xbacklight
xorg-xdpyinfo

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- --

4-b. Github から ダウンロードして「Openbox」を手動でインストールした場合のパッケージの一覧:

-

Github のサイト:

EndeavourOS-Community-Editions/openbox

-

インストールされるパッケージの一覧:

2024-02-04 現在:

$ cat openbox/packages-repository.txt
acpi
arandr
arc-gtk-theme-eos
archlinux-xdg-menu
default-cursors
dex
dmenu
dunst
eos-lightdm-slick-theme
eos-qogir-icons
feh
gtk-engine-murrine
gvfs
gvfs-afc
gvfs-gphoto2
gvfs-mtp
gvfs-nfs
gvfs-smb
jgmenu
jq
lightdm
lightdm-slick-greeter
lxappearance-gtk3
mpv
network-manager-applet
nitrogen
obconf
openbox
pasystray
picom
polkit-gnome
rofi
scrot
slock
sysstat
thunar
thunar-archive-plugin
thunar-media-tags-plugin
thunar-volman
tint2
tumbler
xbindkeys
xdg-user-dirs-gtk
xed
xfce4-terminal
xorg-xbacklight
capitaine-cursors
python-pyxdg
ttf-nerd-fonts-symbols
xcursor-themes
xorg-xdpyinfo

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ----- ---

4-2. 参考: インストールされる「Openbox」のパッケージの違いを確認:

-

「項番 4-a.」と「項番 4-b.」のパッケージ一覧の差分を確認:

-arc-x-icons-theme    ←(公式リポジトリから削除されました)
+default-cursors
-eos-skel-ce-openbox    ←(公式リポジトリから削除されました)
+eos-lightdm-slick-theme
+eos-qogir-icons
+mpv
+python-pyxdg
-xcursor-neutral    ←(公式リポジトリから削除されました)
+xcursor-themes

-」の行は、削除されたパッケージ:

+」の行は、追加されたパッケージ:

-

インストールされるパッケージで、「GuestAdditions」と関係しそうなパッケージはありませんね。

-

-


まとめ

過去に「Community Edition」は、CD ライブ立ち上げで、インストーラ(calamares packagechooser モジュール)を使用してインストールできました:

そのときに使われていたのが、「eos-packagelist」ツールだったようです。

-

「EndeavourOS」でデスクトップなしの「Box」を使うとき、「仮想マシン」に(公式の)デスクトップを追加するときに活躍しそうです。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

「Windows11」(22H2) で、「VirtualBox 7.0.14」と「Vagrant 2.4.1」にアップデート〈H170-8〉

登録日: 2024-02-12 更新日: 2024-03-14

現在、「Windows11」(22H2) のPC で使っている仮想環境は、「VirtualBox 7.0.10」で「Vagrant 2.4.0」を使っています。

-

最新の「VirtualBox 7.0.14」と「Vagrant 2.4.1」が公開されたので、 アップデート(上書きインストール)しました。

その備忘録です。

-

-

ちなみに、〈H170-7〉の投稿で、

Linux」(Xubuntu 22.04.3 LTS) で、「VirtualBox 7.0.14」と「Vagrant 2.4.1」にアップデートしました。やり方が少しだけ異なります。

-

-

-

使用したPC は、「Windows 11」のノートPC です。「UEFI 立ち上げ」でUSB 3.0 ポートのある中古のPC をメモリ 12GB、SSD 1TB に増設して使っています。 ディスプレイの解像度が HD (1360 x 768) なので画面が狭いです。

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

今回の作業:

  1.  最新の「VirtualBox 7.0.14」をダウンロード:

  2. 「VirtualBox 7.0.14」をインストール:

  3. 「VirtualBox Extension Pack」をインストール:

  4.  最新の「Vagrant」をダウンロード:

  5. 「Vagrant」をインストール:

  6.  追記: Vagrant に「vagrant-vbguest」プラグインをインストールする場合:

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

「Windows11」を起動:

-

立ち上げた「Windows11」の画面:

-

VirtualBox 7.0.14」を起動:

→「Windows11」だと、画面がダーク系になるだけで、Linux の「VirtualBox」と機能は変わりません。

-

ちなみに、2番目が「Vagrant」で管理されている「仮想マシン」です。名前の先頭が「作業フォルダ」名と同じになるので、フォルダ名の付け方は重要です。

Vagrant」では、上記の「VirtualBox マネージャ」画面は起動せずに使われます。

-

-


現在のバージョンを表示:

-

ホストOS : 「Windows11」

2024-02-12 現在

「Windows11」(22H2)

-

コマンドプロンプトで確認:

Microsoft Windows [Version 10.0.22621.3085]

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

VirtualBox」について:

-

VirtualBox 」は、Oracle が開発している「仮想マシン」を構築するためのソフトウェアです。

-

  • 「VirtalBox」は「仮想的なパソコン」(仮想デバイス)を実現するソフトウェアです。別のパソコンに「Linux」をインストールするのと変わりません。

  • 仮想マシンを使うことで、ハードウェアで問題となりそうなPC でも、最新のLinux ディストリビューションをインストールできる可能性が高くなります。

  • 問題があっても、Linux の情報をそのまま使えるのが強みです。

-

ホストOS とゲストOS でメモリを分割して使うので、メモリのサイズと割当て方は重要です。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

Vagrant」 (ベイグラント) について:

-

公式サイト:

Vagrant by HashiCorp

-

Vagrant」は、「VirtualBox」や「VMware」などの「仮想化ソフトウェア」を便利に利用するためのツールで、

仮想マシン」の管理や操作をコマンドで使るようにした「フロントエンド」のソフトウェアです:

-

Vagrant」のベースとなる「Box」を公開しているサイト:

Discover Vagrant Boxes

-

→「Vagrant」については、以前に投稿した「こちら 」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

1.「Windows11」にて、「VirtualBox 7.0.14」をインストール:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

1-1. 「VirtualBox 7.0.10」のゲストOS をすべて、電源オフ:

-

ゲストOS をすべて、電源オフ:

-

VirtualBox」マネージャを閉じました:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

1-2. 最新の「VirtualBox 7.0.14」をダウンロード:

-

2024-02-12 現在:

「Windows11」のブラウザで下記を開きます:

Index of /virtualbox/7.0.14

-

Windows の場合、使われるファイルは共通で、ひとつです:

-


1). 「VirtualBox」のダウンロード:

-


2). 「VirtualBox Extension Pack」のダウンロード:

-


3). 「チェックサム」のダウンロード:

ブラウザで下記が表示されました:

抜粋:

42cb36fbf439a9ed28c95d2bbc718a0eac902225eb579c884c549af2e94be633 *Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
:
4719b38e7a276b43099ce4d6349e6bfc80edf644ee59d9dafd264bc7ed7691f4 *VirtualBox-7.0.14-161095-Win.exe
:

-

エクスプローラ」でファイルを確認:

Firefoxブラウザなら、ウィンドウタイトルバー右の「↓」をクリック →ファイルをクリック

-


4). 「Windows11」で「PowerShell」を起動:

-

(1).「PowerShell」を起動:

Windows ボタン →「po」(ピー・オー)で絞り込み →「Windows PowerShell」または、左の「Power Shell 7.0」

→バージョンが上の「Power Shell 7.0」がオススメ(インストールしてないと表示されません)

-

PS C:\Users\user> 

→「user」はユーザ名です

-

参考:「PowerShell」は、テキストエディタと同じでマウスでの「編集」操作ができるので便利です:

表示された「文字列」をダブルクリックするか、マウスや Shift+「矢印キー」で範囲選択して、Ctrl+C

プロンプトで、Ctrl+V で貼り付け

-

(2). 作業ディレクトリを「Downloads\」フォルダに移動:
> cd C:\Users\user\Downloads\
PS C:\Users\user\Downloads> 

→「>」はプロンプトで、ここでは「PS C:\Users\user>」を省略して表示してます。入力しません。

「user」はユーザ名なので、各自異なります。

-

5). 「Windows11」で「VirtualBox」の「チェックサム」を確認:

-

(1).ファイルの確認:
> ls VirtualBox*
:
    ディレクトリ: C:\Users\user\Downloads

Mode           LastWriteTime    Length Name
----           -------------    ------ ----
-a----  2023/07/28 金   5:16  110898280 VirtualBox-7.0.10-158379-Win.exe
-a----  2024/02/10 土   0:15  111161880 VirtualBox-7.0.14-161095-Win.exe
-a----  2023/04/29 土  13:31  110628872 VirtualBox-7.0.8-156879-Win.exe

-

(2). ハッシュ値である「Hashプロパティ」の値のみを「小文字」で表示:
> (Get-FileHash -Algorithm SHA256 VirtualBox-7.0.14-*).Hash.toLower()
:
4719b38e7a276b43099ce4d6349e6bfc80edf644ee59d9dafd264bc7ed7691f4

-


6). 「Windows11」で「VirtualBox Extension Pack」のチェックサムを確認:

-

(1).ファイルの確認:
> ls Oracle*
:
    ディレクトリ: C:\Users\user\Downloads

Mode           LastWriteTime    Length Name
----           -------------    ------ ----
-a----  2023/07/28 金   5:17   18259331 Oracle_VM_VirtualBox_Extension_Pack-7.0.10-158379.vbox-extpack
-a----  2024/02/10 土   0:16   18331089 Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
-a----  2023/04/29 土  13:32   18678513 Oracle_VM_VirtualBox_Extension_Pack-7.0.8-156879.vbox-extpack

-

(2). ハッシュ値である「Hashプロパティ」の値のみを「小文字」で表示:
> (Get-FileHash -Algorithm SHA256 Oracle_VM_VirtualBox_Extension_Pack-7.0.14-*).Hash.toLower()
:
42cb36fbf439a9ed28c95d2bbc718a0eac902225eb579c884c549af2e94be633

-

ウィンドウ画面を右上の「x」で、閉じます。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

1-3.「VirtualBox 7.0.14」をインストール:

-

「Windows11」(22H2) にて操作:

-

1). 「エクスプローラ」を起動:

というか、すでに開いていると思います:

-

2). ダウンロードした「VirtualBox-7.0.14-161095-Win.exe」ファイルを右クリック→「管理者として実行」

→「はい」

-

3). 「Oracle VM VirtualBox 7.0.14 Setup」画面が表示:

-

「Welcom to the Oracle VM VirtualBox 7.0.14 Setup Wizard」表示:

→右下の「Next」

-


4). 「Custom Setup」: インストール項目の選択

ショートカットを作成するか、スタートメニューに含めるか、などが選べます。

デフォルトのまま:

→右下の「Next」

-


5). 警告の「Warning: Newtwork Interfaces」が表示:

VirtualBox のインストール中に「ネットワーク接続が切断される」という警告です。

ブラウザ等で作業しているときは保存して終了させます。

→右下の「Yes」

-


6). 「Missing Dependencies Python Core / win32api」という警告が表示:

和訳:

依存関係の欠落 「Python Core / win32api」

Oracle VM VirtalBox 7.0.14 の前に、Pythonバインディングをインストールします。
Orcle VM VirtalBox 7.0.14 のインストールを続行する場合は、
後で手動でセットアップする必要があります。
詳細については、Orcle VM VirtualBox 7.0.14 SDK マニュアルを参照してください。

今すぐインストールを続行しますか?

→右下の「Yes」

-

補足:
VirtualBox を Python でプログラム制御できる機能があり、

「Python Core」及び「win32api」がインストールされていない場合は、警告が出ます。
それぞれ、先にインストールされている必要があります。
もし、インストールを継続した場合、後で手動セットアップする必要があります。

ただし、VirtualBoxPythonでプログラム制御する機能を使わないのであれば、 「Yes」で進めて、インストールしなくても良さそう。

-

今回はインストールしませんが、もし必要であれば下記を参照:

VirtualBox 7 のインストール時に「Missing Dependencies Python Core / win32api」 の警告が表示された場合の対処方法

-


7). 「Ready to Install」画面が表示:

→右下の「Install」

-

インストール中:

-


8). 「installation is complete.」画面が表示:

VirtualBoxのインストールが完了

→右下の「Finish」

-


9). 「Oracle VM VirtualBox」が起動されます:

-


10). 「Oracle VM VirtualBox」を右上の「x」で閉じます:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

1-4. 任意:「VirtualBox Extension Pack」をインストール:

-

続けて、機能拡張パッケージをインストールします。

作業は任意です。

-

→インストールされている VirtualBox のバージョンと同じバージョンの拡張パックが、ダウンロード済みです:

-


拡張パックで提供される追加機能:

-


1). インストール:

-

(1). 「エクスプローラ」を起動:

というか、すでに開いていると思います:

-

(2). ダウンロードした、「C:\Users\user\Downloads\」フォルダにある、下記の「ファイル」をダブルクリック:

Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack」

-

(3). 「VirtualBox」マネージャが起動されて、ダイアログが表示:

古いバージョンの機能拡張パッケージがインストールされています。アップグレードしますか?

→「アップグレード」をクリック

-

(4). VirtualBox のライセンスが表示:

一番下までスクロール:

→「同意します」をクリック

-

(5). 「VirtualBox」マネージャの画面に戻りました:

-

2). 「機能拡張」がインストールされたか確認:

左側の「ツール」の右側の「横3本線」ボタンをクリック→「機能拡張」

-

「機能拡張」がインストールされたか確認できます:

-

左側の「ツール」の右側の「横3本線」ボタンをクリック→「ようこそ」

→元の画面に戻りました:

-

ゲストOS を選択:

-

ゲストOS を起動してみました:

→ログイン画面が表示:

いつもと同じです。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

2.「Windows11」にて、「Vagrant」をインストール:

-

参考:

Windows 11へのVagrantのインストール

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

2-1. 最新の「Vagrant」をダウンロード:

-


1). 「Windows11」で「コマンド プロンプト」を起動:

-

Windows ボタン →「cm」で絞り込み →「コマンド プロンプト」
Microsoft Windows [Version 10.0.22621.3085]
(c) Microsoft Corporation. All rights reserved.

C:\Users\user>

→立ち上げメッセージで、「Windows11」のバージョンも確認できます

-

2). 「コマンド プロンプト」で、「CPU アーキテクチャ」を確認:

コマンドプロンプト」でないと、下記のコマンドは使えません:

C:\Users\user> set processor
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09

→「CPU アーキテクチャ」は、「AMD64」です

コマンドプロンプト」の終了:
C:\Users\user> exit

-

3). Firefox ブラウザで、「Vagrant」の「ダウンロードページ」を開きました:

Downloads | Vagrant by HashiCorp

-

4). 「Windows」の項目で、下記の「CPU アーキテクチャ」の「Download」をクリック:

AMD64

-

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

2-2.「Vagrant」をインストール:

-

1). 「エクスプローラ」にて、ダウンロードした「msi」ファイルをダブルクリックして実行:

-

「Welcom to ...」画面が立ち上がりました:

→「Next」

しばらくすると、次の画面に変化:

-

規約の同意画面:

「I accept the terms in the License Agreement」にチェック:

→「Next」

-

Vagrant」のインストール中:

インストール処理には、だいぶ時間がかかりました。

実行中は、「cancel」しか選べません。

-

処理が終了:

→「Finish」

-

2). 「Windows11」を再起動するか聞いてきました:

-

開いているウィンドウ画面をすべて閉じて、

-

→「Yes」

-

3). 再起動されました:

-

4). 「PowerShell」を立ち上げ:

Windows ボタン →「po」(ピー・オー)で絞り込み →「Windows PowerShell」または、左の「Power Shell 7.0」

→バージョンが上の「Power Shell 7.0」がオススメ(インストールしてないと表示されません)

-

PS C:\Users\user> 

→「user」はユーザ名で変わります

-

5). 「Vagrant」のバージョンを確認:

PS C:\Users\user> vagrant -v
Vagrant 2.4.1

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

2-3. 追記: Vagrant に「vagrant-vbguest」プラグインをインストールする場合:

-

ホストOS 側に「Vagrant」をインストールしたとき、 「VirtualBox」で使うなら、すぐに「vagrant-vbguest」プラグインをインストールしておくべきでした:

-

Vagrant に「vagrant-vbguest」プラグインをインストール:

→「こちら」を参照:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

3. 「Vagrant」を操作して確認:

-

どの「Box」で確認しても良いです。

参考: 以前、試しで入れた「Box」で確認:

-

1). 以前、インストールした「Vagrant」の「Box」を確認:

PS C:\Users\user> vagrant global-status
id       name    provider   state    directory
-------------------------------------------------------------------------
a339de8  default virtualbox poweroff C:/Users/user/vm/fedora

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

和訳:

上記は、このマシン上のすべての既知の Vagrant 環境に関する情報を示しています。
このデータはキャッシュされているため、完全に最新ではない可能性があります
 (無効なエントリを削除するには「vagrant global-status --prune」を使用します)。
いずれかのマシンと対話するには、そのディレクトリに移動して Vagrant を実行するか、
任意のディレクトリから Vagrant コマンドで ID を直接使用することができます。
例: 「vagrant destroy 1a2b3c4d」

→「仮想マシン」の id だけでなく、「仮想マシン」を作成するときに使った(その管理にも使われる)「作業フォルダ」を確認できます:

-

2). ホームに登録した「Box」を確認:

PS C:\Users\user> vagrant box list
generic/fedora38 (virtualbox, 4.3.2)

-

3). 目的の「作業フォルダ」に移動:

PS C:\Users\user> cd C:/Users/user/vm/fedora
PS C:\Users\user\vm\fedora>

-

-

続きは、「次の投稿」へ:

-

こちらの「Box」は手間がかかったので、単に動作確認するにはオススメしないかも。

-

-


まとめ

仮想マシン」で何か問題があるときは、「VirtualBox」と「Vagrant」を一緒に、最新に「アップデート」するのが良さそう。もしかしたら、解決するかも。

VirtualBox」と「Vagrant」の「アップデート」は、 今まで使っていた「ゲストOS」は、そのまま使えるので、楽です。

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-

「Xubuntu 22.04 LTS」で、「VirtualBox 7.0.14」と「Vagrant 2.4.1」にアップデート〈H170-7〉

登録日: 2024-02-05 更新日: 2024-03-14

現在、「Xubuntu 22.04 LTS」のPC で使っている仮想環境は、「VirtualBox 7.0.10」で「Vagrant 2.4.0」を使っています。

-

最新の「VirtualBox 7.0.14」と「Vagrant 2.4.1」が公開されたので、
アップデート(上書きインストール)しました。

その備忘録です。

-

前回、リポジトリを登録して「VirtualBox」と「Vagrant」をインストールしている場合は、こちらの作業は要りません。

-

-

-

使用したPC は「ASUS Chromebox CN60 」で、 プロセッサは第4世代の「Intel Celeron 2955U 」です。

UEFI 立ち上げ」のPC です。

-

(注)リンクを戻るときはブラウザの左上の「←」をクリック
スマホの場合は、「ホーム」ボタンの横の「<」キーをタップ

-

-


目次

-

参考:

  1.  修正版: 「Vagrant」で使い回し可能な「Vagrantfile」:

  2. 「仮想マシン」にて「GuestAdditions」を再インストール:

  3. 「仮想マシン」にて、ログイン時の「エラー通知」の解消、および、「クリップボード共有」機能の改善で行ったこと:

  4. 「仮想マシン」にて「GuestAdditions」の再インストールで成功したことで気づいたこと:

  5.  Vagrant に「vagrant-vbguest」プラグインをインストール:

-

今回の作業:

  1. 「VirtualBox 7.0.14」をダウンロード:

  2. 「VirtualBox 7.0.14」をインストール:

  3. 「VirtualBox Extension Pack」をインストール:

  4. 「Vagrant 2.4.1」をダウンロード:

  5. 「Vagrant 2.4.1」をインストール:

  6. 「仮想マシン」にて「GuestAdditions」を再インストール:

-

「まとめ へ」

「目次詳細 へ」

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -

Xubuntu 22.04 LTS」を起動:

-


インストールした最新の「VirtualBox 7.0.14」を起動:

ヘルプ →「VirtualBox について」:

-

-


最新の「VirtualBox 7.0.14」にて、「仮想マシン」のOpenbox で「リアルタイムの解像度調整」が有効になりました:

→「仮想マシン」を「vmsvga」に設定してから、ウィンドウの右下隅をドラッグして広げると、リアルタイムに解像度が調整され、壁紙が変化しました。なので「Welcome」画面は置いてけぼりです。

-

最新の「VirtualBox 7.0.14」にしたからだけでなく、その他のこと も合わせて行ったから改善されたと思われます:

-

-


現在のバージョンを表示:

-

ホストOS : 「Xubuntu 22.04.3 LTS」

2024-02-05 現在

カーネル:

$ uname -r
5.15.0-92-generic

リリース:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

→「Xubuntu 22.04.3 LTS」にアップしています。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - --

VirtualBox」について:

-

VirtualBox 」は、Oracle が開発している「仮想マシン」を構築するためのソフトウェアです。

-

  • 「VirtalBox」は「仮想的なパソコン」(仮想デバイス)を実現するソフトウェアです。別のパソコンに「Linux」をインストールするのと変わりません。

  • 仮想マシンを使うことで、ハードウェアで問題となりそうなPC でも、最新のLinux ディストリビューションをインストールできる可能性が高くなります。

  • 問題があっても、Linux の情報をそのまま使えるのが強みです。

-

ホストOS とゲストOS でメモリを分割して使うので、メモリのサイズと割当て方は重要です。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ---

1. 「VirtualBox 7.0.10」のゲストOS をすべて、電源オフ:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----

2. 「Xubuntu 22.04 LTS」に、最新の「VirtualBox 7.0.14」をインストール:

-

参考:

「Xubuntu 22.04 LTS」で、「VirtualBox 7.0.10」へアップデート〈H169〉

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - -----

2-1. 最新の「VirtualBox 7.0.14」をダウンロード:

-

1). Ubuntu の「コード名」を確認:

$ cat /etc/lsb-release : DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy ←(コード名) DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

Xubuntu(フレーバー違い)で使用するイメージファイルは「Ubuntu」と同じです。

-

2). ブラウザで下記を開きました:

Index of /virtualbox/7.0.14/

-

3). 「VirtualBox」のダウンロード:

使用しているホストOS の種類とリリース番号によって、ファイルを選びました:

サイトの一番下にある、

virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb をクリック:

→ファイルを「~/ダウンロード/virtualbox/」フォルダに移動

-

4). 「VirtualBox Extension Pack」のダウンロード:

サイトの上にある、

Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack

→ファイルを「~/ダウンロード/virtualbox/」フォルダに移動しました

-

インストールを行う「VirtualBox」のバージョンと同じバージョンの「拡張パック」をダウンロードしてインストールします:

-

5). 「チェックサム」のダウンロード:

SHA256SUMS

→ブラウザで下記が表示されました:

42cb36fbf439a9ed28c95d2bbc718a0eac902225eb579c884c549af2e94be633 *Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
:
43aa0932f73433e7a6b450a82708d275ee5f2c98375cfa708a46ecf75b3d4edc *virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb

-

6). 「チェックサム」の確認:

$ cd ~/ダウンロード/virtualbox/

-

$ ls -1
Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb

-

(1). 「VirtualBox」の確認:
$ sha256sum virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
43aa0932f73433e7a6b450a82708d275ee5f2c98375cfa708a46ecf75b3d4edc  virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb

-

(2). 「VirtualBox Extension Pack」の確認:
$ sha256sum Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
42cb36fbf439a9ed28c95d2bbc718a0eac902225eb579c884c549af2e94be633  Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack

-

(3). ホームに移動:
$ cd

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -

2-2. 「VirtualBox 7.0.14」をインストール:

-

1). システム更新:

$ sudo apt update
[sudo] パスワード: 
ヒット:1 https://cli.github.com/packages stable InRelease
ヒット:2 http://security.ubuntu.com/ubuntu jammy-security InRelease       
ヒット:3 http://jp.archive.ubuntu.com/ubuntu jammy InRelease              
ヒット:4 http://jp.archive.ubuntu.com/ubuntu jammy-updates InRelease    
ヒット:5 http://jp.archive.ubuntu.com/ubuntu jammy-backports InRelease
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了        
パッケージはすべて最新です。

→ 1行目は個人的に追加したリポジトリなので、通常は表示されません。

-

$ sudo apt upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了        
状態情報を読み取っています... 完了        
アップグレードパッケージを検出しています... 完了
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libvlc5 exo-utils vlc-data libvlccore9 libopusfile0 libopenexr25
  libpostproc55 libavcodec58 libavutil56 libswscale5 libexo-2-0 libswresample3
  vlc-plugin-video-output libavformat58 libvlc-bin vlc-plugin-base
  libexo-common libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。

→「アップグレード:」の行が、すべて 0 かを確認:

その上の数行ある「Ubuntu Pro」関連の表示は、今回は無視

-

2). 「dkms」のインストール:

カーネルの更新があっても自動で依存(カーネルヘッダー等)を解決してもらえます:

$ sudo apt install dkms
:
dkms はすでに最新バージョン (2.8.7-2ubuntu2.2) です。

-

注意:「.deb」ファイルから「VirtualBox」をインストールする場合は、「dkms」でなく、「virtualbox-dkms」をインストールしてはいけません:

apt で「VirtualBox」をインストールする場合に、「virtualbox-dkms」はインストールします:

-

3). 再起動:

「端末」以外のすべてのウィンドウを閉じてから、

$ reboot

-

4). 立ち上がったら、ファイルを確認:

$ cd ~/ダウンロード/virtualbox/

-

$ ls -1
Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack
virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb

-

5). 「.deb」ファイルから「VirtualBox」をインストール:

$ sudo chown _apt /var/lib/update-notifier/package-data-downloads/partial/

-

$ cd ~/ダウンロード/virtualbox/
$ sudo apt install ./virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb
:
以下のパッケージはアップグレードされます:
  virtualbox-7.0
アップグレード: 1 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
:
.../virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb を展開する準備をし
ています ...
virtualbox-7.0 (7.0.14-161095~Ubuntu~jammy) で (7.0.10-158379~Ubuntu~jammy 
に) 上書き展開しています ...
virtualbox-7.0 (7.0.14-161095~Ubuntu~jammy) を設定しています ...
addgroup: グループ `vboxusers' はシステムグループとしてすでに存在しています
。終了します。
:

→パッケージ名が「virtualbox-7.0」でインストールされました

-

ちなみに、「sudo chown _apt ...」は下記の警告が表示されるので、その回避策です:
N: ファイル '/home/ubn/ダウンロード/virtualbox/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb' がユーザ '_apt' からアクセスできないため、ダウンロードは root でサンドボックスを通さずに行われます。 - pkgAcquire::Run (13: 許可がありません)

→これは既知のバグです (This is a known bug)

-

6). インストールされたか確認:

$ apt search virtualbox-7.0
virtualbox-7.0/now 7.0.14-161095~Ubuntu~jammy amd64 [インストール済み、ローカル]
  Oracle VM VirtualBox

→「ローカル」の表示に注目:

-

コマンドでバージョンを確認:
$ VBoxManage --version
7.0.14r161095

-

7). 「VirtualBox 7.0.14」を起動して確認:

メニュー →「システム」→「Oracle VM VirtualBox

-

ヘルプ →「VirtualBox について」:

-

ヘルプ表示を確認:

VirtualBox グラフィカルユーザーインターフェース
バージョン 7.0.14 r161095 (Qt5.15.3)

→「閉じる」

-

8). ホストOS のログイン時のユーザが「vboxusers」グループに追加されているか確認:

-

「USB 機能」を使えるようにするには、「VirtualBox」のインストール後に「vboxusers」グループに、現在使用しているユーザを追加します:

ちなみに、VirtualBox インストーラは、「Oracle VM VirtualBox」に必要な USB 機能をサポートするため、「VirtualBox」のインストール中にシステムユーザグループ「vboxusers」を作成します。

VirtualBox ゲスト OS から USB デバイスを使用するシステム ユーザは、このグループに参加する必要があります。

VirtualBox」のインストール後にカーネルの更新があると、この「vboxusers」グループへの参加が解除される場合があります。

-

(1). 現在、ログイン時のユーザが属するグループを確認:
$ id
uid=1000(ubn) gid=1000(ubn) groups=1000(ubn),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare)

もしくは、

$ id ubn
uid=1000(ubn) gid=1000(ubn) groups=1000(ubn),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare)

→「ubn」はユーザ名で任意です

-

「vboxusers」グループが含まれていれば(リスクの高い)下記の操作は要りません:

-

(2). 含まれていなかったので、ログイン時のユーザを「vboxusers」グループに追加しました:

このコマンドは誤入力するとリスクが高いので、慎重に入力:

$ sudo usermod -a -G vboxusers ubn

→「ubn」はユーザ名で任意です

「-a -G」は「-aG」と入力できますが、入力漏れを防ぐために、わざと分けています:

-

「-a -G」または「-aG」を「-G」と入力すると新規作成になり、「vboxuser」以外に属していた他のグループが消えてしまい、「sudo」が使えなくなり、最悪(今回は、ホスト側の)OS の再インストールになります。入力時は注意。

-

(3). 再起動後に、ログイン時のユーザが属するグループを確認:

「端末」以外のすべてのウィンドウを閉じてから、

$ reboot

-

$ id
uid=1000(ubn) gid=1000(ubn) groups=1000(ubn),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare),138(vboxusers)

→「vboxusers」グループが追加されました

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- --

2-3. 任意:「VirtualBox Extension Pack」をインストール:

-

続けて、機能拡張パッケージをインストールしました。

作業は任意です。

-

→「項番 2-1. 4).」で、インストールされている VirtualBox のバージョンと同じバージョンの「拡張パック」をすでにダウンロード済みです:

-


1). 拡張パックで提供される追加機能:

→リモートで使うなら必要だけど、必要がなければ要らない機能です。

-

2). ファイルマネージャで、「~/ダウンロード/virtualbox/」フォルダを開きます:

フォルダ名は任意なので変わります。

-

3). ダウンロードした、緑色で四角のアイコンの「Oracle_VM_VirtualBox_Extension_Pack-7.0.14-161095.vbox-extpack」をダブルクリック:

virtualbox」(「VirtualBox」マネージャ)をインストールしたことで使える機能です:

-

4). 「VirtualBox」マネージャが起動されて、ダイアログが表示:

古いバージョンの機能拡張パッケージがインストールされています。アップグレードしますか?

→「アップグレード」をクリック

-

5). ライセンス画面が表示:

一番下までスクロール:

→「同意します」をクリック

→パスワード入力:

-

6). 「VirtualBox」マネージャの画面に戻りました:

-

7). 「機能拡張」がインストールされたか確認:

左側の「ツール」をクリックして、その右側の「横3本線」ボタンをクリック→「機能拡張」

-

「機能拡張」がインストールされたか確認できます:

→バージョンを確認:

-

左側の「ツール」の右側の「横3本線」ボタンをクリック→「ようこそ」

→元の画面に戻りました:

-

仮想マシン」のひとつをクリック:

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ---

3. 「Xubuntu 22.04 LTS」に、最新の「Vagrant 2.4.1」をインストール:

-

参考:

Vagrant 実践編1:「Ubuntu 22.04」の「仮想マシン」作成と「Box」の共有〈H170-2〉

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----

3-1. 最新の「Vagrant 2.4.1」をダウンロード:

-

1). 最新の「Vagrant」をダウンロード:

ダウンロードのサイト:

-

vagrant_2.4.1-1_amd64.deb

vagrant_2.4.1_SHA256SUMS

-

2). チェックサムが同じか確認:

$ cd ~/ダウンロード/
$ sha256sum vagrant_2.4.1-1_amd64.deb
7d379e99eb757b81f31993634b34a3317d2b79607e2a20dab9b7071f4b278810  vagrant_2.4.1-1_amd64.deb

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- -----

3-2. 「Vagrant 2.4.1」をインストール:

-

1). 「.deb」ファイルから「Vagrant」をインストール:

$ sudo chown _apt /var/lib/update-notifier/package-data-downloads/partial/

-

$ cd ~/ダウンロード/
$ sudo apt install ./vagrant_2.4.1-1_amd64.deb
:
以下のパッケージはアップグレードされます:
  vagrant
アップグレード: 1 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
:
.../vagrant_2.4.1-1_amd64.deb を展開する準備をしています ...
vagrant (2.4.1-1) で (2.4.0-1 に) 上書き展開しています ...
vagrant (2.4.1-1) を設定しています ...

-

ちなみに、「sudo chown _apt ...」は、インストール時に下記の警告が表示されるので、その回避策です:
N: ファイル '/home/ubn/ダウンロード/vagrant_2.4.1-1_amd64.deb' がユーザ '_apt' からアクセスできないため、ダウンロードは root でサンドボックスを通さずに行われます。 - pkgAcquire::Run (13: 許可がありません)

→これは既知のバグです (This is a known bug)

-

2). インストールされたか確認:

$ apt list vagrant -a
vagrant/now 2.4.1-1 amd64 [インストール済み、ローカル]
vagrant/jammy,jammy 2.2.19+dfsg-1ubuntu1 amd64

→「ローカル」の表示に注目:

-

バージョンを確認:
$ vagrant --version
Vagrant 2.4.1

-

3). ホストOS を再起動:

「端末」以外のすべてのウィンドウを閉じてから、

$ reboot

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- -

4. 「Vagrant」で「仮想マシン」を立ち上げて確認:

-

1). 「仮想マシン」の立ち上げ:

$ cd ~/ダウンロード/vm/endeavour-base-jp/
$ vagrant up

-

2). 「仮想マシン」が立ち上がったら、「ssh 接続」:

$ cd ~/ダウンロード/vm/endeavour-base-jp/
$ vagrant ssh

-

3). 作成した「mine」ユーザで操作:

[vagrant@vagrant ~]$ su - mine
Password:     ←(mine ユーザを作成したときのパスワード)
[mine@vagrant ~]$ 

→プロンプトが変わりました

-

4). sudo が使えるか確認:

[mine@vagrant ~]$ sudo date
[sudo] password for mine:      ←(mine ユーザを作成したときのパスワード)
2024年  2月  5日 月曜日 09:21:59 JST

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- --

5. 「仮想マシン」にて「GuestAdditions」を再インストール:

-

「GuestAdditions」を再インストールする手順は「こちら」を参照:

再インストールは、「仮想マシン」の端末から実行しました。

-

→結果が改善。「クリップボードの共有機能」が有効になりました:

-

1). 再インストール後の確認:

-

(1). ホストOS の再起動後、GUI の「ログイン」画面で、ログイン

→デスクトップ画面表示のときに、一瞬だけ表示される、下記のエラー通知が表示されなくなりました:

VBoxClient: the VirtualBox kernel service is not running. Exiting.

-

(2). Windows+Enter で「端末」を起動:
[mine@vagrant ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
(3). 上記の表示を、マウスで範囲選択 →右クリック→「コピー」を選ぶか「C」キー

-

(4). ホストOS のテキストエディタで、Ctrl+V 、または、マウスの中央ボタンで貼付け:
[mine@vagrant ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

→上記がテキストファイルに貼付けできました

-

(5). 「仮想マシン」の「端末」にて動作を確認:

-

仮想マシン」のホームを確認:
[mine@vagrant ~]$ ls -1Ap
.Xauthority
.anthy/
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache/
.config/
.dmrc
.gtkrc-2.0
.local/
.mozilla/
.themes/
.vboxclient-clipboard-tty7-control.pid          ←(動作しました)
.vboxclient-clipboard-tty7-service.pid          ←(動作しました)
.vboxclient-display-svga-x11-tty7-control.pid   ←(動作しました)
.vboxclient-display-svga-x11-tty7-service.pid   ←(動作しました)
.vboxclient-draganddrop-tty7-control.pid        ←(動作しました)
.vboxclient-draganddrop-tty7-service.pid        ←(動作しました)
.vboxclient-hostversion-tty7-control.pid        ←(動作しました)
.vboxclient-seamless-tty7-control.pid           ←(動作しました)
.vboxclient-seamless-tty7-service.pid           ←(動作しました)
.vboxclient-vmsvga-session-tty7-control.pid     ←(動作しました)
.xprofile
.xsession-errors
.xsession-errors.old
Desktop/
Documents/
Downloads/
Music/
Pictures/
Public/
Templates/
Videos/

-

仮想マシン」の id を確認:
[mine@vagrant ~]$ id
uid=1001(mine) gid=1001(mine) groups=1001(mine),3(sys),981(rfkill),998(wheel)

-

(6). 「ホストOS」の「端末」にて確認:
ubn@ubn-box:~/ダウンロード/vm/endeavour-base-jp$ id
uid=1000(ubn) gid=1000(ubn) groups=1000(ubn),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare),138(vboxusers)

→「vboxusers」に注目:

「vboxusers」グループは、ホストOS に接続された「USB」デバイスをゲストOS で認識するときに必要です

なので、「クリップボードの共有機能」とは直接関係ないみたいな気がします

-

-


2). 「エラー通知」の解消、および、「クリップボード共有」機能の改善で行ったこと:

たぶん、「エラー通知」の解消で「クリップボード機能」が改善されたと思います:

-

ホストOS 側:
  1. 「ホストOS」のシステム更新で、たまたま、「カーネルの更新」があったこと:

  2. VirtualBox 7.0.14」と「VirtualBox Extension Pack」のアップデート:

  3. Vagrant 2.4.1」にアップデート:

  4. 「vboxusers」グループをログインユーザに追加:

-

仮想マシン」側:
  1. 仮想マシン」のシステム更新で、たまたま、「カーネルの更新」があったこと:

  2. 仮想マシン」にて「GuestAdditions」のビルドのためのツールを再インストール:

  3. 仮想マシン」にて「GuestAdditions」を再インストール:

-

  • すべての作業完了後に、ホストOS の再起動:

-

行った項目が多すぎて、どれが有効だったか、わかりません:

わかっているのは、「仮想マシン」にて「GuestAdditions」を再インストールしただけでは、改善されなかったということ:

-

合わさっての効果みたいなので、確実なやり方がわからないのがつらいところ:
→「ホストOS」と「仮想マシン」のシステム更新で、たまたま、両方で「カーネルの更新」があったのは、大きそう

もし、タイミングを合わせるなら、更新が長い、ホストOS 側の「LTS のカーネル」の更新に合わせて、他の項目を保留して、すべて合わせて実行するのが(気が長い話で難しいけど)確実かな。

-

-


3). 追記: 確実に「GuestAdditions」をインストールできるやり方が見つかりました:

-

ホストOS 側の「Vagrant」のインストール時に、「vagrant-vbguest」プラグインをインストールしておくと、 (自動でバージョンをチェックして)「GuestAdditions」をインストールしてくれます。

-

(1). 「vagrant-vbguest」プラグインのインストール:
$ vagrant plugin install vagrant-vbguest

-

(2). プラグインをインストールすると、「vagrant up」や「vagrant reload」時、及び「vagrant vbguest」実行時に

「Guest Additions」のバージョンをチェックして、 自動で「Guest Additions」のインストールが行われます

なので、手動でインストールしなくても簡単に「クリップボードの共有」機能などが動くと思います。

-

(3). プラグインをインストールしていれば、今までの作業(投稿)はだいぶ楽だったろうと思います。

→苦労したから、ありがたみがわかるのかな。

-

-


- --- - --- - --- - --- - --- - --- - --- - --- - ----- ----- ---

6. 「仮想マシン」の「GuestAdditions」の再インストールに成功したことで気づいたこと:

-

「GuestAdditions」のインストールが成功して、下記の「エラー通知」が表示されず、うまく機能すると、

クリップボードの共有」機能だけでなく、「リアルタイムの自動解像度の調整」ができるようになりました:

VBoxClient: the VirtualBox kernel service is not running. Exiting.

→上記が表示されなくなると、「VBoxClient」が機能するからみたい:

-

ただし、「仮想マシン」の「Vagrantfile」を修正 して、「vboxsvga」から、「vmsvga」に設定しておきます:

-

-


まとめ

VirtualBox 7.0.14」と「Vagrant 2.4.1」にアップデートしたときに、たまたま、「ホストOS」と「仮想マシン」の両方で「カーネルの更新」があったのは、より多くの項目が実行できたので運が良かったみたい。

おかげで、「クリップボードの共有」機能だけでなく、「リアルタイムの自動解像度の調整」ができるようになりました。

-

いつもうまく行くとは限らないので、この「仮想マシン」を「Box」にして、活用するのが良さそうな気がします。

-

-

-

-


-

-

    目次

-

「投稿の先頭 へ」

-

-


-

「この目次 の先頭へ」

「本編の目次 に戻る」

-