[arch-general] Systemd inside LXC: user sessions are not automatically removed on logout

Damjan gdamjan at gmail.com
Mon Aug 19 22:01:11 EDT 2013


On 19.08.2013 18:48, Leonid Isaev wrote:
> Hi,
> 	
> I have been experimenting with archlinux guests inside LXC containers, and
> noticed that when a user logs out, systemd-logind won't remove the session.
> This is reproducible on all (archlinux x86_64) host-guest, testing-stable
> combinations.
>
> Here is an example (fserv1 is a container hostname). The only way to login
> is through ssh (sshd.service is enabled and running inside the container).

you know that systemd has the systemd-nspawn utility to start containers?

For ex. I use this to "boot" my container:

sudo systemd-nspawn -bD /home/virt/arch-x64

/home/virt/arch-x64 is installed with pacstrap I believe (though I don't 
find it on my system now) - it has been some time, or maybe with pacman 
itself.

loginctl behaves as expected, having clear separation of sessions.

so the problem might be with either lxc-start, or the way you installed 
the container.


ps.
you'd need to add --private-network to systemd-nspawn
if you want network separation, and then you'd have to add and set a 
veth device manually - not so hard though:

   sudo modprobe veth
   ip link add type veth # this will create veth0 and veth1 by default
   ip link set dev veth1 netns <THE PID OF THE NS> # to move veth1 to 
the namespace

"the pid of the ns" is the pid of the first child of systemd-nspawn, 
it'll be a /usr/lib/systemd/systemd process.




-- 
дамјан


More information about the arch-general mailing list