From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH] Core Update 167: Replace /etc/mtab by symlink to /proc/self/mounts Date: Tue, 12 Apr 2022 12:01:20 +0000 Message-ID: <187aed79-1dfa-9a6d-e797-af2cf99a75ab@ipfire.org> In-Reply-To: <31BEA465-A188-4B2C-9D35-61BE9F97D820@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6710109166615085244==" List-Id: --===============6710109166615085244== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Michael, > Hello, >=20 >> On 11 Apr 2022, at 20:14, Peter M=C3=BCller w= rote: >> >> mount, as updated via util-linux, no longer writes /etc/mtab, causing >> programs to rely on this file's content (such as the check_disk Nagios >> plugin) to stop working. >> >> /proc/self/mounts contains all the necessary information, so it is fine >> to replace /etc/mtab by a symlink to it. >> >> Fixes: #12843 >> >> Signed-off-by: Peter M=C3=BCller >> --- >> config/rootfiles/core/167/update.sh | 4 ++++ >> lfs/cdrom | 4 ++-- >> lfs/stage2 | 3 ++- >> src/initscripts/system/mountfs | 6 ------ >> src/initscripts/system/partresize | 6 ------ >> 5 files changed, 8 insertions(+), 15 deletions(-) >> >> diff --git a/config/rootfiles/core/167/update.sh b/config/rootfiles/core/1= 67/update.sh >> index fdcb843cf..a9be60a1d 100644 >> --- a/config/rootfiles/core/167/update.sh >> +++ b/config/rootfiles/core/167/update.sh >> @@ -337,6 +337,10 @@ hardlink -c -vv /lib/firmware >> # Regenerate all initrds >> dracut --regenerate-all --force >> >> +# Replace /etc/mtab by symlink as mount no longer writes it >> +rm -vf /etc/mtab >> +ln -vs /proc/self/mounts /etc/mtab >=20 > Okay. This would work. this sounds like you would have done that in another way... >=20 >> + >> # Rebuild IPS rules >> perl -e "require '/var/ipfire/ids-functions.pl'; &IDS::oinkmaster();" >> /etc/init.d/suricata reload >> diff --git a/lfs/cdrom b/lfs/cdrom >> index f35ff6a35..d84f8c23c 100644 >> --- a/lfs/cdrom >> +++ b/lfs/cdrom >> @@ -1,7 +1,7 @@ >> ##########################################################################= ##### >> # = # >> # IPFire.org - A linux based firewall = # >> -# Copyright (C) 2007-2021 IPFire Team = # >> +# Copyright (C) 2007-2022 IPFire Team = # >> # = # >> # This program is free software: you can redistribute it and/or modify = # >> # it under the terms of the GNU General Public License as published by = # >> @@ -149,7 +149,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) >> >> # Clear mtab (prevents .journal problems) >> rm -vf /etc/mtab >> - echo > /etc/mtab >> + ln -s /proc/self/mounts /etc/mtab >=20 > This however should not be required. Where does the symlink then come from on new installations? Thanks, and best regards, Peter M=C3=BCller >=20 > Shipping the symlink should be enough. It would be great to get rid of hack= s like these. >=20 >> # Create filelist for packaging. >> BUILDTARGET=3D"$(BUILDTARGET)" BUILD_ARCH=3D"$(BUILD_ARCH)" KVER=3D"$(KVE= R)" \ >> diff --git a/lfs/stage2 b/lfs/stage2 >> index 9f93babe2..39697a848 100644 >> --- a/lfs/stage2 >> +++ b/lfs/stage2 >> @@ -87,7 +87,8 @@ endif >> cp -rvf $(DIR_SRC)/config/etc/* /etc; >> [ ! -d "$(DIR_SRC)/config/etc-$(BUILD_ARCH)" ] || cp -rvf $(DIR_SRC)/conf= ig/etc-$(BUILD_ARCH)/* /etc >> cp -rvf $(DIR_SRC)/config/lib/* /lib; >> - touch /etc/{fs,m}tab >> + touch /etc/fstab >> + ln -s /proc/self/mounts /etc/mtab >> echo "$(NAME) v$(VERSION) - $(SLOGAN)" > /etc/issue >> echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D" >> /etc/issue >> echo "\n running on \s \r \m" >> /etc/issue >> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mount= fs >> index b1533d6a2..81ed729c1 100644 >> --- a/src/initscripts/system/mountfs >> +++ b/src/initscripts/system/mountfs >> @@ -31,12 +31,6 @@ case "${1}" in >> # Remove fsck-related file system watermarks. >> rm -f /fastboot /forcefsck >> >> - boot_mesg "Create /etc/mtab..." >> - > /etc/mtab >> - mount -f / || failed=3D1 >> - (exit ${failed}) >> - evaluate_retval >> - >> # This will mount all filesystems that do not have _netdev in >> # their option list. _netdev denotes a network filesystem. >> boot_mesg "Mounting remaining file systems..." >> diff --git a/src/initscripts/system/partresize b/src/initscripts/system/pa= rtresize >> index 7605b9e2b..147405e1e 100644 >> --- a/src/initscripts/system/partresize >> +++ b/src/initscripts/system/partresize >> @@ -30,12 +30,6 @@ case "${1}" in >> mount -o remount,rw / > /dev/null >> evaluate_retval >> >> - boot_mesg "Create /etc/mtab..." >> - > /etc/mtab >> - mount -f / || failed=3D1 >> - (exit ${failed}) >> - evaluate_retval >> - >> # check if serial console enabled >> scon=3D"off"; >> if [ ! "$(grep "console=3DttyS0" /proc/cmdline)" =3D=3D "" ]; then >> --=20 >> 2.34.1 >=20 --===============6710109166615085244==--