Message ID | 9e744e7b-4d05-032c-791f-52a69f334c2a@ipfire.org |
---|---|
State | Accepted |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4KcdpQ37Fwz3x1y for <patchwork@web04.haj.ipfire.org>; Mon, 11 Apr 2022 19:14:54 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4KcdpP2vZpz5Gg; Mon, 11 Apr 2022 19:14:53 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KcdpP2wVHz2yW0; Mon, 11 Apr 2022 19:14:53 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KcdpN2YTjz2xFK for <development@lists.ipfire.org>; Mon, 11 Apr 2022 19:14:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KcdpL6M8cz5Kw for <development@lists.ipfire.org>; Mon, 11 Apr 2022 19:14:50 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1649704491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vuyo4djDGFAyu41JCIhR1jeziKD1osQTVA9br3/CGKU=; b=y2GP6U98QDRkf9ZrsSUmVmmNevSd/cbkgTRrffn7e8RHvt6D5HQAdeG1tZuXLbgV4/cvNq W6C0yzJxGIbC2KDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1649704491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vuyo4djDGFAyu41JCIhR1jeziKD1osQTVA9br3/CGKU=; b=c+82aFc4q6mKKBqKdMXJLXl5b+ZFlo2dof0Sy/nM5HetT1q8LEHy1rWAwwBcZ39NkY2Xzr Dg+3kDbwyoIgO4xdL4IWV27qSyi7n/FTe6YEeMCgG7vUOBJ6cFdVt0VBdulG6huQUCmERd Sr94W57TquWh1I0J14QJKZMPpU+7KtKjyJf6TC4Na2TRSaUvEscqCxbiH6hkqooU5ijVzl IFqzd8LxxwK1tFXYywdy7IVJJ8Q7ohNPCFbCYSHKsSlGl0Lu3wydodw8y62Znx0XqND+i4 9px0rbdUaHe6sCNIXJug6jrtlpV+/0MYUTQxPchGwrl7T6sEQ3QzIkXaKv49ow== Message-ID: <9e744e7b-4d05-032c-791f-52a69f334c2a@ipfire.org> Date: Mon, 11 Apr 2022 19:14:43 +0000 MIME-Version: 1.0 Content-Language: en-US To: "IPFire: Development" <development@lists.ipfire.org> From: =?utf-8?q?Peter_M=C3=BCller?= <peter.mueller@ipfire.org> Subject: [PATCH] Core Update 167: Replace /etc/mtab by symlink to /proc/self/mounts Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
Core Update 167: Replace /etc/mtab by symlink to /proc/self/mounts
|
|
Commit Message
Peter Müller
April 11, 2022, 7:14 p.m. UTC
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üller <peter.mueller@ipfire.org>
---
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(-)
Comments
Hello, > On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: > > 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üller <peter.mueller@ipfire.org> > --- > 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/167/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 Okay. This would work. > + > # 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 <info@ipfire.org> # > +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # > # # > # 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 This however should not be required. Shipping the symlink should be enough. It would be great to get rid of hacks like these. > # Create filelist for packaging. > BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ > 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)/config/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 "===============================" >> /etc/issue > echo "\n running on \s \r \m" >> /etc/issue > diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs > 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=1 > - (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/partresize > 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=1 > - (exit ${failed}) > - evaluate_retval > - > # check if serial console enabled > scon="off"; > if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then > -- > 2.34.1
Hello Michael, > Hello, > >> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: >> >> 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üller <peter.mueller@ipfire.org> >> --- >> 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/167/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 > > Okay. This would work. this sounds like you would have done that in another way... > >> + >> # 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 <info@ipfire.org> # >> +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >> # # >> # 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 > > This however should not be required. Where does the symlink then come from on new installations? Thanks, and best regards, Peter Müller > > Shipping the symlink should be enough. It would be great to get rid of hacks like these. > >> # Create filelist for packaging. >> BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ >> 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)/config/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 "===============================" >> /etc/issue >> echo "\n running on \s \r \m" >> /etc/issue >> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs >> 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=1 >> - (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/partresize >> 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=1 >> - (exit ${failed}) >> - evaluate_retval >> - >> # check if serial console enabled >> scon="off"; >> if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then >> -- >> 2.34.1 >
Hello, > On 12 Apr 2022, at 13:01, Peter Müller <peter.mueller@ipfire.org> wrote: > > Hello Michael, > >> Hello, >> >>> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: >>> >>> 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üller <peter.mueller@ipfire.org> >>> --- >>> 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/167/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 >> >> Okay. This would work. > > this sounds like you would have done that in another way... No, I just wanted to say something positive and as you know I don’t do this very often, so I am not very good at it :) This is the way to go. >> >>> + >>> # 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 <info@ipfire.org> # >>> +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >>> # # >>> # 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 >> >> This however should not be required. > > Where does the symlink then come from on new installations? It will be part of the regular image like all the other symlinks, too. -Michael > > Thanks, and best regards, > Peter Müller > >> >> Shipping the symlink should be enough. It would be great to get rid of hacks like these. >> >>> # Create filelist for packaging. >>> BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ >>> 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)/config/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 "===============================" >> /etc/issue >>> echo "\n running on \s \r \m" >> /etc/issue >>> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs >>> 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=1 >>> - (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/partresize >>> 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=1 >>> - (exit ${failed}) >>> - evaluate_retval >>> - >>> # check if serial console enabled >>> scon="off"; >>> if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then >>> -- >>> 2.34.1
Hello, I just installed the latest nightly build from the ISO image and /etc/mtab is a regular file. Please see the attached screenshot. -Michael > On 12 Apr 2022, at 13:13, Michael Tremer <michael.tremer@ipfire.org> wrote: > > Hello, > >> On 12 Apr 2022, at 13:01, Peter Müller <peter.mueller@ipfire.org> wrote: >> >> Hello Michael, >> >>> Hello, >>> >>>> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: >>>> >>>> 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üller <peter.mueller@ipfire.org> >>>> --- >>>> 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/167/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 >>> >>> Okay. This would work. >> >> this sounds like you would have done that in another way... > > No, I just wanted to say something positive and as you know I don’t do this very often, so I am not very good at it :) > > This is the way to go. > >>> >>>> + >>>> # 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 <info@ipfire.org> # >>>> +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >>>> # # >>>> # 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 >>> >>> This however should not be required. >> >> Where does the symlink then come from on new installations? > > It will be part of the regular image like all the other symlinks, too. > > -Michael > >> >> Thanks, and best regards, >> Peter Müller >> >>> >>> Shipping the symlink should be enough. It would be great to get rid of hacks like these. >>> >>>> # Create filelist for packaging. >>>> BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ >>>> 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)/config/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 "===============================" >> /etc/issue >>>> echo "\n running on \s \r \m" >> /etc/issue >>>> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs >>>> 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=1 >>>> - (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/partresize >>>> 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=1 >>>> - (exit ${failed}) >>>> - evaluate_retval >>>> - >>>> # check if serial console enabled >>>> scon="off"; >>>> if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then >>>> -- >>>> 2.34.1
Hello Michael, thanks for reporting this. I'll investigate and get back to you later, if necessary. Thanks, and best regards, Peter Müller > Hello, > > I just installed the latest nightly build from the ISO image and /etc/mtab is a regular file. > > Please see the attached screenshot. > > > > -Michael > >> On 12 Apr 2022, at 13:13, Michael Tremer <michael.tremer@ipfire.org> wrote: >> >> Hello, >> >>> On 12 Apr 2022, at 13:01, Peter Müller <peter.mueller@ipfire.org> wrote: >>> >>> Hello Michael, >>> >>>> Hello, >>>> >>>>> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: >>>>> >>>>> 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üller <peter.mueller@ipfire.org> >>>>> --- >>>>> 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/167/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 >>>> >>>> Okay. This would work. >>> >>> this sounds like you would have done that in another way... >> >> No, I just wanted to say something positive and as you know I don’t do this very often, so I am not very good at it :) >> >> This is the way to go. >> >>>> >>>>> + >>>>> # 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 <info@ipfire.org> # >>>>> +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >>>>> # # >>>>> # 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 >>>> >>>> This however should not be required. >>> >>> Where does the symlink then come from on new installations? >> >> It will be part of the regular image like all the other symlinks, too. >> >> -Michael >> >>> >>> Thanks, and best regards, >>> Peter Müller >>> >>>> >>>> Shipping the symlink should be enough. It would be great to get rid of hacks like these. >>>> >>>>> # Create filelist for packaging. >>>>> BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ >>>>> 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)/config/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 "===============================" >> /etc/issue >>>>> echo "\n running on \s \r \m" >> /etc/issue >>>>> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs >>>>> 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=1 >>>>> - (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/partresize >>>>> 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=1 >>>>> - (exit ${failed}) >>>>> - evaluate_retval >>>>> - >>>>> # check if serial console enabled >>>>> scon="off"; >>>>> if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then >>>>> -- >>>>> 2.34.1 > >
Well, the /etc/mtab part in the cdrom LFS file turns out to overwrite the symlink created by stage2. Fixed in commit 9a271cf7a8886c09854bdd69e636f1ef56280b1d - as I told you. :-) > Hello Michael, > > thanks for reporting this. > > I'll investigate and get back to you later, if necessary. > > Thanks, and best regards, > Peter Müller > > >> Hello, >> >> I just installed the latest nightly build from the ISO image and /etc/mtab is a regular file. >> >> Please see the attached screenshot. >> >> >> >> -Michael >> >>> On 12 Apr 2022, at 13:13, Michael Tremer <michael.tremer@ipfire.org> wrote: >>> >>> Hello, >>> >>>> On 12 Apr 2022, at 13:01, Peter Müller <peter.mueller@ipfire.org> wrote: >>>> >>>> Hello Michael, >>>> >>>>> Hello, >>>>> >>>>>> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller@ipfire.org> wrote: >>>>>> >>>>>> 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üller <peter.mueller@ipfire.org> >>>>>> --- >>>>>> 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/167/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 >>>>> >>>>> Okay. This would work. >>>> >>>> this sounds like you would have done that in another way... >>> >>> No, I just wanted to say something positive and as you know I don’t do this very often, so I am not very good at it :) >>> >>> This is the way to go. >>> >>>>> >>>>>> + >>>>>> # 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 <info@ipfire.org> # >>>>>> +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >>>>>> # # >>>>>> # 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 >>>>> >>>>> This however should not be required. >>>> >>>> Where does the symlink then come from on new installations? >>> >>> It will be part of the regular image like all the other symlinks, too. >>> >>> -Michael >>> >>>> >>>> Thanks, and best regards, >>>> Peter Müller >>>> >>>>> >>>>> Shipping the symlink should be enough. It would be great to get rid of hacks like these. >>>>> >>>>>> # Create filelist for packaging. >>>>>> BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ >>>>>> 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)/config/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 "===============================" >> /etc/issue >>>>>> echo "\n running on \s \r \m" >> /etc/issue >>>>>> diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs >>>>>> 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=1 >>>>>> - (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/partresize >>>>>> 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=1 >>>>>> - (exit ${failed}) >>>>>> - evaluate_retval >>>>>> - >>>>>> # check if serial console enabled >>>>>> scon="off"; >>>>>> if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then >>>>>> -- >>>>>> 2.34.1 >> >>
diff --git a/config/rootfiles/core/167/update.sh b/config/rootfiles/core/167/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 + # 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 <info@ipfire.org> # +# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # # # # 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 # Create filelist for packaging. BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \ 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)/config/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 "===============================" >> /etc/issue echo "\n running on \s \r \m" >> /etc/issue diff --git a/src/initscripts/system/mountfs b/src/initscripts/system/mountfs 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=1 - (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/partresize 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=1 - (exit ${failed}) - evaluate_retval - # check if serial console enabled scon="off"; if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then