Network-manager ethernet issue


#1

Hello,

I have a problem with my network-manager snap on my rpi3. I’ve installed the network-manager snap and enabled ethernet (as described here: https://docs.ubuntu.com/core/en/stacks/network/network-manager/docs/reference/configuration/ethernet_support).

When I change the ethernet connection via nmcli (from my application) the new settings are taken over in the network-manager (I see the right settings afterwards via nmcli c …) but I get the following error and the connection is not established.

nmcli return 1 code. STDERR='Error: Failed to modify connection 'netplan-eth0': error writing to file '/run/NetworkManager/system-connections/netplan-eth0': Failed to create file '/run/NetworkManager/system-connections/netplan-eth0.ZVRATZ': Permission denied

Afterwards the network-manager is trying to connect my ethernet connection without success. Here some information from the logs:

Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9049] dhcp4 (eth0): state changed unknown -> timeout
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9159] dhcp4 (eth0): canceled DHCP transaction
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9161] dhcp4 (eth0): state changed timeout -> done
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9174] device (eth0): state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]
Nov 30 07:26:11 localhost NetworkManager[1251]: <warn>  [1543562771.9197] device (eth0): Activation: failed for connection 'netplan-eth0'
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9232] device (eth0): state change: failed -> disconnected (reason 'none') [120 30 0]
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9294] policy: Device 'eth0' has no connection; scheduling activate_check in 0 seconds.
Nov 30 07:26:11 localhost NetworkManager[1251]: <warn>  [1543562771.9322] device (eth0): failed to find device 2 'eth0' with udev
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9385] policy: auto-activating connection 'netplan-eth0'
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9460] device (eth0): Activation: starting connection 'netplan-eth0' (04d79829-8fbf-3091-8dac-4378e0daab6d)
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9471] device (eth0): state change: disconnected -> prepare (reason 'none') [30 40 0]
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9506] device (eth0): state change: prepare -> config (reason 'none') [40 50 0]
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9536] device (eth0): state change: config -> ip-config (reason 'none') [50 70 0]
Nov 30 07:26:11 localhost NetworkManager[1251]: <info>  [1543562771.9562] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds)
Nov 30 07:26:11 localhost NetworkManager[1251]: <warn>  [1543562771.9612] device (eth0): failed to find device 2 'eth0' with udev
Nov 30 07:26:42 localhost rsyslogd-2007: action 'action 10' suspended, next retry is Fri Nov 30 07:27:12 2018 [v8.16.0 try http://www.rsyslog.com/e/2007 ]
Nov 30 07:26:56 localhost NetworkManager[1251]: <warn>  [1543562816.9013] dhcp4 (eth0): request timed out
Nov 30 07:26:56 localhost NetworkManager[1251]: <info>  [1543562816.9015] dhcp4 (eth0): state changed unknown -> timeout
Nov 30 07:26:56 localhost NetworkManager[1251]: <info>  [1543562816.9159] dhcp4 (eth0): canceled DHCP transaction
Nov 30 07:26:56 localhost NetworkManager[1251]: <info>  [1543562816.9161] dhcp4 (eth0): state changed timeout -> done
Nov 30 07:26:56 localhost NetworkManager[1251]: <info>  [1543562816.9175] device (eth0): state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]

I’ve connected all necessary snap interfaces.

My snap versions:

 snap    2.36.1
 snapd   2.36.1
 series  16
 kernel  4.4.0-1100-raspi2

My snaps:

classic               16.04              42    edge      canonical✓  devmode
core                  16-2.36.1          5898  stable    canonical✓  core
network-manager       1.2.2-17           315   stable    canonical✓  -
pi2-kernel            4.4.0-1100.108     78    stable    canonical✓  kernel
pi3                   16.04-0.6          27    stable    canonical✓  gadget
snappy-debug          0.31.7-snapd2.34   246   stable    canonical✓  -
wifi-ap               18                 210   stable    canonical✓  -

Would be great if you could give me a hint on my problem ;).
Thanks a lot


#2

Some more observations:

  1. If I change the ethernet connection manually via nmcli from console (and not from an application) I get the same error and after a restart of the rpi my setting is gone.
sudo nmcli c mod netplan-eth0 ipv4.method manual
Error: Failed to modify connection 'netplan-eth0': error writing to file '/run/NetworkManager/system-connections/netplan-eth0': Failed to create file '/run/NetworkManager/system-connections/netplan-eth0.5KNFTZ': Permission denied
  1. What does the following sentence mean from the network-manager snap documentation (https://docs.ubuntu.com/core/en/stacks/network/network-manager/docs/reference/configuration/ethernet_support) mean? Is it just not possible to change the ethernet connection settings with the network-manager?
NetworkManager will reuse existing configurations files from /etc/netplan when ethernet support is enabled. Those will marked as immutable inside NetworkManager and any changes need to be written manually into the relevant files in /etc/netplan.
  1. My netplan files look as follows:

00-snapd-config.yaml:

# This is the network config written by 'console_conf'
network:
  ethernets:
    eth0:
      addresses: []
      dhcp4: true
  version: 2

00-default-nm-renderer.yaml :

network:
  renderer: NetworkManager

I am bit puzzled regarding the ethernet settings via network-manager. Maybe someone has an idea what my issue is.
Thanks


#3

perhaps @abeato or @awe could help here …


#4

@getty23 are you getting apparmor denials? Please take a look at dmesg output after running the failed nmcli command.

Also, which is the output of nmcli d and networkctl?


#5

Thanks for your input.
When I run the command from above (nmcli c …) to change my ethernet connection settings I get the following apparmor denials:

[  100.045813] audit: type=1400 audit(1543909469.459:93): apparmor="DENIED" operation="ptrace" profile="snap.network-manager.networkmanager" pid=1246 comm="NetworkManager" requested_mask="trace" denied_mask="trace" peer="snap.network-manager.nmcli"
[  100.122892] audit: type=1400 audit(1543909469.535:94): apparmor="DENIED" operation="ptrace" profile="snap.network-manager.networkmanager" pid=1246 comm="NetworkManager" requested_mask="trace" denied_mask="trace" peer="snap.network-manager.nmcli"
[  100.259355] audit: type=1400 audit(1543909469.671:95): apparmor="DENIED" operation="ptrace" profile="snap.network-manager.networkmanager" pid=1246 comm="NetworkManager" requested_mask="trace" denied_mask="trace" peer="snap.network-manager.nmcli"
[  100.281891] audit: type=1400 audit(1543909469.695:96): apparmor="DENIED" operation="ptrace" profile="snap.network-manager.networkmanager" pid=1246 comm="NetworkManager" requested_mask="trace" denied_mask="trace" peer="snap.network-manager.nmcli"
[  100.293662] audit: type=1400 audit(1543909469.707:97): apparmor="DENIED" operation="mknod" profile="snap.network-manager.networkmanager" name="/run/NetworkManager/system-connections/netplan-eth0.IK0QTZ" pid=1246 comm="NetworkManager" requested_mask="c" denied_mask="c" fsuid=0 ouid=0

Output for nmcli d:

DEVICE  TYPE      STATE      CONNECTION     
eth0    ethernet  connected  netplan-eth0   
wlan0   wifi      connected  FRITZ!Box 7312 
lo      loopback  unmanaged  --  

And networkctl:

WARNING: systemd-networkd is not running, output will be incomplete.

IDX LINK             TYPE               OPERATIONAL SETUP     
  1 lo               loopback           n/a         unmanaged 
  2 eth0             ether              n/a         unmanaged 
  3 wlan0            wlan               n/a         unmanaged 

3 links listed.

What is interesting is that after I have executed the nmcli command to set the ethernet method to manual, my ethernet connection is actually working. So somehow he is picking up the setting but after a restart the setting is gone again.

Thanks for your support


#6

The denial when writing to /run/NetworkManager/system-connections/netplan-eth0.IK0QTZ is the problem here (you can safely ignore the other denials). Writing there is not allowed by the network-manager interface. This can be an interface bug, but usually connections are stored in

/var/snap/network-manager/current/conf/system-connections/

I think this is happening because the connection was created by netplan. What happens if you remove 00-snapd-config.yaml and re-start? Can you then configure as you wish the eth0 interface connection?


#7

Thanks a lot, you made my day :slight_smile: . After removing the 00-snapd-config.yaml it is working fine.

Though what is the best way from network setup perspective for my target scenario:
I just want to create a device image which I do not have to configure but which is starting with an access point and via a webpage (or app) I can pass the wifi credentials. I have the AP and webserver running and this is working but I am wondering how I can skip the initiate phase of Ubuntu core (where I setup wifi and register the device with my Ubuntu user)?

Thanks


#8

You can disable console-conf for that, see Disabling console-conf from gadget or core config option