LXD で Gentoo を使う


Ubuntu 20.04 にインストールされた lxd 4.6 に Gentoo をインストールし設定する方法です。
インストールが完了してログインすると次のようになります。

次のページを参考にしました。
Gentoo LXD Container

FINGERPRINT を調べる

$ lxc image list images: | grep gentoo | grep amd64
| gentoo (5 more)                      | 89bf8edf7286 | yes    | Gentoo current amd64 (20201011_16:07)        | x86_64       | CONTAINER       | 218.01MB  | Oct 11, 2020 at 12:00am (UTC) |
| gentoo (5 more)                      | ae2b048f399a | yes    | Gentoo current amd64 (20201011_16:07)        | x86_64       | VIRTUAL-MACHINE | 735.06MB  | Oct 11, 2020 at 12:00am (UTC) |
| gentoo/cloud (3 more)                | c52b0ac7178e | yes    | Gentoo current amd64 (20201011_16:07)        | x86_64       | CONTAINER       | 278.44MB  | Oct 11, 2020 at 12:00am (UTC) |
| gentoo/cloud (3 more)                | cb841577909c | yes    | Gentoo current amd64 (20201011_16:07)        | x86_64       | VIRTUAL-MACHINE | 756.13MB  | Oct 11, 2020 at 12:00am (UTC) |

OS のインストール

lxc init images:89bf8edf7286 gentoo

root パスワードの設定

$ lxc exec gentoo bash
gentoo ~ # passwd
New password: 
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new password: 
passwd: password updated successfully

root で login

$ lxc console gentoo
To detach from the console, press: <ctrl>+a q

gentoo login: root
Password: 
Last login: Sun Oct 11 23:40:16 -00 2020 on console
-bash: cannot set terminal process group (714): Inappropriate ioctl for device
-bash: no job control in this shell
gentoo ~ #

login 後の設定

ユーザー、パスワードの設定

useradd -u 1200 -m -G users,wheel,audio -s /bin/bash uchida
passwd uchida

sudo

emerge -avt app-admin/sudo --quiet
visudo

次のエラーが出た場合の対応方法

gentoo ~ # emerge -avt app-admin/sudo --quiet


!!! /etc/portage/make.profile is not a symlink and will probably prevent most merges.
!!! It should point into a profile within /var/db/repos/gentoo/profiles/
!!! (You can safely ignore this message when syncing. It's harmless.)


!!! Your current profile is invalid. If you have just changed your profile
!!! configuration, you should revert back to the previous configuration.
!!! Allowed actions are limited to --help, --info, --search, --sync, and
!!! --version.
gentoo ~ # emerge-webrsync

sshd

sudo emerge -avt openssh --quiet
sudo rc-update add sshd default
sudo rc-service sshd start

avahi

sudo emerge --ask net-dns/avahi --quiet
sudo rc-update add avahi-daemon default
sudo rc-service avahi-daemon  start