LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   LXC: Failed to talk to init daemon and other errors (https://www.linuxquestions.org/questions/slackware-14/lxc-failed-to-talk-to-init-daemon-and-other-errors-4175624440/)

masayk 02-25-2018 12:50 PM

LXC: Failed to talk to init daemon and other errors
 
Hello!

I have an issue with LXC. I create under root a new container with command "lxc-create -n c7 -t download", then choose centos-7-amd64. It installs it. After that, if I do not setup network settings, I can lunch it with "lxc-start -d -n c7" command and even attach to it, but I cannot almost do anything.

For example, if I try reboot:
Quote:

root@c7:~# reboot
Failed to talk to init daemon.
If I set up network settings in the config file, than it doesn't start after that:
Quote:

lxc-start 20180225183041.667 ERROR lxc_network - network.c:setup_hw_addr:2680 - Failed to perform ioctl: Cannot assign requested address
lxc-start 20180225183041.667 ERROR lxc_network - network.c:lxc_setup_netdev_in_child_namespaces:2821 - Failed to setup hw address for network device "eth0"
lxc-start 20180225183041.667 ERROR lxc_network - network.c:lxc_setup_network_in_child_namespaces:2963 - failed to setup netdev
lxc-start 20180225183041.667 ERROR lxc_conf - conf.c:lxc_setup:3097 - failed to setup the network for 'c7'
lxc-start 20180225183041.667 ERROR lxc_start - start.c:do_start:1020 - Failed to setup container "c7".
lxc-start 20180225183041.667 ERROR lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 5)
lxc-start 20180225183041.692 ERROR lxc_container - lxccontainer.c:wait_on_daemonized_start:754 - Received container state "ABORTING" instead of "RUNNING"
lxc-start 20180225183041.692 ERROR lxc_start - start.c:__lxc_start:1530 - Failed to spawn container "c7".
lxc-start 20180225183041.692 ERROR lxc_start_ui - tools/lxc_start.c:main:368 - The container failed to start.
lxc-start 20180225183041.692 ERROR lxc_start_ui - tools/lxc_start.c:main:370 - To get more details, run the container in foreground mode.
lxc-start 20180225183041.692 ERROR lxc_start_ui - tools/lxc_start.c:main:372 - Additional information can be obtained by setting the --logfile and --logpriority options.
My host system is Slackware64-current.

Container config file:
Quote:

root@lion:/var/lib/lxc/c7# cat config
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template: --flush-cache
# Template script checksum (SHA-1): 01d100d3f1129082777c82a0e3a66adcaeb5c37f
# For additional config options, please look at lxc.container.conf(5)

# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)


# Distribution configuration
lxc.include = /usr/share/lxc/config/centos.common.conf
lxc.arch = x86_64

# Container specific configuration
lxc.rootfs = /var/lib/lxc/c7/rootfs
lxc.rootfs.backend = dir
lxc.utsname = c7

# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 01:26:3e:3c:f5:c3
lxc.network.mtu = 1500
Can you give me an advice how to fix it? Thank you!

chris.willing 02-25-2018 07:57 PM

Quote:

Originally Posted by masayk (Post 5824101)
Hello!

I have an issue with LXC. I create under root a new container with command "lxc-create -n c7 -t download", then choose centos-7-amd64. It installs it. After that, if I do not setup network settings, I can lunch it with "lxc-start -d -n c7" command and even attach to it, but I cannot almost do anything.

What do you mean by
Quote:

if I do not setup network settings
The network seems already set up and when I executed similar commands, it all ran as expected:
Quote:

chris@d6:~$ sudo lxc-start -n c7
chris@d6:~$ sudo lxc-attach -n c7
root@c7:/# ping www.uq.edu.au
PING www.uq.edu.au (130.102.131.123) 56(84) bytes of data.
64 bytes from www.uq.edu.au (130.102.131.123): icmp_seq=1 ttl=245 time=7.10 ms
^C
--- www.uq.edu.au ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 7.103/7.103/7.103/0.000 ms
root@c7:/# reboot
root@c7:/# chris@d6:~$

chris.willing 02-25-2018 08:34 PM

I just remembered that I already had some host side network preparation already done so that networking for new containers just works. Have a look at http://www.darlo.tv/lxc-14.2/network...slackware.html - set and forget (I did). The article mentions unprivileged containers but that's just because it's part of a series - it works for privileged containers too.

chris

masayk 02-27-2018 12:34 PM

I am sorry for long time no answer. I just got sick.
Chris, thank you for your advice and very useful article there. I will try to follow it.

And by "What do you mean by 'if I do not setup network settings'" I meant about configuring network settings in the lxc's config file:
Quote:

# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 01:26:3e:3c:f5:c3
lxc.network.mtu = 1500
If you don't mind, I will ask here if I have problems with instructions in your article. Thank you again!

chris.willing 02-27-2018 04:05 PM

Quote:

Originally Posted by masayk (Post 5824955)
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 01:26:3e:3c:f5:c3
lxc.network.mtu = 1500

That (or similar) is what I have in my configuration. I didn't set it up explicitly; it was derived, when the container was first created, from settings I've made in /etc/lxc/default.conf. It has:
Code:

chris@d6:~$ cat /etc/lxc/default.conf
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.name = eth0
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
chris@d6:~$

which results in a config file containing:
Code:

...
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.name = eth0
lxc.network.hwaddr = 00:16:3e:8c:31:28

The main difference is the name of the nertwork.link (the host network interface to attach to) which is lxcbr0 in my case, br0 in your case. Either is OK provided it exists in the host.

BTW an alternative location for that configuration is ~/.config/lxc/default.conf

chris

masayk 03-12-2018 01:18 PM

Hello, Chris!

I did everything according to your article and now I can run container with user privileges. But I still cannot do anything in my guest system (just like when I run lxc containers under root) and get messages like:

Quote:

bash-4.4$ lxc-start -n m4
bash-4.4$ lxc-attach -n m4
bash-4.2# su -
[root@m4 ~]# export LC_ALL=en_US
[root@m4 ~]# reboot
Failed to talk to init daemon.
[root@m4 ~]# systemctl status httpd
Failed to get D-Bus connection: No such file or directory

chris.willing 03-12-2018 05:33 PM

Quote:

Originally Posted by masayk (Post 5830140)
Hello, Chris!

I did everything according to your article and now I can run container with user privileges. But I still cannot do anything in my guest system (just like when I run lxc containers under root) and get messages like:

The reason to point to that article was to suggest a networking setup rather than all the stuff about creating unprivileged containers (although good to know that part of it still works).

Since you have the same problem with a second container, suspicion next falls on the host system - is it a stock 14.2 system (all packages installed, no funny business in /etc/rc.d/* files, etc.)?

In the meantime you could try running the lxc-start in the foreground e.g.
Code:

sudo lxc-start -n c7 -F
or even with a log file e.g.
Code:

sudo lxc-start -n c7 -F -o /tmp/c7.log
My resulting log file was empty - I presume because there were no errors in my case. Running the container in the foreground shows lots more extra stuff as the container starts up. This mode ends with a login prompt which won't work unless you previously set up a root password for the container, so use lxc-attach as before from a different terminal.

Hopefully one of these options may give some indication of what's going on.

chris

masayk 03-13-2018 02:27 PM

Hello, Chris!

My log is also empty, but output of your command is

Quote:

root@lion:~# lxc-start -n m7 -F
Failed to mount cgroup at /sys/fs/cgroup/systemd: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.
I use Slackware-current.

It (seems) started to work under root and under user after I've done:

Quote:

mkdir -p /sys/fs/cgroup/systemd
mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd
chown 100000:100000 -R /sys/fs/cgroup/systemd/
But it worked without entering those commands earlier. So, do you know where those commands should be placed? I am not sure if the last command is necessary here.

By the way, I found solution here:
https://j2h2.com/entry/alpine-linux-...ainers-round-2

chris.willing 03-13-2018 05:05 PM

Interesting. I don't see that error in 14.2 where there is no /sys/fs/cgroup/systemd directory.

In 14.2, lxc is at version 2.0.1 whereas current has lxc-2.0.9 - maybe it's just a version issue ...

Perhaps it's worth raising this issue in the "Requests for -current" thread to raise awareness there, just in case Pat & crew stopped watching this thread?

chris


All times are GMT -5. The time now is 11:45 AM.