public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: "Peter Müller" <peter.mueller@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] Core Update 167: Replace /etc/mtab by symlink to /proc/self/mounts
Date: Wed, 13 Apr 2022 09:26:43 +0000	[thread overview]
Message-ID: <4a32044d-d489-a166-2981-3a3bb01eef4b@ipfire.org> (raw)
In-Reply-To: <22E9E77B-27A4-4D86-86B3-D9582E2B2BF0@ipfire.org>

[-- Attachment #1: Type: text/plain, Size: 5646 bytes --]

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(a)ipfire.org> wrote:
>>
>> Hello,
>>
>>> On 12 Apr 2022, at 13:01, Peter Müller <peter.mueller(a)ipfire.org> wrote:
>>>
>>> Hello Michael,
>>>
>>>> Hello,
>>>>
>>>>> On 11 Apr 2022, at 20:14, Peter Müller <peter.mueller(a)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(a)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(a)ipfire.org> #
>>>>> +# Copyright (C) 2007-2022 IPFire Team <info(a)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
> 
> 

       reply	other threads:[~2022-04-13  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <22E9E77B-27A4-4D86-86B3-D9582E2B2BF0@ipfire.org>
2022-04-13  9:26 ` Peter Müller [this message]
2022-04-13 11:41   ` Peter Müller
2022-04-11 19:14 Peter Müller
2022-04-12 10:58 ` Michael Tremer
2022-04-12 12:01   ` Peter Müller
2022-04-12 12:13     ` Michael Tremer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a32044d-d489-a166-2981-3a3bb01eef4b@ipfire.org \
    --to=peter.mueller@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox