Fedora 41 への incus のインストールと最小限の動作確認

作業はHyper-V上のVM内で実施。
ホストのWindowsのバージョンは Microsoft Windows [Version 10.0.26100.3624]
VMは入れ子仮想化有効化済み。
●VM内のFedoraのバージョン情報
$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="41 (Workstation Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:41"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=41
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=41
SUPPORT_END=2025-12-15
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Incus公式およびRockyLinuxのドキュメントを参考にした。
以下root権限で実行
# パッケージ類を最新化
$ dnf upgrade
# incus をインストール
$ dnf install incus
# wheel, incus-admin グループに通常incusを操作するユーザを追加
$ usemod -a -G wheel, incus-admin ${username}
# incus を起動
$ systemctl enable --now incus
# /etc/subgid および /etc/subuid を更新
# すでに `root:1000000:1000000000` が記載されている場合は不要
$ echo root:1000000:1000000000 >> /etc/subgid
$ echo root:1000000:1000000000 >> /etc/subuid
# 一度再起動
$ shutdown -r now

以降は上で incus-admin グループに追加したユーザで実行
$ incus admin init
# クラスタリングやストレージプールなど対話形式で聞かれるので適宜答える。動作確認のみなら全てデフォルトで良い
$ incus remote list
# +----------------+------------------------------------+---------------+-------------+--------+--------+--------+
# | NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | GLOBAL |
# +----------------+------------------------------------+---------------+-------------+--------+--------+--------+
# | images | https://images.linuxcontainers.org | simplestreams | none | YES | NO | NO |
# +----------------+------------------------------------+---------------+-------------+--------+--------+--------+
# | local (現在値) | unix:// | incus | file access | NO | YES | NO |
# +----------------+------------------------------------+---------------+-------------+--------+--------+--------+
# https://images.linuxcontainers.org/ にあるイメージを ${distribution}/${version} で指定する
# almalinux 9 を alma9 という名前で起動する場合
$ incus launch images:almalinux/9 alma9
# 起動したインスタンスを確認
$ incus list
# +-------+---------+------+------+-----------+-----------+
# | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
# +-------+---------+------+------+-----------+-----------+
# | alma9 | RUNNING | | | CONTAINER | 0 |
# +-------+---------+------+------+-----------+-----------+

トラブルシュート
incus admin init
した際に Error: ローカルデーモンへの接続に失敗しました: Get "http://unix.socket/1.0": dial unix /var/lib/incus/unix.socket: connect: no such file or directory
→ incusdが起動していない。systemctl enable --now incus
を実行する
incus
コマンド実行時に Error: You don't have the needed permissions to talk to the incus daemon (socket path: /run/incus/unix.socket)
→ root権限で実行していない、またはincus-admin
グループに所属していないユーザーで実行している
incus launch ~
実行時に Error: Failed instance creation: Failed creating instance record: Failed initializing instance: Invalid config: No uid/gid allocation configured. In this mode, only privileged containers are supported
→ /etc/subgid
と /etc/subuid
の中身を確認する

起動したインスタンスへの接続
$ incus exec ${instance_name} bash

起動したインスタンスにipv4アドレスが割り振られず、インスタンス内からインターネットへでられなかった(インスタンスはいずれもデフォルトのincusbr0
ブリッジに接続)
結論としては下の2つの対応で解消
- ホストにインストールされていたdockerをアンインストール
$ sudo dnf remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# 一度再起動
- firewallの設定を変更
具体的には以下のコマンドを流した。
https://linuxcontainers.org/incus/docs/main/howto/network_bridge_firewalld/#firewalld-add-the-bridge-to-the-trusted-zone
$ sudo firewall-cmd --zone=trusted --change-interface=incusbr0 --permanent
$ sudo firewall-cmd --reload
- 各インスタンスを再起動

ipv4が割り当てられないとき
$ incus list
+--------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+------+------+-----------+-----------+
| alma9 | RUNNING | | | CONTAINER | 0 |
+--------+---------+------+------+-----------+-----------+
| second | RUNNING | | | CONTAINER | 0 |
+--------+---------+------+------+-----------+-----------+
| third | RUNNING | | | CONTAINER | 0 |
+--------+---------+------+------+-----------+-----------+
ipv4が割り当てられているとき
$ incus list
+--------+---------+---------------------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+---------------------+------+-----------+-----------+
| alma9 | RUNNING | 10.42.54.135 (eth0) | | CONTAINER | 0 |
+--------+---------+---------------------+------+-----------+-----------+
| second | RUNNING | 10.42.54.18 (eth0) | | CONTAINER | 0 |
+--------+---------+---------------------+------+-----------+-----------+
| third | RUNNING | 10.42.54.137 (eth0) | | CONTAINER | 0 |
+--------+---------+---------------------+------+-----------+-----------+