From 166253b508a63de8a8719111c490ea5c910c70a3 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 3 Apr 2019 23:17:58 +0200 Subject: [PATCH] Chroot: Fix mount of some tmpfs for chroot And remove some useless tmpfs from fstab. --- debian/chroot.install | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index 500ecf4..1284f16 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -117,12 +117,14 @@ mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/ swapon -- /dev/mapper/"${vgname}"-swap ### System +mkdir -p -- /target/dev +mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev mkdir -p -- /target/dev/pts -mountpoint -q /target/dev/pts || mount -o bind -- /dev/pts /target/dev/pts +mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts mkdir -p -- /target/proc -mountpoint -q /target/proc || mount -t proc -- proc /target/proc +mountpoint -q /target/proc || mount -t proc -- none /target/proc mkdir -p -- /target/sys -mountpoint -q /target/sys || mount -o bind -- /sys /target/sys +mountpoint -q /target/sys || mount -t sysfs -- none /target/sys ## }}} ## Run debootstrap debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exclude}" stretch /target http://ftp.fr.debian.org/debian @@ -190,10 +192,6 @@ grep target /etc/mtab > /target/etc/fstab grep swap /target/etc/fstab || echo "/dev/mapper/${vgname}-swap swap swap sw,pri=0 0 0" >> /target/etc/fstab ### Add extra tmpfs mount point -grep devtmpfs /target/etc/fstab || echo "udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=2051120,mode=755 0 0" >> /target/etc/fstab -grep "/run " /target/etc/fstab || echo "tmpfs /run tmpfs rw,size=15M,mode=755 0 0" >> /target/etc/fstab -grep "/run/lock" /target/etc/fstab || echo "tmpfs /run/lock tmpfs rw,size=5120k 0 0" >> /target/etc/fstab -grep "/run/shm" /target/etc/fstab || echo "tmpfs /run/shm tmpfs rw,nodev,size=100M 0 0" >> /target/etc/fstab grep "/var/tmp" /target/etc/fstab || echo "/tmp /var/tmp none rw,bind,size=1M,mode=1777 0 0" >> /target/etc/fstab ### Remove all occurrences to /target @@ -223,6 +221,12 @@ iface ${net_device} inet static source-directory /etc/network/interfaces.d" > /target/etc/network/interfaces +## }}} +## Ensure to remount device {{{ +mountpoint -q /target/dev/ || mount -t devtmpfs -- none /target/dev +mountpoint -q /target/dev/pts || mount -t devpts -- /dev/pts /target/dev/pts +mountpoint -q /target/proc || mount -t proc -- none /target/proc +mountpoint -q /target/sys || mount -t sysfs -- none /target/sys ## }}} ## Locale {{{ ### Enable locale(s)