# Fstab & mtab !

## CooSee

hello,

fresh installed GenToo   :Cool: 

everything worked fine, but i just wondering why i get this:

df :

rootfs                68354452   8713396  59641056  13% /       < ---   :Question: 

/dev/root             68354452   8713396  59641056  13% /     < --     :Rolling Eyes: 

udev                     10240       168     10072   2% /dev

shm                     262144         0    262144   0% /dev/shm

none                      1024        68       956   7% /lib/rc/init.d

/dev/sda3             90595756  23883392  66712364  27% /AllMiXeD

=====

fstab :

/dev/sdb1               /boot                   reiserfs        noauto,noatime  1 2

/dev/sdb3               /                       reiserfs        noatime         0 1

/dev/sdb2               none                    swap            sw              0 0

/dev/sda3               /AllMiXeD               reiserfs        noatime         0 2

/dev/sdc                /mnt/cdrom              auto            noauto,ro       0 0

none                    /proc                   proc            defaults        0 0

shm                     /dev/shm                tmpfs           size=256m,nodev,nosuid,noexec   0 0

=====

mtab :

rootfs / rootfs rw 0 0    < ----   :Question:   :Question:   :Question: 

/dev/root / reiserfs rw,noatime 0 0

none /proc proc rw 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0

udev /dev tmpfs rw,nosuid 0 0

none /dev/pts devpts rw,nosuid,noexec 0 0

shm /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0

none /lib/rc/init.d tmpfs rw,nosuid,nodev,noexec 0 0

/dev/sda3 /AllMiXeD reiserfs rw,noatime 0 0

usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0

nfsd /proc/fs/nfsd nfsd rw,noexec,nosuid,nodev 0 0

securityfs /sys/kernel/security securityfs rw,noexec,nosuid,nodev 0 0

====

never see this ' rootfs ' before   :Rolling Eyes:   :Exclamation:   :Question: 

CooSee ' Ya

----------

## padoor

```
localhost ramaswamy # df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/hda10            23702964  12215064  10283832  55% /

udev                     10240       168     10072   2% /dev

shm                     256528         0    256528   0% /dev/shm

/dev/hda5              7800324   2342004   5458320  31% /pubdata

/dev/hda1              4874192   4471408    402784  92% /mnt/hda1

/dev/hda6             19020928   7556612  11464316  40% /mnt/hda6
```

```
localhost ramaswamy # cat /etc/mtab

/dev/hda10 / ext3 rw,noatime 0 0

proc /proc proc rw 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0

udev /dev tmpfs rw,nosuid 0 0

devpts /dev/pts devpts rw,nosuid,noexec 0 0

shm /dev/shm tmpfs rw,noexec,nosuid,nodev 0 0

/dev/hda5 /pubdata vfat rw,nosuid,nodev,umask=0 0 0

/dev/hda1 /mnt/hda1 vfat rw,nosuid,nodev,umask=0 0 0

/dev/hda6 /mnt/hda6 fuseblk rw,nosuid,nodev,allow_other,blksize=4096 0 0

usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0
```

```
localhost ramaswamy # cat /etc/fstab

# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

# /dev/BOOT             /boot           ext2            noauto,noatime  1 2

/dev/hda10              /               ext3            noatime         0 1

/dev/hda8               none            swap            sw              0 0

/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro       0 0

#/dev/fd0               /mnt/floppy     auto            noauto          0 0

# NOTE: The next line is critical for boot!

proc                    /proc           proc            defaults        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

/dev/hda5               /pubdata        vfat            user,exec,rw,umask=0             00

/dev/hda1               /mnt/hda1       vfat              user,exec,rw,umask=0   00  

/dev/hda6               /mnt/hda6       ntfs-3g           user,exec,rw,umask=0     00

localhost ramaswamy #                   
```

i dont see root filesystem here

----------

## CooSee

hmmm,... i did an ' Stage1 ' install using ' Fiordland Guide ',

maybe this is the Problem   :Question: 

and i see also at boot ' ... updating mtab ... , or something like this   :Exclamation: 

never see this ' mtab - thing ' before.

so howto get rid of ' rootfs '   :Crying or Very sad: 

CooSee ' Ya

----------

## CooSee

Old Bugs are back   :Question:   :Evil or Very Mad: 

i figured out that this nasty Bug has ' maybe ' todo with ' checkroot '   :Exclamation: 

https://bugs.gentoo.org/show_bug.cgi?id=38360

need Help   :Crying or Very sad:   :Sad:   :Evil or Very Mad: 

CooSee ' Ya

----------

## padoor

i think it is worth starting from scratch again.

i have installed gentoo for 40 times since i started using gentoo. i never once had a bug you are worried about.

fsck runs ok? on all partitions[idont know about your reiserfs ]

i have always used ext3 only.

----------

## EddieHung

This seems quite similar to another topic, here: https://forums.gentoo.org/viewtopic-p-4642478.html, where I've also added some more information.

Has anyone here found a solution?

Thanks,

Eddie

----------

## eccerr0r

curious,

```
ls -l /etc/mtab
```

is it a file or a symlink to /proc/mounts ?

I see this happening when there's a symlink to /proc/mounts ... and my systems where mtab is handled by umount/mount only do not show this...  Of course if the filesystem is generally read-only there's some advantage to have /etc/mtab -> /proc/mounts ...

----------

## EddieHung

Here we go, this is what I see:

```
eddie@eddies-lappy ~ $ ls /etc/mtab -l 

-rw-r--r-- 1 root root 551 Dec 21 20:29 /etc/mtab

eddie@eddies-lappy ~ $ ls /proc/mounts -l

lrwxrwxrwx 1 root root 11 Dec 21 23:36 /proc/mounts -> self/mounts
```

So I guess the answer is no =)

Eddie

----------

## overkll

Was there a section in that howto that says to copy /proc/mounts to /etc/mtab for your chroot?  Maybe you have a stale mtab.

Boot up with a gentoo minimal install disk or even better, sysrescuecd and then mount your root fs.  Then nuke (delete) your mtab file and reboot.  Should do the trick.  Make sure you nuke the mtab on disk, not the the livecd one.

----------

## EddieHung

 *overkll wrote:*   

> Was there a section in that howto that says to copy /proc/mounts to /etc/mtab for your chroot?  Maybe you have a stale mtab.
> 
> Boot up with a gentoo minimal install disk or even better, sysrescuecd and then mount your root fs.  Then nuke (delete) your mtab file and reboot.  Should do the trick.  Make sure you nuke the mtab on disk, not the the livecd one.

 

Interesting.. I don't seem to recall doing that, whether I was asked to or not.

I haven't got a livecd to hand at the moment - so I can't really try this out - but like I mentioned this is something that never happened when I first installed gentoo. Granted between now and then I've done a lot more tinkering, which is most likely the reason behind my downfall - but I guess I'd like to know what it was =)

Eddie

----------

## CooSee

hello,

IMHO the problem is that ' /etc/conf.d/checkfs ' always create a new ' mtab ' and ignore the current one   :Evil or Very Mad: 

on old installed Systems i never see the message before   :Exclamation:   :Rolling Eyes: 

And why the current ' /proc/mounts / ' have this ' rootfs '   :Question: 

cat /proc/mounts

rootfs / rootfs rw 0 0

/dev/root / reiserfs rw,noatime 0 0

proc /proc proc rw,nosuid,nodev,noexec 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0

udev /dev tmpfs rw,nosuid 0 0

none /dev/pts devpts rw,nosuid,noexec 0 0

shm /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0

none /lib/rc/init.d tmpfs rw,nosuid,nodev,noexec 0 0

usbfs /proc/bus/usb usbfs rw,nosuid,noexec 0 0

nfsd /proc/fs/nfsd nfsd rw,nosuid,nodev,noexec 0 0

securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec 0 0

debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec 0 0

CooSee ' Ya

----------

## padoor

Directory of J:\etc\conf.d

12/22/2007  10:42p      <DIR>          .

12/22/2007  08:26a      <DIR>          ..

09/26/2007  07:58a                 722 consolefont

09/26/2007  07:58a                 254 bootmisc

12/06/2007  01:28p                 972 clock

09/26/2007  07:58a              33,624 net.example

09/26/2007  07:58a                 338 net

09/26/2007  07:58a                 372 env_whitelist

09/26/2007  07:58a                  83 hostname

09/26/2007  07:58a                 709 keymaps

09/26/2007  07:58a                 123 local.start

09/26/2007  07:58a                 217 local.stop

12/21/2007  02:34p                 149 rsyncd

09/26/2007  07:58a               8,722 rc

08/10/2007  09:36a                 430 hdparm

12/21/2007  02:18p               2,377 splash

09/26/2007  07:58a              11,930 wireless.example

09/09/2007  09:07p                  90 xinetd

10/24/2007  09:21a                 395 sshd

07/09/2007  03:48p                 580 gpm

08/03/2006  09:07p                  83 hostname~

09/11/2007  11:43a                 553 xdm

10/21/2007  03:27p                 926 saslauthd

10/11/2007  03:56p                 542 ntp-client

10/11/2007  03:56p                 179 ntpd

10/20/2007  02:49p                 515 alsasound

04/27/2007  08:13a                 291 usb

09/09/2007  09:12p                 737 esound

04/28/2007  05:39p               3,029 cryptfs

12/22/2007  10:42p              45,057 test

05/08/2007  11:35a                 426 dnsextd

05/08/2007  11:35a                  67 mDNSResponderPosix

11/06/2007  10:14a                 364 hald

05/18/2007  07:20a               1,605 spamd details

12/21/2007  04:32p               1,291 samba

12/21/2007  01:44p                 412 crypto-loop

10/15/2007  10:03a                 156 acpid

10/18/2007  10:15a                  15 device-mapper

i dont see a checkfs in this folder. nr i have never come across this conf.d content in all my previous gentoo installatio.,nor the install doc says about making one checkfs

i would suggest you remove it temporarily and see if your mtab situation improves.

is it doing some cron job?  a mounted partition checkfs can result in these troubles  er i guess so.

----------

## CooSee

hello,

ooh sorry, i mean ' /etc/init.d/checkfs '   :Rolling Eyes: 

or maybe the ' rootfs ' came because of this:

from ' /etc/init.d/checkroot '

do_mtab() {

        # Don't create mtab if /etc is readonly

        if ! printf "" 2>/dev/null >/etc/mtab ; then

                ewarn "Skipping /etc/mtab initialization (ro root?)"

                return 0

        fi

        ebegin "Updating /etc/mtab"  < --- always get this at boot, never get this before   :Question: 

        # With / as tmpfs we cannot umount -at tmpfs in localmount as that

        # makes / readonly and dismounts all tmpfs even if in use which is

        # not good. Luckily, umount uses /etc/mtab instead of /proc/mounts

        # which allows this hack to work.

        grep -v "^[^ ]* / tmpfs " /proc/mounts > /etc/mtab

        # Remove stale backups

        rm -f /etc/mtab~ /etc/mtab~~

        eend 0

}

CooSee ' Ya

----------

## padoor

some things look different in your files.

i have below given the /etc/init.d/checkfs and checkroot files seen in my system which is upto todays portage.

/etc/init.d/checkfs

```
#!/sbin/runscript

# Copyright 1999-2007 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

depend() {

   need checkroot modules

}

start() {

   local retval=0

   # Setup dm-crypt mappings if any

   start_addon dm-crypt

   if [[ -f /fastboot ]] || [[ -n ${CDBOOT} ]] ; then

      rm -f /fastboot

   else

      ebegin "Checking all filesystems"

      if [[ -f /forcefsck ]] ; then

         ewarn "A full fsck has been forced"

         fsck -C -T -R -A -a -f

         retval=$?

         rm -f /forcefsck

      else

         fsck -C -T -R -A -a

         retval=$?

      fi

      if [[ ${retval} -eq 0 ]] ; then

         eend 0

      elif [[ ${retval} -eq 8 ]] ; then

         ewend 1 "Operational error, continuing"

         # Everything should be ok, so return a pass

         return 0

      elif [[ ${retval} -ge 1 && ${retval} -le 3 ]] ; then

         ewend 1 "Filesystem errors corrected."

         # Everything should be ok, so return a pass

         return 0

      else

         if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then

            eend 2 "Fsck could not correct all errors, rerunning"

            fsck -C -T -R -A -y

            retval=$?

         fi

         if [[ ${retval} -gt 3 ]] ; then

            eend 2 "Fsck could not correct all errors, manual repair needed"

            sulogin ${CONSOLE}

         fi

      fi

   fi

}

# vim:ts=4
```

/etc/init.d/checkroot

```

#!/sbin/runscript

# Copyright 1999-2007 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

depend() {

   before *

}

start() {

   local retval=0

   if [[ ! -f /fastboot && -z ${CDBOOT} ]] \

   && ! is_net_fs / && ! is_union_fs / ; then

      if touch -c / >& /dev/null ; then

         ebegin "Remounting root filesystem read-only"

         mount -n -o remount,ro /

         eend $?

      fi

      if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then

         ebegin "Checking root filesystem (full fsck forced)"

         fsck -C -a -f /

         # /forcefsck isn't deleted because checkfs needs it.

         # it'll be deleted in that script.

         retval=$?

      else

         # Obey the fs_passno setting for / (see fstab(5))

         # - find the / entry

         # - make sure we have 6 fields

         # - see if fs_passno is something other than 0

         if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \

                         && NF == 6 && $6 != 0) { print }' /etc/fstab) ]]

         then

            ebegin "Checking root filesystem"

            fsck -C -T -a /

            retval=$?

         else

            ebegin "Skipping root filesystem check (fstab's passno == 0)"

            retval=0

         fi

      fi

      if [[ ${retval} -eq 0 ]] ; then

         eend 0

      elif [[ ${retval} -eq 1 ]] ; then

         ewend 1 "Filesystem repaired"

      elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then

         ewend 1 "Filesystem repaired, but reboot needed!"

         if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then

            echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1

            echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1

            ewarn "Rebooting in 10 seconds ..."

            sleep 10

         fi

         einfo "Rebooting"

         /sbin/reboot -f

      else

         if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then

            eend 2 "Rerunning fsck in force mode"

            fsck -y -C -T /

         else

            eend 2 "Filesystem couldn't be fixed :("

            sulogin ${CONSOLE}

         fi

         einfo "Unmounting filesystems"

         /bin/mount -a -o remount,ro &> /dev/null

         einfo "Rebooting"

         /sbin/reboot -f

      fi

   fi

   # Should we mount root rw ?  the touch check is to see if the / is

   # already mounted rw in which case there's nothing for us to do

   if mount -vf -o remount / 2> /dev/null | \

      awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' && \

      ! touch -c / >& /dev/null

   then

      ebegin "Remounting root filesystem read/write"

      mount -n -o remount,rw / &> /dev/null

      if [[ $? -ne 0 ]] ; then

         eend 2 "Root filesystem could not be mounted read/write :("

         if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then

            sulogin ${CONSOLE}

         fi

      else

         eend 0

      fi

   fi

   if [[ ${BOOT} == "yes" ]] ; then

      local x=

      local y=

      #

      # Create /etc/mtab

      #

      # Don't create mtab if /etc is readonly

      if ! touch /etc/mtab 2> /dev/null ; then

         ewarn "Skipping /etc/mtab initialization (ro root?)"

         return 0

      fi

      # Clear the existing mtab

      > /etc/mtab

      # Add the entry for / to mtab

      mount -f /

      # Don't list root more than once

      awk '$2 != "/" {print}' /proc/mounts >> /etc/mtab

      # Now make sure /etc/mtab have additional info (gid, etc) in there

      for x in $(awk '{ print $2 }' /proc/mounts | sort -u) ; do

         for y in $(awk '{ print $2 }' /etc/fstab) ; do

            if [[ ${x} == ${y} ]] ; then

               mount -f -o remount $x

               continue

            fi

         done

      done

      # Remove stale backups

      rm -f /etc/mtab~ /etc/mtab~~

   fi

}

# vim:ts=4

```

these are complete scripts of the files. compare and do need fuls. you may even run these scripts inplace of your files.

i hope this may help you

----------

## bilbotux

Well, I have the same problem as CooSee, and the same init.d scripts.

I guess the difference is because I (and probable CooSee also) have the baselayout 2.0.0_rc6 version.

----------

## EddieHung

 *bilbotux wrote:*   

> Well, I have the same problem as CooSee, and the same init.d scripts.
> 
> I guess the difference is because I (and probable CooSee also) have the baselayout 2.0.0_rc6 version.

 

A quick me too here, I'm suffering from the problem using the masked baselayout v2!

Maybe that is the root of my problems...

Eddie

----------

## CooSee

 *EddieHung wrote:*   

>  *bilbotux wrote:*   Well, I have the same problem as CooSee, and the same init.d scripts.
> 
> I guess the difference is because I (and probable CooSee also) have the baselayout 2.0.0_rc6 version. 
> 
> A quick me too here, I'm suffering from the problem using the masked baselayout v2!
> ...

 

hello,

yes   :Exclamation:   :Evil or Very Mad: 

eix baselayout

[I] sys-apps/baselayout

     Available versions:  1.11.15-r3 1.12.9-r2 (~)1.12.10-r3 (~)1.12.10-r4 1.12.10-r5 {M}(~)2.0.0_rc4 {M}(~)2.0.0_rc4-r1 {M}(~)2.0.0_rc6 {bootstrap build kernel_FreeBSD kernel_linux pam static unicode}

     Installed versions:  2.0.0_rc6(06:23:58 23.12.2007)(kernel_linux pam unicode -bootstrap -build -kernel_FreeBSD -static)

     Homepage:            http://www.gentoo.org/

     Description:         Filesystem baselayout and init scripts

this is the ' delinquent '   :Question:   :Idea:   :Rolling Eyes: 

CooSee ' Ya

----------

## padoor

```
[I] sys-apps/baselayout

     Available versions:  1.11.15-r3 1.12.9-r2 (~)1.12.10-r3 (~)1.12.10-r4 1.12.10-r5 [M](~)2.0.0_rc4 [M](~)2.0.0_rc4-r1 [M](~)2.0.0_rc6 {bootstrap build kernel_FreeBSD kernel_linux pam static unicode}

     Installed versions:  1.12.10-r5(07:58:16 09/26/07)(unicode -bootstrap -build -static)

     Homepage:            http://www.gentoo.org/

     Description:         Filesystem baselayout and init scripts
```

```
localhost ramaswamy # emerge -av baselayout

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] sys-apps/baselayout-1.12.10-r5  USE="unicode -bootstrap -build -static" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] n
```

Quitting.

```
localhost ramaswamy # emerge -Duav baselayout

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild     U ] sys-apps/debianutils-2.28.2 [2.25] USE="-static" 135 kB

Total: 1 package (1 upgrade), Size of downloads: 135 kB

Would you like to merge these packages? [Yes/No]  
```

it does not want to emerge baselayout-2.0* at all

as seen above it is all masked for me    x86 system

as you see to update wants to emerge debianutils

i would try to downgrade debianutils and /or baselayout for your troubles.

i remember to have read somewhere baselayout-2.0* has different initscripts 

and has some special start sequence controls. and that it is still all masked .

i dont see how you two can install the masked package.

i also use [accept_keywords=~x86] in my make.conf

so it is no use for you of my files quote.

----------

## CooSee

hello,

you're right   :Exclamation:  @ padoor

intalled with this guide '  https://forums.gentoo.org/viewtopic-t-610850-highlight-seren.html '

CooSee ' Ya

----------

## padoor

very daring activity.

i feel taking part in FEAR FACTOR show is less dangerous  :Very Happy:  and adventurous  :Smile: 

enjoy the fun.  :Very Happy:   :Very Happy:   :Very Happy: 

i am sure you are having more than 2 or more computers to play with

good hunt.

you have installed kde-4.0 also?

edit:

do you really get all that is talked about baselayout-2.0*

----------

## bilbotux

Yeah, it seems baselayout2 init scripts are the source of the 'problem', and whether it is hard masked or not is not a reason not to solve this.

But Roy (the one who wrote the baselayout2) has recently left gentoo (link to his blog: http://roy.marples.name/node/337), so I do not know if this one will be solved one day. This is not a big issue, but this bother me a little  :Smile: 

I'm wondering if we should submit a bug report on gentoo's bugzilla or not ??

----------

## padoor

currently its status is unsupported software.

where you report bug?

you have to wait untill it is open for all emerge in portage.

as long as your system work other wise alright why worry about startup message?  :Sad: 

----------

## CooSee

hello,

Thanks for your help @ padoor   :Cool: 

i can live with that   :Exclamation: 

my GenToo purrs like a kitten   :Shocked:   :Rolling Eyes: 

is not a big deal to re-install everything on my new X38-DQ6 - QuadCore 6600 System @ 8GB RAM   :Very Happy:   :Exclamation: 

... mary Xmas ...

CooSee ' Ya

----------

## padoor

MERRY X MAS 

HAVE NICE TIME.  :Very Happy:   :Very Happy:   :Very Happy: 

----------

## UberLord

rootfs is put there by /proc/mounts when we update /etc/mtab.

The kernel wants it there, and some user kernel patches which overmount root with /tmpfs need that entry to correctly shut down the system, so we stopped filtering it.

If you think this is incorrect, then you should report it to the linux kernel team and not Gentoo.

----------

## Shingoshi

 *padoor wrote:*   

> 
> 
> ```
> 
> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
> ...

 

I believe the root filesystem should be:

/dev/hda10		/ 	ext3	 noatime	 0 1

----------

