Skip to content

Commit 09e3dd3

Browse files
committed
Create filesystem on xvda1 on update
The new systemd (Debian trixie, Fedora 43) really insist on having proper filesystem on the EFI partition, otherwise it marks several units as failed. Create a filesystem there on package update too. Do not interrupt package update if it fails. Fixes QubesOS/qubes-issues#8954
1 parent e6854b6 commit 09e3dd3

5 files changed

Lines changed: 32 additions & 0 deletions

File tree

archlinux/PKGBUILD.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ package_qubes-vm-core() {
5959
release=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}
6060
depends=(
6161
dconf
62+
dosfstools
6263
fakeroot
6364
gawk
6465
gnome-packagekit

archlinux/PKGBUILD.install

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ update_qubesconfig() {
8585
mount /usr/local || :
8686
fi
8787

88+
rootdev=$(grep -o '^[^ ]* / ' /proc/mounts | cut -f 1 -d ' ') || rootdev=
89+
# if root volume uses partitions, and is mounted directly (no dm-snapshot),
90+
# check if xvda1 needs filesystem to be created
91+
if [ -n "$rootdev" ] && [ "$(readlink -f "$rootdev")" = "/dev/xvda3" ]; then
92+
if [ -z "$(blkid -o value -s TYPE /dev/xvda1)" ]; then
93+
mkfs.vfat -S 4096 -n EFI /dev/xvda1 || \
94+
echo "Creating EFI fs failed: 'mkfs.vfat -S 4096 -n EFI /dev/xvda1': $?" >&2
95+
fi
96+
fi
97+
8898
# Install qubes version of fstab
8999
if ! grep -q dmroot /etc/fstab; then
90100
cp -f /etc/fstab.qubes /etc/fstab

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Depends:
3131
dconf-cli,
3232
distro-info-data,
3333
dmsetup,
34+
dosfstools,
3435
e2fsprogs,
3536
gawk,
3637
graphicsmagick,

debian/qubes-core-agent.postinst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ case "${1}" in
166166
mount /usr/local || :
167167
fi
168168

169+
rootdev=$(grep -o '^[^ ]* / ' /proc/mounts | cut -f 1 -d ' ') || rootdev=
170+
# if root volume uses partitions, and is mounted directly (no dm-snapshot),
171+
# check if xvda1 needs filesystem to be created
172+
if [ -n "$rootdev" ] && [ "$(readlink -f "$rootdev")" = "/dev/xvda3" ]; then
173+
if [ -z "$(blkid -o value -s TYPE /dev/xvda1)" ]; then
174+
mkfs.vfat -S 4096 -n EFI /dev/xvda1 || \
175+
echo "Creating EFI fs failed: 'mkfs.vfat -S 4096 -n EFI /dev/xvda1': $?" >&2
176+
fi
177+
fi
178+
169179
# remove old symlinks
170180
if [ -L /etc/systemd/system/sysinit.target.wants/qubes-random-seed.service ]; then
171181
rm /etc/systemd/system/sysinit.target.wants/qubes-random-seed.service

rpm_spec/core-agent.spec.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Obsoletes: qubes-core-vm-doc < 4.0.0
186186
Conflicts: qubes-gui-agent < 4.1.6
187187
Conflicts: pulseaudio-qubes < 4.2.0
188188
Provides: group(qubes)
189+
Requires(post): dosfstools
189190
Requires(pre): shadow
190191
Requires(pre): qubes-db
191192
BuildRequires: gcc
@@ -574,6 +575,15 @@ if [ -L /usr/local ]; then
574575
mount /usr/local || :
575576
fi
576577

578+
rootdev=$(grep -o '^[^ ]* / ' /proc/mounts | cut -f 1 -d ' ') || rootdev=
579+
# if root volume uses partitions, and is mounted directly (no dm-snapshot),
580+
# check if xvda1 needs filesystem to be created
581+
if [ -n "$rootdev" ] && [ "$(readlink -f "$rootdev")" = "/dev/xvda3" ]; then
582+
if [ -z "$(blkid -o value -s TYPE /dev/xvda1)" ]; then
583+
mkfs.vfat -S 4096 -n EFI /dev/xvda1 || echo "Creating EFI fs failed: 'mkfs.vfat -S 4096 -n EFI /dev/xvda1': $?" >&2
584+
fi
585+
fi
586+
577587
%if 0%{?fedora} < 41
578588
if [ ! -f /etc/qubes-dnf-hardened ]; then
579589
dnf config-manager --setopt=zchunk=0 --setopt=deltarpm=0 --save &&

0 commit comments

Comments
 (0)