mtab hint

Seth W. Klein sk at sethwklein.net
Tue Jul 30 22:14:37 PDT 2002


Sorry for the delay, i've been very busy what with the summer work-
load and preparing for my vacation this weekend.

Oliver Brakmann <obrakmann at gmx.net> wrote:
> 
> I wrote a hint about dealing with the mtab problems that
> came up quite often on the mailings lists in the past few
> weeks.
> 
> Seth W. Klein told me a month ago that he wanted to do so,
> but since as of now he hasn't I decided to give it a go.
> I hope it's alright with you, Seth.

Fine with me. I probably won't have the time until fall and maybe
not even then.

> Seth, I'd like you to please review this hint for any blatant
> errors I may have made. Thanks.

Sure, here goes... :)

One major addition: /proc should be mounted before fsck is run so
fsck has access to acurate data. I mount /proc before doing almost
anything else on the chance that something else done before mounting
all filesystems will use it, too. When /proc is mounted before fsck,
its entry in /etc/mtab must be created with "mount -f" like for the
root partition. It may also be necessary to set /proc to noauto in
/etc/fstab to avoid an error when doing "mount -a".

The "talk about a wrong root device listed in /etc/mtab" that you
mention refers to some kernels which list the root entry in
/proc/mounts like this:
	/dev/root / ext2 rw 0 0
instead of like this:
	/dev/ide/host0/bus0/target0/lun0/part6 / ext2 rw 0 0
Which hides the identity of the root device.

There's no need to use "defaults,noauto" in /etc/fstab. Just "noauto"
is fine since the "defaults" option only exists because the file
format can't have an empty field.

I rechecked the glibc source and changed my mind about how necessary
it is to recompile glibc after patching paths.h. _PATH_MOUNTED is
used in a few C source files so changing the installed paths.h would
cause disagreement between it and them. It is also good to recompile
anything else that uses _PATH_MOUNTED (or its alias, MOUNTED), not
just util-linux although it's only critical with things that write
to /etc/mtab and i can't think of any right now.

It's interesting to note that the glibc info documentation says
_PATH_MOUNTED is deprecated and _PATH_MNTTAB and _PATH_FSTAB should
be used to reference /etc/mtab and /etc/fstab, respectively, but
those macros both expand to "/etc/fstab". Bug, anyone? But anyway,
i've sent a bug report, if they fix it, the patch will probably
need to be updated.

Now for some more editorial style comments. I hope you don't mind :)

You actually cover two related but distinct procedures in this hint:

1) Replacing the LFS /etc/mtab -> /proc/mounts symlink correctly.
2) Handling /etc/mtab when /etc is on a read-only partition.

I think it is good to have both in one hint, but it is necessary
to make clear that both are included, and i think you'll find the
infomation is clearer if you first cover modifying LFS to correctly
handle /etc/mtab and then cover modifying that setup for a read-only
/etc.

Also, the TITLE and SYNOPSIS fields will be used to automatically
generate the HTML hints index so you can use them to determine the
text of the hint's listing on that page.

> I'd also like to thank you, Seth, for the help you gave me
> with this stuff. I wouldn't have known how to do this
> without you.

I'd like to thank you for testing my ramblings otherwise we'd never
have anything useful from them :)

cheers,
Seth W. Klein
-- 
sk at sethwklein.net                             http://www.sethwklein.net/
Maintainer, LFS FAQ                 http://www.linuxfromscratch.org/faq/
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list