archlinux: ensure /lib/modules is mounted before xenfs using a systemd service

This systemd service is not disruptive to the boot process if it fails to mount /lib/modules (because it has been mounted before systemd switched the root directory to the real one).
The advantage is that it will boot /usr/lib/modules even if dracut doesn't handle root switch pre-hook, which is the case on archlinux.
It then allows booting an archlinux AppVM using an archlinux kernel.
This commit is contained in:
Olivier MEDOC 2014-02-03 20:53:03 +01:00 committed by Marek Marczykowski-Górecki
parent 6547577ce9
commit d931ba237e
3 changed files with 25 additions and 5 deletions

View File

@ -6,7 +6,7 @@
# Maintainer: Olivier Medoc <o_medoc@yahoo.fr> # Maintainer: Olivier Medoc <o_medoc@yahoo.fr>
pkgname=qubes-vm-core pkgname=qubes-vm-core
pkgver=`cat version` pkgver=`cat version`
pkgrel=16 pkgrel=17
epoch= epoch=
pkgdesc="The Qubes core files for installation inside a Qubes VM." pkgdesc="The Qubes core files for installation inside a Qubes VM."
arch=("x86_64") arch=("x86_64")
@ -25,10 +25,10 @@ options=()
install=PKGBUILD.install install=PKGBUILD.install
changelog= changelog=
source=() source=(PKGBUILD.qubes-ensure-lib-modules.service)
noextract=() noextract=()
md5sums=() #generate with 'makepkg -g' md5sums=('88f4b3d5b156888a9d38f5bc28702ab8') #generate with 'makepkg -g'
build() { build() {
@ -93,6 +93,9 @@ package() {
# Remove fedora specific scripts # Remove fedora specific scripts
rm $pkgdir/etc/fstab rm $pkgdir/etc/fstab
# Install systemd script allowing to automount /lib/modules
install -m 644 $srcdir/PKGBUILD.qubes-ensure-lib-modules.service $pkgdir/lib/systemd/system/qubes-ensure-lib-modules.service
} }
# vim:set ts=2 sw=2 et: # vim:set ts=2 sw=2 et:

View File

@ -97,7 +97,7 @@ done
update_systemd() { update_systemd() {
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-yum-proxy qubes-qrexec-agent; do for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-yum-proxy qubes-qrexec-agent qubes-ensure-lib-modules; do
systemctl enable $srv.service 2> /dev/null systemctl enable $srv.service 2> /dev/null
done done
@ -247,7 +247,7 @@ post_remove() {
rm /lib/firmware/updates rm /lib/firmware/updates
fi fi
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-qrexec-agent qubes-yum-proxy; do for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-qrexec-agent qubes-yum-proxy qubes-ensure-lib-modules; do
systemctl disable $srv.service systemctl disable $srv.service
done done
systemctl disable qubes-update-check.timer systemctl disable qubes-update-check.timer

View File

@ -0,0 +1,17 @@
[Unit]
Description=Qubes verification of /usr/lib/modules
DefaultDependencies=no
Documentation=
ConditionPathExists=/dev/xvdd
Before=systemd-modules-load.service
Before=systemd-udevd.service
Before=local-fs-pre.target
After=systemd-remount-fs.service
[Service]
Type=oneshot
ExecStart=/bin/mount /dev/xvdd /usr/lib/modules
StandardOutput=syslog
[Install]
WantedBy=sysinit.target