1

After much trial and error, I was finally able to get Spice working in a Fedora LXC container under Ubuntu 14.04. However, the same can't be said of an Ubuntu 14.04 container. It appears that the problem lies within Ubuntu's fractional implementation of systemd, whereas Fedora's full implementation (even with LXC restrictions) doesn't seem to have a problem in this case.

My test case relies on the Spice vdagent git sources. Once spice-vdagent connects to spice-vdagentd, vdagentd attempts to get session information for vdagent PID via libsystemd-login0 call sd_pid_get_session. This call returns with "No such file or directory", preventing Spice form working correctly. After digging through the source of libsystemd-login0, it appears that this call is reliant on the systemd cgroup.

Unfortunately, this cgroup doesn't exist within a container due to the file /etc/init/systemd-logind.conf explicitly not mounting the cgroup when running in a container. After removing the LXC check and rebooting the LXC container, I am left with a cgroup mounted in /sys/fs/cgroup/systemd. All appears to be well and good until examining /sys/fs/cgroup/systemd/cgroup.procs -- it's empty, as are all other cgroup.procs files underneath. The comment in the systemd-logind.conf above the LXC check states "mounting the cgroup does not work in LXC, there it uses cgmanager," but this doesn't give me any insight into how it should be done, or how it can be worked around.

I'm really unsure if this is an LXC-specific issue (perhaps LXC is preventing it from working properly?) or whether it's a systemd-logind issue. I should clarify that, for the moment, I have assigned my Ubuntu 14.40 LXC container to the 'unrestricted' profile so as to ensure it's not some kind of funky permissions issue.

Does anybody have any insight on what can be done to get the systemd cgroup within the LXC container working properly so that I can use Spice happily?

EDIT: After checking my host system, the systemd cgroup there seems to be working just fine, hm...

Despite lacking systemd-cgls, I can still provide some similar information:

Here is a tree of the /sys/fs/cgroup/systemd directory:

ubuntu@ubuntu2:/sys/fs/cgroup/systemd$ tree
.
├── cgroup.clone_children
├── cgroup.event_control
├── cgroup.procs
├── cgroup.sane_behavior
├── lxc
│   ├── cgroup.clone_children
│   ├── cgroup.event_control
│   ├── cgroup.procs
│   ├── notify_on_release
│   ├── tasks
│   └── ubuntu2
│       ├── cgroup.clone_children
│       ├── cgroup.event_control
│       ├── cgroup.procs
│       ├── notify_on_release
│       ├── tasks
│       └── user
│           ├── 1000.user
│           │   ├── c1.session
│           │   │   ├── cgroup.clone_children
│           │   │   ├── cgroup.event_control
│           │   │   ├── cgroup.procs
│           │   │   ├── notify_on_release
│           │   │   └── tasks
│           │   ├── cgroup.clone_children
│           │   ├── cgroup.event_control
│           │   ├── cgroup.procs
│           │   ├── notify_on_release
│           │   └── tasks
│           ├── cgroup.clone_children
│           ├── cgroup.event_control
│           ├── cgroup.procs
│           ├── notify_on_release
│           └── tasks
├── notify_on_release
├── release_agent
├── tasks
└── user
    ├── 1000.user
    │   ├── c2.session
    │   │   ├── cgroup.clone_children
    │   │   ├── cgroup.event_control
    │   │   ├── cgroup.procs
    │   │   ├── notify_on_release
    │   │   └── tasks
    │   ├── cgroup.clone_children
    │   ├── cgroup.event_control
    │   ├── cgroup.procs
    │   ├── notify_on_release
    │   └── tasks
    ├── cgroup.clone_children
    ├── cgroup.event_control
    ├── cgroup.procs
    ├── notify_on_release
    └── tasks

And a mapping of PIDs per cgroup:

./lxc/ubuntu2/user/1000.user/c1.session/cgroup.procs: 
    860 /bin/login -- 2596 grep --color=auto 860 /bin/login -- 2596 grep --color=auto 860
    1281 -bash 2605 grep --color=auto 1281 -bash 2605 grep --color=auto 1281
    2614 grep --color=auto 2593 grep --color=auto 2593
./lxc/ubuntu2/user/1000.user/cgroup.procs: 
./lxc/ubuntu2/user/cgroup.procs: 
./lxc/ubuntu2/cgroup.procs: 
    1 /sbin/init 194 upstart-udev-bridge --daemon 431 avahi-daemon: running [ubuntu2.local] 487 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 513 upstart-file-bridge --daemon 767 /usr/lib/policykit-1/polkitd --no-debug 811 /usr/sbin/spice-vdagentd -f -s /tmp/xspice-virtio -u /tmp/xspice-uinput -d 862 /sbin/getty -8 38400 tty1 871 /usr/lib/accountsservice/accounts-daemon 903 lightdm --session-child 16 20 915 /bin/sh /usr/lib/lightdm/lightdm-greeter-session /usr/sbin/unity-greeter 921 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session 941 /usr/lib/gvfs/gvfsd 958 lightdm --session-child 12 20 961 init --user --startup-event indicator-services-start 971 /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service 1042 /usr/bin/pulseaudio --start --log-target=syslog 1045 /usr/lib/rtkit/rtkit-daemon 1065 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2 1069 /usr/lib/x86_64-linux-gnu/notify-osd 1222 /usr/lib/colord/colord 1281 -bash 2626 grep --color=auto 1 /sbin/init 194 upstart-udev-bridge --daemon 431 avahi-daemon: running [ubuntu2.local] 487 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 513 upstart-file-bridge --daemon 767 /usr/lib/policykit-1/polkitd --no-debug 811 /usr/sbin/spice-vdagentd -f -s /tmp/xspice-virtio -u /tmp/xspice-uinput -d 862 /sbin/getty -8 38400 tty1 871 /usr/lib/accountsservice/accounts-daemon 903 lightdm --session-child 16 20 915 /bin/sh /usr/lib/lightdm/lightdm-greeter-session /usr/sbin/unity-greeter 921 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session 941 /usr/lib/gvfs/gvfsd 958 lightdm --session-child 12 20 961 init --user --startup-event indicator-services-start 971 /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service 1042 /usr/bin/pulseaudio --start --log-target=syslog 1045 /usr/lib/rtkit/rtkit-daemon 1065 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2 1069 /usr/lib/x86_64-linux-gnu/notify-osd 1222 /usr/lib/colord/colord 1281 -bash 2626 grep --color=auto 1
    194 upstart-udev-bridge --daemon 2635 grep --color=auto 194 upstart-udev-bridge --daemon 2635 grep --color=auto 194
    202 dbus-daemon --system --fork 2644 grep --color=auto 202 dbus-daemon --system --fork 2644 grep --color=auto 202
    252 /lib/systemd/systemd-udevd --daemon 2653 grep --color=auto 252 /lib/systemd/systemd-udevd --daemon 2653 grep --color=auto 252
    320 /lib/systemd/systemd-logind 2662 grep --color=auto 320 /lib/systemd/systemd-logind 2662 grep --color=auto 320
    402 /usr/sbin/cupsd -f 2671 grep --color=auto 402 /usr/sbin/cupsd -f 2671 grep --color=auto 402
    420 rsyslogd 2680 grep --color=auto 420 rsyslogd 2680 grep --color=auto 420
    431 avahi-daemon: running [ubuntu2.local] 2689 grep --color=auto 431 avahi-daemon: running [ubuntu2.local] 2689 grep --color=auto 431
    440 avahi-daemon: chroot helper 2698 grep --color=auto 440 avahi-daemon: chroot helper 2698 grep --color=auto 440
    459 /usr/lib/cups/notifier/dbus dbus:// 2707 grep --color=auto 459 /usr/lib/cups/notifier/dbus dbus:// 2707 grep --color=auto 459
    460 /usr/lib/cups/notifier/dbus dbus:// 2716 grep --color=auto 460 /usr/lib/cups/notifier/dbus dbus:// 2716 grep --color=auto 460
    487 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 2725 grep --color=auto 487 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 2725 grep --color=auto 487
    505 upstart-socket-bridge --daemon 2734 grep --color=auto 505 upstart-socket-bridge --daemon 2734 grep --color=auto 505
    513 upstart-file-bridge --daemon 2743 grep --color=auto 513 upstart-file-bridge --daemon 2743 grep --color=auto 513
    643 /usr/sbin/ModemManager 2752 grep --color=auto 643 /usr/sbin/ModemManager 2752 grep --color=auto 643
    690 NetworkManager NetworkManager
    692 /sbin/getty -8 38400 tty4 2770 grep --color=auto 692 /sbin/getty -8 38400 tty4 2770 grep --color=auto 692
    702 /sbin/getty -8 38400 tty2 2779 grep --color=auto 702 /sbin/getty -8 38400 tty2 2779 grep --color=auto 702
    703 /sbin/getty -8 38400 tty3 /sbin/getty -8 38400 tty3
    739 /usr/sbin/sshd -D 2797 grep --color=auto 739 /usr/sbin/sshd -D 2797 grep --color=auto 739
    754 acpid -c /etc/acpi/events -s /var/run/acpid.socket 2806 grep --color=auto 754 acpid -c /etc/acpi/events -s /var/run/acpid.socket 2806 grep --color=auto 754
    755 cron 2815 grep --color=auto 755 cron 2815 grep --color=auto 755
    756 whoopsie 2824 grep --color=auto 756 whoopsie 2824 grep --color=auto 756
    757 atd 2833 grep --color=auto 757 atd 2833 grep --color=auto 757
    767 /usr/lib/policykit-1/polkitd --no-debug /usr/lib/policykit-1/polkitd --no-debug
    772 /usr/sbin/kerneloops 2851 grep --color=auto 772 /usr/sbin/kerneloops 2851 grep --color=auto 772
    811 /usr/sbin/spice-vdagentd -f -s /tmp/xspice-virtio -u /tmp/xspice-uinput -d 2860 grep --color=auto 811 /usr/sbin/spice-vdagentd -f -s /tmp/xspice-virtio -u /tmp/xspice-uinput -d 2860 grep --color=auto 811
    847 lightdm 2869 grep --color=auto 847 lightdm 2869 grep --color=auto 847
    862 /sbin/getty -8 38400 tty1 2878 grep --color=auto 862 /sbin/getty -8 38400 tty1 2878 grep --color=auto 862
    868 /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch 2887 grep --color=auto 868 /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch 2887 grep --color=auto 868
    871 /usr/lib/accountsservice/accounts-daemon 2896 grep --color=auto 871 /usr/lib/accountsservice/accounts-daemon 2896 grep --color=auto 871
    897 /usr/sbin/cups-browsed 2905 grep --color=auto 897 /usr/sbin/cups-browsed 2905 grep --color=auto 897
    903 lightdm --session-child 16 20 2914 grep --color=auto 903 lightdm --session-child 16 20 2914 grep --color=auto 903
    915 /bin/sh /usr/lib/lightdm/lightdm-greeter-session /usr/sbin/unity-greeter 2923 grep --color=auto 915 /bin/sh /usr/lib/lightdm/lightdm-greeter-session /usr/sbin/unity-greeter 2923 grep --color=auto 915
    921 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session 2932 grep --color=auto 921 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session 2932 grep --color=auto 921
    922 /usr/sbin/unity-greeter 2941 grep --color=auto 922 /usr/sbin/unity-greeter 2941 grep --color=auto 922
    924 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately 2950 grep --color=auto 924 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately 2950 grep --color=auto 924
    930 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3 2959 grep --color=auto 930 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3 2959 grep --color=auto 930
    936 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session 2968 grep --color=auto 936 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session 2968 grep --color=auto 936
    941 /usr/lib/gvfs/gvfsd 2977 grep --color=auto 941 /usr/lib/gvfs/gvfsd 2977 grep --color=auto 941
    949 /usr/lib/dconf/dconf-service 2986 grep --color=auto 949 /usr/lib/dconf/dconf-service 2986 grep --color=auto 949
    958 lightdm --session-child 12 20 2995 grep --color=auto 958 lightdm --session-child 12 20 2995 grep --color=auto 958
    961 init --user --startup-event indicator-services-start 3004 grep --color=auto 961 init --user --startup-event indicator-services-start 3004 grep --color=auto 961
    963 nm-applet 3013 grep --color=auto 963 nm-applet 3013 grep --color=auto 963
    966 /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service 3022 grep --color=auto 966 /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service 3022 grep --color=auto 966
    967 /usr/lib/x86_64-linux-gnu/indicator-bluetooth/indicator-bluetooth-service 3031 grep --color=auto 967 /usr/lib/x86_64-linux-gnu/indicator-bluetooth/indicator-bluetooth-service 3031 grep --color=auto 967
    968 /usr/lib/x86_64-linux-gnu/indicator-power/indicator-power-service /usr/lib/x86_64-linux-gnu/indicator-power/indicator-power-service
    971 /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service 3049 grep --color=auto 971 /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service 3049 grep --color=auto 971
    978 /usr/lib/x86_64-linux-gnu/indicator-keyboard-service --use-gtk 3058 grep --color=auto 978 /usr/lib/x86_64-linux-gnu/indicator-keyboard-service --use-gtk 3058 grep --color=auto 978
    979 /usr/lib/unity-settings-daemon/unity-settings-daemon 3067 grep --color=auto 979 /usr/lib/unity-settings-daemon/unity-settings-daemon 3067 grep --color=auto 979
    985 /usr/lib/upower/upowerd 3076 grep --color=auto 985 /usr/lib/upower/upowerd 3076 grep --color=auto 985
    986 /usr/lib/x86_64-linux-gnu/indicator-sound/indicator-sound-service 3085 grep --color=auto 986 /usr/lib/x86_64-linux-gnu/indicator-sound/indicator-sound-service 3085 grep --color=auto 986
    987 /usr/lib/x86_64-linux-gnu/indicator-session/indicator-session-service 3094 grep --color=auto 987 /usr/lib/x86_64-linux-gnu/indicator-session/indicator-session-service 3094 grep --color=auto 987
    993 /usr/lib/x86_64-linux-gnu/indicator-application/indicator-application-service 3103 grep --color=auto 993 /usr/lib/x86_64-linux-gnu/indicator-application/indicator-application-service 3103 grep --color=auto 993
    1042 /usr/bin/pulseaudio --start --log-target=syslog 3112 grep --color=auto 1042 /usr/bin/pulseaudio --start --log-target=syslog 3112 grep --color=auto 1042
    1045 /usr/lib/rtkit/rtkit-daemon 3121 grep --color=auto 1045 /usr/lib/rtkit/rtkit-daemon 3121 grep --color=auto 1045
    1065 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2 3130 grep --color=auto 1065 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2 3130 grep --color=auto 1065
    1069 /usr/lib/x86_64-linux-gnu/notify-osd 3139 grep --color=auto 1069 /usr/lib/x86_64-linux-gnu/notify-osd 3139 grep --color=auto 1069
    1222 /usr/lib/colord/colord 3148 grep --color=auto 1222 /usr/lib/colord/colord 3148 grep --color=auto 1222
./lxc/cgroup.procs: 
./user/1000.user/c2.session/cgroup.procs: 
./user/1000.user/cgroup.procs: 
./user/cgroup.procs: 
./cgroup.procs: 
  • Can you tell me whether the agent and the daemon are in the host or in the guest? Also, what is the output of systemd-cgls? – CameronNemo Nov 29 '14 at 17:45
  • Agent and daemon are in the guest of course. systemd-cgls: command not found in host and guest. It's probably not a part of 14.04. – Chuck R Nov 29 '14 at 19:15
1

I made spice-vdagentd work by running it with "-X" option to disable systemd-login integration.

https://bugs.launchpad.net/ubuntu/+source/spice-vdagent/+bug/1633609?comments=all

0

Take a look here:

https://s3hh.wordpress.com/2014/04/18/xspice-in-containers/

That is the blog site of one of the LXC developers.

He also might be interested in your approach/progress.

  • I followed up this question on the spice-devel mailing list. I found a couple buys in Xspice, but nothing that finally fixed my issue. I eventually gave up on it. – Chuck R Nov 5 '15 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.