I am running a Gentoo installation and recently moved to systemd and whenever I boot with Xen, I cannot issue any xl commands, getting this error:

xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error

libxl: error: libxl.c:92:libxl_ctx_alloc: cannot open libxc handle: No such file or directory

cannot init xl context

After looking into the issue, I found that the three mentioned services (xenstored, xenconsoled, and xendomains) were not running and I could not enable them in systemd. I checked /usr/lib64/systemd/system for and service files with names even containing xen and none were found. So I believe I need to install those three services somehow, but I'm not sure why they were not installed when I emerged xen (and xen-tools) or systemd. Do I need to just build them from source? Any direction would be appreciated!


Bad News

I looked this up a few days ago, and forgot to post the answer. I don't use xen or xen-tools so my emerge output shows the extra packages:

ecyoung@bedroom-gentoo ~ $ sudo emerge -av xen xen-tools

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] dev-libs/yajl-2.0.4-r3::gentoo  USE="-static-libs" ABI_X86="32 (64) (-x32)" 81 KiB
[ebuild  N     ] dev-python/markdown-2.6.1::gentoo  USE="-doc -pygments {-test}" PYTHON_TARGETS="python2_7 python3_3 python3_4 (-pypy) (-pypy3)" 292 KiB
[ebuild  N     ] dev-python/pypam-0.5.0-r3::gentoo  PYTHON_TARGETS="python2_7 python3_3" 103 KiB
[ebuild  N     ] sys-firmware/ipxe-1.0.0_p20130925::gentoo  USE="qemu usb -iso -undi -vmware" 2,188 KiB
[ebuild  N     ] sys-devel/dev86-0.16.19::gentoo  697 KiB
[ebuild  N     ] net-misc/bridge-utils-1.5::gentoo  USE="(-selinux)" 33 KiB
[ebuild  N     ] app-emulation/xen-tools-4.5.0-r6::gentoo  USE="pam python -api -custom-cflags -debug -doc -flask -hvm (-ocaml) -ovmf -pygrub -qemu -screen -static-libs -system-qemu -system-seabios" PYTHON_TARGETS="python2_7" 18,604 KiB
[ebuild  N     ] app-emulation/xen-4.5.0-r8::gentoo  USE="-custom-cflags -debug -efi -flask -xsm" 0 KiB

Total: 8 packages (8 new), Size of downloads: 21,996 KiB

Would you like to merge these packages? [Yes/No] n


ecyoung@bedroom-gentoo ~ $ 

As you can see from the output listed above the systemd USE Flag isn't listed in the USE list for either app-emulation/xen or app-emulation/xen-tools. Every package that supports the systemd USE Flag will have it listed in the list. In fact, we can verify this with the app-portage/gentoolkit package that contains the equery script:

ecyoung@bedroom-gentoo ~ $ sudo equery hasuse systemd
 * Searching for USE flag systemd ... 
[IP-] [  ] app-admin/syslog-ng-3.6.2:0
[IP-] [  ] dev-libs/efl-1.12.2:0
[IP-] [  ] kde-base/kdm-4.11.19:4/4.11
[IP-] [  ] media-gfx/sane-backends-1.0.24-r5:0
[IP-] [  ] media-sound/pulseaudio-5.0-r7:0
[IP-] [  ] net-print/cups-2.0.2-r1:0
[IP-] [  ] net-wireless/bluez-5.25:0/3
[IP-] [  ] sci-geosciences/gpsd-3.9-r1:0
[IP-] [  ] sys-apps/accountsservice-0.6.40:0
[IP-] [  ] sys-apps/busybox-1.23.1-r1:0
[IP-] [  ] sys-apps/dbus-1.8.16:0
[IP-] [  ] sys-apps/util-linux-2.25.2-r2:0
[IP-] [  ] sys-auth/pambase-20150213:0
[IP-] [  ] sys-auth/polkit-0.112-r2:0
[IP-] [  ] sys-fs/lvm2-2.02.109:0
[IP-] [  ] sys-fs/multipath-tools-0.5.0-r1:0
[IP-] [  ] sys-fs/udisks-2.1.4:2
[IP-] [  ] sys-process/procps-3.3.9-r2:0
[IP-] [  ] virtual/libgudev-215-r3:0/0                                                                                                                                                                                                                                         
[IP-] [  ] virtual/libudev-215-r1:0/1                                                                                                                                                                                                                                          
[IP-] [  ] virtual/udev-215:0                                                                                                                                                                                                                                                  
[IP-] [  ] x11-base/xorg-server-1.16.4:0/1.16.1                                                                                                                                                                                                                                
[I-O] [  ] x11-wm/enlightenment-0.19.4:0.17/0.19                                                                                                                                                                                                                               
ecyoung@bedroom-gentoo ~ $

Please note the list would include more if I had a systemd profile enabled. See the Tracker Bug below for a more complete list.

Possible Fixes

Since the flag isn't listed above, that leaves you with about 3 options that I can think of:

  1. Write your own .service files. There are also numerous other links like this one, just Google for writing systemd service
  2. Switch back to OpenRC/SysV init using eselect profile (Choose a profile without systemd). This setup is well documented on the Xen Wiki Entry for Gentoo
  3. Contribute the .service files you wrote in #1 to Bug 482420 - app-emulation/xen-tools: Add systemd unit script file support, which blocks Bug 448882 - (install-systemd-unit) [Tracker] packages not providing systemd units. This list contains all the packages that need systemd units. The ones that are crossed out have had support added. The ones that aren't still need work.

I solved the issue by just reinstalling xen and xen-tools while systemd was already installed.

I did, however, have to change my xen-qemu-dom0-disk-backend.service to point to my already installed QEMU binary (since I use a separate QEMU package).

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.