Skip to content

Instantly share code, notes, and snippets.

@rupertlssmith
Forked from paleo9/xen-and-systemd
Created December 11, 2023 11:27
Show Gist options
  • Save rupertlssmith/3aa9f833e1423080e1579a1abcbcb4b2 to your computer and use it in GitHub Desktop.
Save rupertlssmith/3aa9f833e1423080e1579a1abcbcb4b2 to your computer and use it in GitHub Desktop.
Integrating Xen 4.2 with Systemd.
Integrating Xen 4.2 AUR with Systemd.
=================================
I tested the AUR package with a fresh installation of Arch of x86_64. Only
packages 'base', 'base-devel'and the dependencies mentioned on the site
were installed.
* package build also requires dev86
* dev86 is in multilib, x86_64 users need to enable multilib in /etc/pacman.conf
* users need to add a new entry to their bootloader config file (mentioned)
* users need to set up a network bridge or alternative for dom0 (not mentioned)
The following are what was needed to make systemd work successfully with the AUR package
(and the installation from xen.org source).
* Need to include the following line in /etc/fstab:
none /proc/xen xenfs defaults 0 0
* Need to place the file 'xendomains' (created in init.d) somewhere useful.
Fedora use /usr/libexec which Arch does not have. It's a script so maybe
/etc/xen/scripts/ ?
* Error messages about 'failed to execute /usr/lib/.... xend/udev_event'
(lots of them) are caused by /etc/udev/rules.d/xend.rules
As xend is (a) deprecated and (b) not used, it is safe to remove xend.rules
I was able to remove /etc/udev/xen-backend rules without any (apparent) effect.
* The AUR build creates both oxenstored and censtored. oxenstored is more
efficient according to xen.org so oxenstored.service is provided.
* The following files integrate Xen 4.2 with systemd 195. They replace xencommons
which loads startup modules then starts oxenstored, xenconsoled and xendomains.
To start the services at startup, issue:
systemctl enable oxenstored.service
systemctl enable xenconsoled.service
systemctl enable xendomains.service
---------------------------------------------------------------------------------
/etc/modules-load.d/xen.conf
---------------------------------------------------------------------------------
xen-evtchn
xen-gntdev
xen-gntalloc
xen-blkback
xen-netback
xen-pciback
xen-acpi-processor
# The following were included in xencommons, but were not inserted by systemd
# evtchn
# gntdev
# netbk
# blkbk
# xen-scsibk
# usbbk
# pciback
# blktap2
# blktap
#### end of xen.conf
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xenstored.service
---------------------------------------------------------------------------------
[Unit]
Description=Xenstored - daemon managing xenstore file system
Before=libvirtd.service libvirt-guests.service
After=dbus.service
RefuseManualStop=true
[Service]
Type=forking
PIDFile=/var/run/xenstored.pid
ExecStart=/usr/sbin/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
[Install]
WantedBy=multi-user.target
#### end of xenstored.service
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xenconsoled.service
---------------------------------------------------------------------------------
[Unit]
Description=Xenconsoled - handles logging from guest consoles and hypervisor
After=xenstored.service
[Service]
Type=simple
PIDFile=/var/run/xenconsoled.pid
ExecStart=/usr/sbin/xenconsoled
[Install]
WantedBy=multi-user.target
#### end of xencommons.service
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xendomains.service
---------------------------------------------------------------------------------
[Unit]
Description=Xendomains - start and stop guests on boot and shutdown
Requires=proc-xen.mount xenstored.service
After=proc-xen.mount xenstored.service xenconsoled.service
ConditionPathExists=/proc/xen
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/usr/bin/grep -q control_d /proc/xen/capabilities
ExecStart=/etc/xen/scripts/xendomains start
ExecStop=/etc/xen/scripts/xendomains stop
[Install]
WantedBy=multi-user.target
#### end of xendomains.service
********************************************************************************
xen.conf paleo9
oxenstored.service xenconsoled.service xendomains.service
based on Fedora 17, modified for the Arch system by paleo9
*********************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment