[lxc-users] lxc-attach vs python3 attach_wait

Alexander Dreweke lxc at shadowhunt.de
Wed Mar 15 18:33:33 UTC 2017


Hi

I'm trying to script the creation on various LXC containers. Therefor I 
would like to execute a script that finalizes the container. But the 
script fails when it tries to interact with systemd, the error message 
reads "Failed to connect to bus: No such file or directory"

A minimal example, without a script, results in the same error:

container.attach_wait(
	lxc.attach_run_command,
	[ "/bin/systemctl", "enable", "systemd-networkd.service" ],
	env_policy=lxc.LXC_ATTACH_CLEAR_ENV)

When I execute the same command via lxc-attach it succeeds:

lxc-attach -n test --clear-env -- /usr/bin/strace /bin/systemctl enable 
systemd-networkd.service

Am I missing an option for attach_wait?

I'm using LXC 2.0.7 and the according python3 bindings.

Best regards,
	Alexander


More information about the lxc-users mailing list