Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 664898

Summary: app-emulation/lxc: systemd template file lxc@.service is broken
Product: Gentoo Linux Reporter: Soren Harward <stharward>
Component: Current packagesAssignee: Virgil Dupras (RETIRED) <vdupras>
Status: RESOLVED INVALID    
Severity: normal CC: jstein, virtualization
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Soren Harward 2018-08-30 16:17:34 UTC
Trying to start LXC containers through the systemd template file is broken because the template file is invalid:

# systemctl enable lxc@containername.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.

# ln -sf /lib/systemd/system/lxc@.service /etc/systemd/system/multi-user.target.wants/lxc@containername.service
# systemctl start lxc@containername.service
Failed to start lxc@containername.service: Unit lxc@containername.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status lxc@containername.service' for details.

# systemctl status lxc@containername.servicelxc@containername.service
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

# lxc-start -n containername -F
[container starts up totally fine]

The template file worked fine with older versions of systemd, but doesn't with 238-r7 (current stable).
Comment 1 Virgil Dupras (RETIRED) gentoo-dev 2018-08-30 19:56:23 UTC
Thanks Soren for the bug report. I don't have a systemd environment around. Would you mind supplying a patch to fix this?
Comment 2 Soren Harward 2018-08-30 20:41:52 UTC
It ended up being a configuration error on my end.  My bad.