Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 288021 - udev-mount fails with more than one entry for /dev in /etc/fstab
Summary: udev-mount fails with more than one entry for /dev in /etc/fstab
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-07 08:50 UTC by Christian Becke
Modified: 2009-11-16 15:38 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Mount udev by device instead of by mountpoint (udev-mount-by-device.patch,405 bytes, patch)
2009-10-10 07:17 UTC, Christian Becke
Details | Diff
use fstabinfo --mount /dev for mounting /dev (udev-mount-fix-multiple-entries-for-dev-in-fstab.patch,493 bytes, patch)
2009-10-10 18:59 UTC, Christian Becke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Becke 2009-10-07 08:50:39 UTC
I have got two entries for /dev in /etc/fstab:

udev  /dev  tmpfs  exec,nosuid,mode=0755,size=10M  0 0
server:/  /mnt/server  nfs  noauto,rsize=8192,wsize=8192,hard,intr  0 0
/dev  /mnt/server/dev  none  noauto,bind  0 0

The second /dev entry is for setting up a chroot for updating my server.

udev-mount calls mount -n /dev, which fails, because the mountpoint /mnt/server/dev does not exist when udev-mount is started, resulting in udev-postmount et al. not being run. This breaks the subsequent boot process.

A possible fix is to mount /dev in udev-mount with:

mount -n udev

Alternatively, there should be a check for "noauto" in the mount options and entries with "noauto" set should be skipped by udev-mount.

I am using baselayout-2.0.1, openrc-0.4.3-r3 and udev-146-r1.
Comment 1 Matthias Schwarzott gentoo-dev 2009-10-09 23:12:31 UTC
Why should "mount -n /dev" help, if you have multiple entries in fstab matching the abstract name "/dev"?

According to the manpage:
      -n     Mount  without writing in /etc/mtab.  This is necessary for example when /etc is on a read-
              only filesystem.

The only change is not to write to /etc/mtab.
There should be an option to restrict the mount argument to only match devices or only match directories and not both columns of /etc/fstab.
Comment 2 Christian Becke 2009-10-10 07:17:33 UTC
Created attachment 206619 [details, diff]
Mount udev by device instead of by mountpoint

You did not understand my suggested fix correctly. udev-postmount currently calls:

mount -n */dev*

I suggested it should call

mount -n *udev*

That is, change the argument to mount from mountpoint to device. See attached patch.
Comment 3 Matthias Schwarzott gentoo-dev 2009-10-10 09:01:04 UTC
The problem with the approach of using "mount -n udev" is, that the string udev is just choosen arbitrary. There can be any valid string, so I think we cannot assume the user who adds this to /etc/fstab will use the string "udev" in this place.
Comment 4 Christian Becke 2009-10-10 18:59:11 UTC
Created attachment 206698 [details, diff]
use fstabinfo --mount /dev for mounting /dev

Another try at fixing this. Now uses fstabinfo --mount /dev instead of mount -n /dev.
Comment 5 Matthias Schwarzott gentoo-dev 2009-11-12 12:41:10 UTC
udev-146-r2 and newer have new init-scripts that should work in your situation.

The logic is this:
mount_dev_directory()
{
        if mountinfo -q /dev; then
                einfo "/dev is already mounted"
                return 0
        fi

        # No options are processed here as they should all be in /etc/fstab
        ebegin "Mounting /dev"
        if ! fstabinfo --mount /dev; then
                # we mount devtmpfs if supported
                local fs=tmpfs
                grep -qs devtmpfs /proc/filesystems && fs=devtmpfs

                # Some devices require exec, Bug #92921
                mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
        fi
        eend $?
}