Can't configure network inside Arch linux LXC

iPero

Member
Nov 11, 2018
3
0
6
23
Hi, i was trying to use the Archlinux-base lxc container but i can't get any network configuration to work correctly. On a fresh install it just doesn't connect to the network with the configuration i used, so i tried using dhcpcd with a static ip address set and with this it works, but only if start it manually because if i try using the systemd service it just says missing dependencies and crashes. With every other images it works flawlessy at the first start, so i'm guessing that it's just a problem with a missing configuration on the arch linux container.I'm out of ideas on what may be causing this. Any help is appreciated.

Thanks in advance,
Tommaso.
 
Please provide the container's config and, from inside the container, the output of `systemctl` and `systemctl status systemd-networkd`

Also any audit message happening during the container startup would be useful.
 
Hi, I am not OP, but I'll resurrect the old post, since I believe I've got the same problem.

I've installed the newest PVE 5.3, run it inside a LAN network to spin up a couple of LXC containers for a personal use, so I just use the default network configuration, nothing fancy. Debian LXCs work with network without any problem. Arch LXC created from a downloaded template also worked without a problem, I did a full system upgrade, created some config files (again, nothing fancy, jsut things like vimrc or bashrc) and converted it to a template. Network does not work in LXCs created from that template.

I use DHCP and do not want to use static IPs. Here is the output from the command that may help finding the bug.

Code:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
33: eth0@if34: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 82:84:07:78:7f:46 brd ff:ff:ff:ff:ff:ff link-netnsid 0

Code:
# systemctl
  UNIT                              LOAD   ACTIVE SUB       DESCRIPTION
  -.mount                           loaded active mounted   /
  dev-hugepages.mount               loaded active mounted   Huge Pages File System
  dev-lxc-console.mount             loaded active mounted   /dev/lxc/console
  dev-lxc-tty1.mount                loaded active mounted   /dev/lxc/tty1
  dev-lxc-tty2.mount                loaded active mounted   /dev/lxc/tty2
  dev-mqueue.mount                  loaded active mounted   POSIX Message Queue File System
  dev-ptmx.mount                    loaded active mounted   /dev/ptmx
  proc-cpuinfo.mount                loaded active mounted   /proc/cpuinfo
  proc-diskstats.mount              loaded active mounted   /proc/diskstats
  proc-meminfo.mount                loaded active mounted   /proc/meminfo
  proc-stat.mount                   loaded active mounted   /proc/stat
  proc-swaps.mount                  loaded active mounted   /proc/swaps
  proc-sys-net.mount                loaded active mounted   /proc/sys/net
  proc-sysrq\x2dtrigger.mount       loaded active mounted   /proc/sysrq-trigger
  proc-uptime.mount                 loaded active mounted   /proc/uptime
  run-user-0.mount                  loaded active mounted   /run/user/0
  sys-devices-virtual-net.mount     loaded active mounted   /sys/devices/virtual/net
  sys-fs-fuse-connections.mount     loaded active mounted   FUSE Control File System
  tmp.mount                         loaded active mounted   Temporary Directory (/tmp)
  systemd-ask-password-console.path loaded active waiting   Dispatch Password Requests to Console Directory Watch
  systemd-ask-password-wall.path    loaded active waiting   Forward Password Requests to Wall Directory Watch
  init.scope                        loaded active running   System and Service Manager
  session-390.scope                 loaded active running   Session 390 of user root
  console-getty.service             loaded active running   Console Getty
  container-getty@1.service         loaded active running   Container Getty on /dev/lxc/tty1
  dbus.service                      loaded active running   D-Bus System Message Bus
  sshd.service                      loaded active running   OpenSSH Daemon
  systemd-journal-flush.service     loaded active exited    Flush Journal to Persistent Storage
  systemd-journald.service          loaded active running   Journal Service
  systemd-logind.service            loaded active running   Login Service
* systemd-networkd.service          loaded failed failed    Network Service
  systemd-remount-fs.service        loaded active exited    Remount Root and Kernel File Systems
  systemd-sysctl.service            loaded active exited    Apply Kernel Variables
  systemd-tmpfiles-setup.service    loaded active exited    Create Volatile Files and Directories
  systemd-update-utmp.service       loaded active exited    Update UTMP about System Boot/Shutdown
  systemd-user-sessions.service     loaded active exited    Permit User Sessions
  user-runtime-dir@0.service        loaded active exited    User Runtime Directory /run/user/0
  user@0.service                    loaded active running   User Manager for UID 0
  -.slice                           loaded active active    Root Slice
  system-container\x2dgetty.slice   loaded active active    system-container\x2dgetty.slice
  system-getty.slice                loaded active active    system-getty.slice
  system.slice                      loaded active active    System Slice
  user-0.slice                      loaded active active    User Slice of UID 0
  user.slice                        loaded active active    User and Session Slice
  dbus.socket                       loaded active running   D-Bus System Message Bus Socket
  dm-event.socket                   loaded active listening Device-mapper event daemon FIFOs
  systemd-coredump.socket           loaded active listening Process Core Dump Socket
  systemd-initctl.socket            loaded active listening initctl Compatibility Named Pipe
  systemd-journald-audit.socket     loaded active running   Journal Audit Socket
  systemd-journald-dev-log.socket   loaded active running   Journal Socket (/dev/log)
  systemd-journald.socket           loaded active running   Journal Socket
  basic.target                      loaded active active    Basic System
  cryptsetup.target                 loaded active active    Local Encrypted Volumes
  getty.target                      loaded active active    Login Prompts

Code:
# systemctl status systemd-networkd
* systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-01-11 10:44:52 CET; 24min ago
     Docs: man:systemd-networkd.service(8)
  Process: 80 ExecStart=/usr/lib/systemd/systemd-networkd (code=exited, status=226/NAMESPACE)
 Main PID: 80 (code=exited, status=226/NAMESPACE)

Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Jan 11 10:44:52 q3 systemd[1]: Failed to start Network Service.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Service has no hold-off time (RestartSec=0), scheduling restart.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 5.
Jan 11 10:44:52 q3 systemd[1]: Stopped Network Service.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Start request repeated too quickly.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Jan 11 10:44:52 q3 systemd[1]: Failed to start Network Service.

Code:
# journalctl -xe
--
-- The job identifier is 234 and the job result is failed.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Service has no hold-off time (RestartSec=0), scheduling restart.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
--
-- Automatic restarting of the unit systemd-networkd.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Jan 11 10:44:52 q3 systemd[1]: Stopped Network Service.
-- Subject: A stop job for unit systemd-networkd.service has finished
-- Defined-By: systemd
--
-- A stop job for unit systemd-networkd.service has finished.
--
-- The job identifier is 239 and the job result is done.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Start request repeated too quickly.
Jan 11 10:44:52 q3 systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
--
-- The unit systemd-networkd.service has entered the 'failed' state with result 'exit-code'.
Jan 11 10:44:52 q3 systemd[1]: Failed to start Network Service.
-- Subject: A start job for unit systemd-networkd.service has failed
-- Defined-By: systemd
--
-- A start job for unit systemd-networkd.service has finished with a failure.
--
-- The job identifier is 239 and the job result is failed.
Jan 11 10:59:12 q3 systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: A start job for unit systemd-tmpfiles-clean.service has begun execution
-- Defined-By: systemd
--
-- A start job for unit systemd-tmpfiles-clean.service has begun execution.
--
-- The job identifier is 244.
Jan 11 10:59:12 q3 systemd[1]: systemd-tmpfiles-clean.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
--
-- The unit systemd-tmpfiles-clean.service has successfully entered the 'dead' state.
Jan 11 10:59:12 q3 systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: A start job for unit systemd-tmpfiles-clean.service has finished successfully
-- Defined-By: systemd
--
-- A start job for unit systemd-tmpfiles-clean.service has finished successfully.
--
-- The job identifier is 244.

When I start dhcpcd via systemd I also get some errors:

Code:
# systemctl start dhcpcd
# systemctl status dhcpcd
* dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-01-11 11:11:53 CET; 3s ago
  Process: 110 ExecStart=/usr/bin/dhcpcd -q -b (code=exited, status=0/SUCCESS)
 Main PID: 112 (dhcpcd)
    Tasks: 1 (limit: 4915)
   Memory: 1.0M
   CGroup: /system.slice/dhcpcd.service
           `-112 /usr/bin/dhcpcd -q -b

Jan 11 11:11:53 q3 systemd[1]: Starting dhcpcd on all interfaces...
Jan 11 11:11:53 q3 dhcpcd[110]: dev: loaded udev
Jan 11 11:11:53 q3 dhcpcd[110]: no valid interfaces found
Jan 11 11:11:53 q3 dhcpcd[110]: no valid interfaces found
Jan 11 11:11:53 q3 dhcpcd[110]: forked to background, child pid 112
Jan 11 11:11:53 q3 systemd[1]: Started dhcpcd on all interfaces.
# systemctl stop dhcpcd

Also no luck using dhcpcd@ service:
Code:
# systemctl start dhcpcd@eth0
A dependency job for dhcpcd@eth0.service failed. See 'journalctl -xe' for details.
# systemctl status dhcpcd@eth0
* dhcpcd@eth0.service - dhcpcd on eth0
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

# journalctl -xe
Jan 11 10:27:50 q3 systemd[1]: Dependency failed for dhcpcd on eth0.
Jan 11 10:27:50 q3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
Jan 11 10:33:14 q3 systemd[1]: Dependency failed for dhcpcd on eth0.
Jan 11 10:33:14 q3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
Jan 11 10:33:59 q3 systemd[1]: Dependency failed for dhcpcd on eth0.
Jan 11 10:33:59 q3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
Jan 11 11:12:24 q3 systemd[1]: Dependency failed for dhcpcd on eth0.
Jan 11 11:12:24 q3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
-- The job identifier is 325 and the job result is done.
Jan 11 11:12:24 q3 systemd[1]: Starting of /sys/subsystem/net/devices/eth0 not supported.
-- Subject: A start job for unit sys-subsystem-net-devices-eth0.device has failed
-- Defined-By: systemd
--
-- A start job for unit sys-subsystem-net-devices-eth0.device has finished with a failure.
--
-- The job identifier is 373 and the job result is unsupported.
Jan 11 11:12:24 q3 systemd[1]: Dependency failed for dhcpcd on eth0.
-- Subject: A start job for unit dhcpcd@eth0.service has failed
-- Defined-By: systemd
--
-- A start job for unit dhcpcd@eth0.service has finished with a failure.
--
-- The job identifier is 326 and the job result is dependency.
Jan 11 11:12:24 q3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
Jan 11 11:12:24 q3 systemd[1]: Created slice system-dhcpcd.slice.
-- Subject: A start job for unit system-dhcpcd.slice has finished successfully
-- Defined-By: systemd
--
-- A start job for unit system-dhcpcd.slice has finished successfully.
--
-- The job identifier is 372.

What is weird, I can obtain an IP address by using dhcpcd directly:

Code:
# dhcpcd eth0
eth0: waiting for carrier
eth0: carrier acquired
DUID 00:04:fb:e2:af:00:a7:7b:11:e3:a4:e3:c0:3f:d5:62:a3:49
eth0: IAID 07:78:7f:46
eth0: adding address fe80::f2a7:fb0a:92bf:3694
eth0: soliciting an IPv6 router
eth0: rebinding lease of 192.168.162.8
eth0: probing address 192.168.162.8/21
eth0: leased 192.168.162.8 for 7200 seconds
eth0: adding route to 192.168.160.0/21
eth0: adding default route via 192.168.160.1
forked to background, child pid 153
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
33: eth0@if34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 82:84:07:78:7f:46 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.162.8/21 brd 192.168.167.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::f2a7:fb0a:92bf:3694/64 scope link
       valid_lft forever preferred_lft forever
 
Last edited:
I've installed the newest PVE 5.3, run it inside a LAN network to spin up a couple of LXC containers for a personal use, so I just use the default network configuration, nothing fancy. Debian LXCs work with network without any problem. Arch LXC created from a downloaded template also worked without a problem, I did a full system upgrade, created some config files (again, nothing fancy, jsut things like vimrc or bashrc) and converted it to a template. Network does not work in LXCs created from that template.

Hi.

This problem you have at the moment is a current/new bug.

More info here:
https://github.com/lxc/lxc/issues/2778
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1811248
 
  • Like
Reactions: Jakub Matraszek
Hi,
I had a similar problem. What works for me now:
  • create a new lxc container using archlinux-base_20171214-1_amd64.tar.gz
  • Set /etc/pacman.d/mirrorlist to:
    Server=https://archive.archlinux.org/repos/2018/11/17/$repo/os/$arch
Using an old repo was not very wise. I rather would call that now "temporary fix" instead of "works for me". For this reason I striked the preceding paragraph.

This is the better approach: setting features: nesting=1 in the options for the Arch Linux lxc.
Source: https://forum.proxmox.com/threads/archlinux-lxc-systemd-v240.51210/

Maybe that helps someone...

Kind regards,
Bernd
 
Last edited:
  • Like
Reactions: rcd and katt

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!