diff --git a/live-build/auto/build b/live-build/auto/build index 3c8f76fe..f14b23e0 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -112,7 +112,22 @@ preinstall_snaps() { for snap in "$@"; do SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}" done + + if [ ! -c /dev/mem ]; then + mknod -m 660 /dev/mem c 1 1 + chown root:kmem /dev/mem + fi + + mount --rbind /dev chroot/dev + mount --rbind /sys chroot/sys + mount --bind /proc chroot/proc + snap_validate_seed chroot + + umount --recursive chroot/proc + umount --recursive chroot/sys + umount --recursive chroot/dev + lb chroot_resolv remove } diff --git a/live-build/functions b/live-build/functions index 2e505949..cfe04cf4 100644 --- a/live-build/functions +++ b/live-build/functions @@ -96,9 +96,15 @@ mount_image() { setup_mountpoint() { local mountpoint="$1" + if [ ! -c /dev/mem ]; then + mknod -m 660 /dev/mem c 1 1 + chown root:kmem /dev/mem + fi + mount --rbind /dev "$mountpoint/dev" mount proc-live -t proc "$mountpoint/proc" mount sysfs-live -t sysfs "$mountpoint/sys" + mount securityfs -t securityfs "$mountpoint/sys/kernel/security" mount -t tmpfs none "$mountpoint/tmp" mount -t tmpfs none "$mountpoint/var/lib/apt" mount -t tmpfs none "$mountpoint/var/cache/apt" @@ -682,6 +688,8 @@ snap_validate_seed() { if [ -e "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml" ]; then snap debug validate-seed "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml" + /usr/lib/snapd/snap-preseed --reset $(realpath "${CHROOT_ROOT}") + /usr/lib/snapd/snap-preseed $(realpath "${CHROOT_ROOT}") fi }