hack のためのネタ帳, etc,,,

状況

VirtualBox で Btrfs 上に debootstrap と chroot で構築した ubuntu-desktop-minimal 環境で、NIC が NetworkManager の管理下に入ってくれない。
具体的には gnome-shell 右上のポップアップメニューに LAN 関連の項目が出ず、settings の Network でも Not set up となっており、enp0s3 が勝手に接続してくれないし手動でも追加できない。

nmcli でも
$ nmcli d
DEVICE  TYPE      STATE      CONNECTION 
enp0s3  ethernet  unmanaged  --         
lo      loopback  unmanaged  --    
みたいな感じで、
$ nmcli c add type ethernet ifname enp0s3 con-name "Ethernet connection 1"
Connection 'Ethernet connection 1' (********-****-****-****-************) successfully added.
みたいに connection 作成しても
$ nmcli c up "Ethernet connection 1"
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).
$ nmcli d con enp0s3
Error: Failed to add/activate new connection: Connection 'enp0s3' is not available on device enp0s3 because device is strictly unmanaged
みたいな感じで strictly unmanaged と言われて enp0s3 を activate 出来ない。

ググってみると
  • /etc/NetworkManager/NetworkManager.conf で managed=true にしろ
  • /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf で unmanaged-devices に except:type:ethernet 追加しろ
みたいな情報が出て来るんだけど、
少なくともベアメタルや VM 上に通常の方法でインストールした desktop 環境を確認しても、それらの設定は行われてなくても NetworkManager の管理下に入ってる。

解法

しばらく悩んだのだが、NIC が自動的に NetworkManager の管理下に入ってる環境と比べてみたところ問題は、
/etc/netplan 以下の設定の有無にありそうな雰囲気。
問題の環境では、このディレクトリが空なのに対して、
NetworkManager が NIC を自動管理してる環境には 01-network-manager-all.yaml が存在しており、以下のような内容になっていた。
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

で、問題のある環境にこのファイルを追加してみて
netplan try
した状態で
systemctrl restart NetworkManager
してみると無事
$ nmcli d con enp0s3
Device 'enp0s3' successfully activated with '********-****-****-****-************'.
となって、自動的に DHCP 引いてくれて疎通した。

あとは、設定の反映保留中の netplan try で ENTER 叩いて設定を accept して完了。
$ sudo netplan try
Do you want to keep these settings?


Press ENTER before the timeout to accept the new configuration


Changes will revert in  44 seconds
Configuration accepted.

で、/etc/netplan/01-network-manager-all.yaml を生成してるのはどの子なの?
apt-file で探してみるが見当たらないので、スクリプトで生成されてる?
インストーラーかな?

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

管理人/副管理人のみ編集できます