Bug 427183 - In repair mode, mount gives false information
Summary: In repair mode, mount gives false information
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: util-linux   
(Show other bugs)
Version: 5.1
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2008-01-02 03:46 UTC by Chris Pepper
Modified: 2009-02-04 20:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-20 20:45:25 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0070 normal SHIPPED_LIVE util-linux bug-fix update 2009-01-20 16:04:08 UTC

Description Chris Pepper 2008-01-02 03:46:46 UTC
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)

How reproducible:

Steps to Reproduce:
1.Put an unavailable mount point into /etc/fstab.

Actual results:
"mount" claims / is mounted rw, but it's actually ro.

Expected results:
"mount" should show / is ro, or at least not claim it's rw (if unknown because mtab doesn't exist).

Additional info:
Checking filesystems
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 #

Comment 1 Karel Zak 2008-05-29 12:35:04 UTC
It would be nice to check /etc/mtab against /proc/uptime and detect the
situation when the mtab file is not up to date.

Comment 2 RHEL Product and Program Management 2008-06-02 20:25:37 UTC
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

Comment 4 Karel Zak 2008-08-21 11:13:56 UTC
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

Comment 5 Chris Pepper 2008-08-21 22:33:37 UTC
Cool, but s/are not/is not/ to match singular "information".

Comment 13 errata-xmlrpc 2009-01-20 20:45:25 UTC
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.


Comment 14 Jeff Makey 2009-02-04 02:42:38 UTC
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.

Comment 15 Karel Zak 2009-02-04 09:49:12 UTC
(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.

Comment 16 Jeff Makey 2009-02-04 20:00:33 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.