Interfaces in the Network menu - NethServer 7 on LXC

Anyone who has tried to install and use NethServer 7 inside an LXC Container should have realized that there were no Interfaces in the Network menu, debugging a little I discovered that the villain was the directory “/sys/class/net/${card}/device” which did not exist by causing the script “/usr/libexec/nethserver/nic-info” to return no interface. I’m posting my “correction”, I hope you enjoy it.

nic-info.patch

3 Likes

Thanks, this is really interesting but the link is not working…

True, I think I copied the wrong link or it expired, sorry, but now it’s fixed.

1 Like

Thank you for the contribution, I would like to include it in base rpm!

I took a look to the patch but I think there are still one issue.
The systemd-detect-virtexits with 0 even if the machine is a non-LXC virtual machine.
For example, inside my VirtualBox, systemd-detect-virt says the machine is virtual, but the interface names are not “veth”.

I think you should handle different scenarios. Something like:

  1. the machine is physical, use the old code
  2. the machine is a VM with emulated interface, use the old code
  3. the machine is a container, try to find all veth (or any other name) virtual interfaces
1 Like

You’re right, I did not realize, but there is a “–container” option to detect containers.

Now I think it’s good!