mount error message
I have a user that complains that mount is giving an incorrect error message under some circumstances. For instance if mtab is symlinked to /proc/self/mounts the command and /run is not in fstab:
$ mount /run
returns an error message:
mount: /run: No such file or directory
However if mtab is a regular file, the error message is:
mount: can't find /run in /etc/fstab
It would be appropriate if both situations could return the 2nd message.
-- Bruce Dubbs
linuxfromscratch.org
Quoted 7 lines
From: Bruce Dubbs <[email protected]>
$ mount /runreturns an error message:
mount: /run: No such file or directory
Does the directory /run exist on the system?
If it exists, then this message should not be appearing.
If it does exist, and also /run isn't in /etc/fstab, then mount has the choice of which error to report.
Dale
Hallo, Bruce,
Du meintest am 07.09.14:
Quoted 8 lines
I have a user that complains that mount is giving an incorrect error message under some circumstances. For instance if mtab is symlinked to
/proc/self/mountsthe command and /run is not in fstab:$ mount /runreturns an error message:
Quoted 8 lines
mount: /run: No such file or directory
However if mtab is a regular file, the error message is:
mount: can't find /run in
/etc/fstabIt would be appropriate if both situations could return the 2nd message.
There's no need to put the device into a special line in "/etc/fstab".
mount /dev/sdxn /run
should always work, with the appropriate values for x and n.
Viele Gruesse!
Helmut
Quoted 18 lines · Helmut Hullen
Hallo, Bruce,
Du meintest am 07.09.14:
Quoted 13 lines
I have a user that complains that mount is giving an incorrect error message under some circumstances. For instance if mtab is symlinked to
/proc/self/mountsthe command and /run is not in fstab:$ mount /runreturns an error message:
mount: /run: No such file or directory
However if mtab is a regular file, the error message is:
mount: can't find /run in
/etc/fstab
Quoted 8 lines
Quoted 2 lines
It would be appropriate if both situations could return the 2nd message.
There's no need to put the device into a special line in "
/etc/fstab".mount
/dev/sdxn/runshould always work, with the appropriate values for x and n.
Unless your script does not know what x or n are in advance.
Actually I followed up my original post and said the it was invalid.
-- Bruce
Karel Zak
maintainerQuoted 6 lines · Bruce Dubbs
I have a user that complains that mount is giving an incorrect error message under some circumstances. For instance if mtab is symlinked to
/proc/self/mountsthe command and /run is not in fstab:$ mount /run
Quoted 7 lines
returns an error message:
mount: /run: No such file or directory
However if mtab is a regular file, the error message is:
mount: can't find /run in
/etc/fstab
$ test -d /mnt/test && echo "yes" || echo "no" yes $ test -d /nothing && echo "yes" || echo "no" no
$ ls -l /etc/mtab lrwxrwxrwx 1 root root 12 Jun 17 15:42 /etc/mtab -> /proc/mounts
$ mount /mnt/test mount: can't find /mnt/test in /etc/fstab
$ mount /nothing mount: /nothing: No such file or directory
$ ls -l /etc/mtab -r--r--r-- 1 root root 2693 Sep 10 10:16 /etc/mtab
$ mount /mnt/test mount: can't find /mnt/test in /etc/fstab $ mount /nothing mount: /nothing: No such file or directory
All works as expected.
Note that mount(8) sanitize paths specified by non-root users on command line, so the message "No such file or directory" is really expected and it's far before libmount starts to evaluate things in mtab/fstab.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 38 lines · Karel Zak
Quoted 6 lines · Bruce Dubbs
I have a user that complains that mount is giving an incorrect error message under some circumstances. For instance if mtab is symlinked to
/proc/self/mountsthe command and /run is not in fstab:$ mount /runQuoted 7 lines
returns an error message:
mount: /run: No such file or directory
However if mtab is a regular file, the error message is:
mount: can't find /run in
/etc/fstab$ test -d /mnt/test && echo "yes" || echo "no" yes $ test -d /nothing && echo "yes" || echo "no" no$ ls -l /etc/mtab lrwxrwxrwx 1 root root 12 Jun 17 15:42 /etc/mtab -> /proc/mounts$ mount /mnt/test mount: can't find /mnt/test in /etc/fstab$ mount /nothing mount: /nothing: No such file or directory$ ls -l /etc/mtab -r--r--r-- 1 root root 2693 Sep 10 10:16 /etc/mtab$ mount /mnt/test mount: can't find /mnt/test in /etc/fstab $ mount /nothing mount: /nothing: No such file or directory
Quoted 9 lines
All works as expected.
Note that mount(8) sanitize paths specified by non-root users on command line, so the message "No such file or directory" is really expected and it's far before libmount starts to evaluate things in mtab/fstab.
Karel
Hello I'm the user in question. The specific situation was a boot time failure where /proc had failed to mount. So to enumerate the conditions and the result:
1) /proc is not mounted (or has failed to mount)
2) /etc/mtab is a symlink to /proc/mounts (or /proc/self/mounts)
3) /run is not in /etc/fstab
4) The directory /run exists on the filesystem
In this situation 'mount /run' results in:
mount: /run: mount failed: No such file or directory
Obviously mount is referring to /etc/mtab not existing, so the error message at present is misleading.
Karel Zak
maintainerQuoted 8 lines · Dylan Cali
Hello I'm the user in question. The specific situation was a boot time failure where /proc had failed to mount. So to enumerate the conditions and the result:
1) /proc is not mounted (or has failed to mount)
2)/etc/mtabis a symlink to/proc/mounts(or/proc/self/mounts)
3) /run is not in/etc/fstab
4) The directory /run exists on the filesystem
Very special use-case :-)
Quoted 5 lines
In this situation 'mount /run' results in:
mount: /run: mount failed: No such file or directoryObviously mount is referring to
/etc/mtabnot existing, so the error message at present is misleading.
Fixed in master branch. Thanks!
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 6 lines · Karel Zak
Quoted 4 lines · Dylan Cali
1) /proc is not mounted (or has failed to mount)
2)/etc/mtabis a symlink to/proc/mounts(or/proc/self/mounts)
3) /run is not in/etc/fstab
4) The directory /run exists on the filesystem
Quoted 6 lines
Very special use-case :-)
Quoted 2 lines
In this situation 'mount /run' results in:
mount: /run: mount failed: No such file or directoryFixed in master branch. Thanks!
Always trust random internet user to find the corner case :) Thanks for your help!
Dylan