Description of problem:
In emergency "(Repair filesystem)" mode, mount claims ro filesystems are mounted rw.
Version-Release number of selected component (if applicable):
mount (util-linux 2.13-pre7)
Steps to Reproduce:
1.Put an unavailable mount point into /etc/fstab.
"mount" claims / is mounted rw, but it's actually ro.
"mount" should show / is ro, or at least not claim it's rw (if unknown because mtab doesn't exist).
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/sda2
/1: clean, 149239/2072576 files, 919311/2072385 blocks
[/sbin/fsck.ext3 (1) -- /home] fsck.ext3 -a /dev/sda6
/home: clean, 28/179437568 files, 5669770/179431985 blocks
[/sbin/fsck.ext3 (1) -- /var] fsck.ext3 -a /dev/sda5
/var: clean, 1445/1048576 files, 125365/1048233 blocks
[/sbin/fsck.ext3 (1) -- /sdb1] fsck.ext3 -a LABEL=sdb1
fsck.ext3: Unable to resolve 'LABEL=sdb1'
[/sbin/fsck.ext2 (1) -- /boot] fsck.ext2 -a /dev/sda1
/boot1: clean, 39/66264 files, 21035/265040 blocks
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):
(Repair filesystem) 1 # mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
(Repair filesystem) 2 # touch /test
touch: cannot touch `/test': Read-only file system
(Repair filesystem) 3 # mount -oremount,rw /
(Repair filesystem) 4 # touch /test
(Repair filesystem) 5 # rm /test
rm: remove regular empty file `/test'? y
(Repair filesystem) 6 #
It would be nice to check /etc/mtab against /proc/uptime and detect the
situation when the mtab file is not up to date.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Fixed. The mount(8) prints
mount: warning /etc/mtab is not writeable (e.g. read-only filesystem).
It's possible that information reported by mount(8) are not
up to date. For actual information about system mount points
check the /proc/mounts file.
when /etc/mtab is not writeable
Cool, but s/are not/is not/ to match singular "information".
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
The new warning is always printed when "mount" is run as non-root, which may be confusing to users. Furthermore, the extra output is likely to confuse scripts that parse the output of the "mount" command.
The second problem could be lessened by sending the warning to the standard error rather than the standard output, but it would be best to print the warning only when "mount" is run by the super user.
(In reply to comment #14)
> The new warning is always printed when "mount" is run as non-root, which may be
> confusing to users.
what do you mean with "always"? The warning should be printed only when mtab is not writeable and the file is not symlink to /proc/mounts.
Note that mtab is read-only then your system is repair mode (=so very rarely) only.
This is on a system where /etc/redhat-release says:
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
with mount from the util-linux-2.13-0.50.el5 RPM. Even in run-level 5, /etc/mtab is a regular file rather than a symbolic link:
% vdir /etc/mtab
-rw-r--r-- 1 root root 4200 Jan 31 11:25 /etc/mtab
I get the warning when running the "mount" command from my own account, but not as root. With kernel-2.6.18-128.el5 the format of /proc/mounts is different from /etc/mtab, so a symbolic link between them could cause parsing problems for existing scripts.