Skip to content

Commit

Permalink
factory: do not mount /lib/{modules,firmware} if there is a drivers tree
Browse files Browse the repository at this point in the history
Do not mount /lib/{modules,firmware} in case snapd created a drivers
tree for our kernel snap, as in that case these mounts will be created
by snapd-generator from the base or from the snapd deb package for
hybrid systems. This situation is expected to happen only for 24+
systems.
  • Loading branch information
alfonsosanchezbeato committed May 30, 2024
1 parent a0ef0e0 commit e1cd0ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion factory/usr/lib/core/extra-paths
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

set -eu

cat <<EOF >>/sysroot/etc/fstab
cat <<'EOF' >>/sysroot/etc/fstab
/run/mnt/data /writable none bind,x-initrd.mount 0 0
EOF

# Mount /lib/{firmware,modules} only if there is no drivers tree created by snapd
if [ ! -d /run/mnt/data/system-data/var/lib/snapd/kernel ]; then
cat <<'EOF' >>/sysroot/etc/fstab
/run/mnt/kernel/firmware /usr/lib/firmware none bind,x-initrd.mount 0 0
/run/mnt/kernel/modules /usr/lib/modules none bind,x-initrd.mount 0 0
EOF
fi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if ! grep -q "^ID=ubuntu$" "${OS_RELEASE}"; then
exit 0
fi

# Mount /lib/{firmware,modules} only if there is no drivers tree created by snapd
if [ ! -d /run/mnt/data/var/lib/snapd/kernel ]; then
exit 0
fi

for entry in firmware modules; do
what="${KERNEL_MNT_POINT}/${entry}"
where="${sysroot}/usr/lib/${entry}"
Expand Down

0 comments on commit e1cd0ee

Please sign in to comment.