Skip to contentSkip to conversation

gen-image: create /etc/mtab symlink

PATCH New Eric Biggers 1 participant 1 message Sep 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gen-image: create /etc/mtab symlink

From: Eric Biggers <[email protected]>

Currently the root_fs's are being created with no /etc/mtab file. /etc/mtab is supposed to be obsolete, but some programs such as mke2fs still expect it to exist. On Debian systems, systemd will automatically symlink /etc/mtab to ../proc/self/mounts as specified by /usr/lib/tmpfiles.d/debian.conf. But if the root_fs is used as a chroot (as android-xfstests does), that does not happen, and as of Debian Stretch the 'mount' program from util-linux doesn't create /etc/mtab either. So until nothing else needs it, just make an /etc/mtab symlink while creating the root_fs.

---
 kvm-xfstests/test-appliance/gen-image | 1 +
 1 file changed, 1 insertion(+)
kvm-xfstests/test-appliance/gen-image +1 -0
index 48cf624..8343294 100755
@@ -289,6 +289,7 @@ echo "fsgqa:!::" >> $ROOTDIR/etc/gshadow
 mkdir $ROOTDIR/home/fsgqa
 chown 31415:31415 $ROOTDIR/home/fsgqa
 chmod 755 $ROOTDIR/root
+ln -sf ../proc/self/mounts $ROOTDIR/etc/mtab
 fix_symlinks
 
 cp $ROOTDIR/lib/systemd/system/[email protected] \
Signature · 1 line
2.14.1.581.gf28d330327-goog