Ver código fonte

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.
Olivier MEDOC 10 anos atrás
pai
commit
d931ba237e

+ 6 - 3
archlinux/PKGBUILD

@@ -6,7 +6,7 @@
 # Maintainer: Olivier Medoc <o_medoc@yahoo.fr>
 pkgname=qubes-vm-core
 pkgver=`cat version`
-pkgrel=16
+pkgrel=17
 epoch=
 pkgdesc="The Qubes core files for installation inside a Qubes VM."
 arch=("x86_64")
@@ -25,10 +25,10 @@ options=()
 install=PKGBUILD.install
 changelog=
 
-source=()
+source=(PKGBUILD.qubes-ensure-lib-modules.service)
 
 noextract=()
-md5sums=() #generate with 'makepkg -g'
+md5sums=('88f4b3d5b156888a9d38f5bc28702ab8') #generate with 'makepkg -g'
 
 
 build() {
@@ -93,6 +93,9 @@ package() {
   # Remove fedora specific scripts
   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:

+ 2 - 2
archlinux/PKGBUILD.install

@@ -97,7 +97,7 @@ done
 
 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
 done
 
@@ -247,7 +247,7 @@ post_remove() {
       rm /lib/firmware/updates
     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
   done
   systemctl disable qubes-update-check.timer

+ 17 - 0
archlinux/PKGBUILD.qubes-ensure-lib-modules.service

@@ -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