Networkmanager Could not activate connection: Connection 'eth0' is not available on device eth0 because device is strictly unmanaged

Hello,

i want to install Rockylinux9 on my VPS on euserv.com.

The vps is an lxc container.
My main interface name is eth0. Then i try to configure my vps with nmtui i got
Could not activate connection: Connection ‘eth0’ is not available on device eth0 because device is strictly unmanaged.

I have tried to force eth0 to management possible like in ubuntu. But nothing works have you any solution for me ?

Hello @lipkowski.be and welcome!

I’ve run into similar issues with LXD and I’ve got to say, whether or not you will be able to resolve this depends on your access rights. If I recall correctly, Network Manager is not installed by default on an LXD container. There is a document on our site that might help here, specifically the section dealing with “Rocky Linux macvlan”.

Thanks,
Steve

Hello Steve,

thanks for your help but…

I have no access to the hostnode part of this lxc system i have only access to the container itself.
My OS is an image of the standard Rockylinux9 installed via cd (absolut base system). Networkmanager is installed as default. I don’t want to go the ‘hacky way’ and configure the network with iptools2(ip add etc). I will create a clear standard system. If i rename the interface from eth0 to net0 via iptools2, reconfigure network-manager from eth0 to net0 and restart network-manager it works to0 but only until the next boot. Is there a way to remove the ‘strictly unmanged’ state from eth0?

I was afraid of that. Can you script the entire process you ran and run it in a cron with an @reboot option? That would work, but to my knowledge, there is no way to remove the unmanaged state on eth0. This is what I’m talking about scripting:

If i rename the interface from eth0 to net0 via iptools2, reconfigure network-manager from eth0 to net0 and restart network-manager it works to0 but only until the next boot.

I just tried this on my lab machine and it worked. I don’t know what exactly you are trying to accomplish as far as configuring the interface, but I used setting a static IP address as the example. Created a script in /usr/local/sbin called “static”, which contains these lines:

/usr/sbin/ip link set dev eth0 name net0
sleep 3
/usr/sbin/ip addr add 192.168.1.151/24 dev net0

The sleep 3 lines may not be necessary.

Then in side the container, set the following crontab for root:

@reboot    /usr/local/sbin/static

On reboot of the container, the device was renamed and the static IP applied.

Hi,

i know that renaming and static ip assigment works (like you has discribed). But this is not a clear way for an os ip configuration i think. The default of Rockylinux 9 is Networkmanager i read in the docs. So is search a way to configure the interfaces with Networkmanager. But thanks for your help. I check if it is possible to start link renaming script via systemd before networkmanager starts than its not possible to use eth0 dedicated. I think there is a config file i have not seen.

Let me know how it goes. I will be curious to see if you find a solution that works for you.

Hi,

i have found a solution for me. This solution require 2 files and 2 systemd scripts.

1.) Move your Networkmanager connection from eth0 to net0 if not already done.
2.) Create dir for scripts

mkdir -p /opt/nm-if

3.) Create script for rename eth0 to net0 (vim /opt/nm-if/nm-if-rename.bash)

#!/bin/bash

function nm-if-rename
{
	local v_if=''
	local v_if_new=''
	
	while read v_if 
	do 
		if [ -n "${v_if}" ]
		then
			v_if_new="$(echo "${v_if}" | sed 's/eth/net/')"
			/usr/sbin/ip link set "${v_if}" down
			/usr/sbin/ip link set "${v_if}" name "${v_if_new}"
			/usr/sbin/ip link set "${v_if_new}" up
		fi

	done <<< "$(ls -1 /sys/class/net/ | grep -E '^eth')"
}

nm-if-rename

4.) Create script for force Networkmanager to manage connectios (vim /opt/nm-if/nm-if-manage.bash)

#!/bin/bash

function nm-if-manage
{
	local v_if=''
	
	while read v_if 
	do 
		if [ -n "${v_if}" ]
		then
			/usr/bin/nmcli dev set "${v_if}" managed yes
		fi

	done <<< "$(ls -1 /sys/class/net/ | grep -E '^net')"
}

nm-if-manage

5.) Create systemd script for interface rename (vim /etc/systemd/system/nm-if-rename.service)

[Unit]
Description=nm-if-rename service

[Service]
Type=simple
ExecStart=/opt/nm-if/nm-if-rename.bash

[Install]
WantedBy=network-pre.target

6.) Create systemd script for interface manage (vim /etc/systemd/system/nm-if-manage.service)

[Unit]
Description=nm-if-manage service
After=NetworkManager.service

[Service]
Type=simple
ExecStart=/opt/nm-if/nm-if-manage.bash

[Install]
WantedBy=multi-user.target

7.) Set rights for script, reload systemd and enable scripts

chmod +x /opt/nm-if/nm-if-rename.bash
chmod +x /opt/nm-if/nm-if-manage.bash
chmod 664 /etc/systemd/system/nm-if-rename.service
chmod 664 /etc/systemd/system/nm-if-manage.service

systemctl daemon-reload
systemctl enable nm-if-rename
systemctl enable nm-if-manage

8.) Reboot

reboot