[systemd-devel] LXC not working with systemd 209 or later

John Lane systemd at jelmail.com
Sat Apr 5 14:04:05 PDT 2014


On 04/04/14 23:17, Leonid Isaev wrote:
> On Fri, 04 Apr 2014 21:19:45 +0100
> John Lane <systemd at jelmail.com> wrote:
>
>> [...]
>>
>> I did this: systemd-nspawn -bD /srv/lxc/testcontainer
>>
>> Starting the container this way is pretty-much instantaneous. You can
>> log in and halt it cleanly.
> Now that's interesting...
>
>>> 3. How do you mount API filesystems into the container (your config doesn't
>>> have /sys and /proc entries)? Try putting the fstab generated by the
>>> archlinux template (because that one I tested and it works).
>> AIUI systemd does this automatically. They are mounted in my container.
>> # df /proc /proc/sys /sys
>> Filesystem     1K-blocks  Used Available Use% Mounted on
>> proc                   0     0         0    - /proc
>> proc                   0     0         0    - /proc
>> sysfs                  0     0         0    - /sys
> You are right, a container can be run without any lxc.mount entries at all.
>
>> However, FYI, the following works and gives verbose logging output.
>>
>> lxc-start -n testcontainer /usr/lib/systemd/systemd --
>> --log-target=console --log-level=debug
> ... which is?
>
>> I am now at the point where I have 2 containers, one created by
>> lxc-archlinux (which works) and one created using what I believe are
>> similar equivalent steps. They both have the exact same lxc config and
>> the exact same packages installed. I still have the problem, but I have
>> discovered more info...
>>
>> I get "user at 0.service start operation timed out. Terminating."
>>
>> I tried to execute "systemd --user" manually and got "Trying to run as
>> user instance, but $XDG_RUNTIME_DIR is not set".
>>
>> I've been digging around and noticed in the journal:
>>
>> Failed to open private bus connection: Failed to connect to socket
>> /run/user/0/dbus/user_bus_socket: No such file or directory
>>
>> and
>>
>> pam_systemd(login:session): Failed to create session: Connection timed out
>>
>> I believe the problem lies in pam_systemd timing out (hence the login
>> delay) because it can't talk to systemd-logind due to some IPC problem
>> that I can't work out yet...
>>
> It's difficult to say what's going on without a verbose journal output... Can
> you obtain one? Can you post your container creation scripts, so that I
> try to reproduce your issue over the weekend?
Ok, now this is wierd. I have distilled the problem down to the bare bones.
I have a "build_container" script 
(http://pastebin.com/raw.php?i=RhDFhRZi) that will create a container 
called "testcontainer". It exhibits the problems I see. Now, if I rename 
that container to, say "testc", and restart it (changing nothing else at 
all) then it works fine.

I am totally confused but it appears that the container's name affects 
how systemd operates...?

if you can try it and see if the same happens to you that would be very 
helpful.

$ ./build_container

$ lxc-start -n testcontainer

it starts: will see journal output in the console boot messages, like 
this: "<30>systemd[1]: Set hostname to <test>."
you can log in as root. no password. Long delay. Eventual 
"user at 0.service start operation timed out. Terminating"
You can then "halt". slow to stop. "user at 0.service start operation timed 
out. Terminating" takes 90 seconds.
Eventually stops, host prompt returned.

Now, with the container stopped, rename it:
$ mv /var/lib/lxc/testcontainer /var/lib/lxc/testc

Start the container again (with the new name)

$ lxc-start -n testc

it starts, instantly and without journal output in the console boot 
messages.
you can log in as root. no password. instant prompt display.
you can "halt". Immediate and quick termination.

I don't know what to make of that.

Actually, you can avoid the above. Here's another test with just 
"lxc-create"

$ lxc-create -n testcontainer -t archlinux -- -P util-linux
$ lxc-start -n testcontainer

Same problem.

(rename container as before but also edit the rootfs path in the 
/var/lib/lxc/testc/config file)

Puzzled!

I'll re-run this test tomorrow and capture full journal output if you 
need it but I've had enough for one day.

J


> Also, what's the answer to Tom's question?
just answered that one too (actually did so yesterday but forgot to 
press "send"!)
>
> Cheers,
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140405/56bf4c76/attachment.html>


More information about the systemd-devel mailing list