Bug 1271850 - mount -a doesn't catch a typo in /etc/fstab and a typo in /etc/fstab can make a system not reboot properly
mount -a doesn't catch a typo in /etc/fstab and a typo in /etc/fstab can make...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: util-linux (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Karel Zak
qe-baseos-daemons
:
Depends On: 1271848
Blocks: 1203710 1289485 1313485
  Show dependency treegraph
 
Reported: 2015-10-14 17:23 EDT by Dave Sullivan
Modified: 2016-11-03 17:25 EDT (History)
5 users (show)

See Also:
Fixed In Version: util-linux-2.23.2-31.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1271848
Environment:
Last Closed: 2016-11-03 17:25:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Sullivan 2015-10-14 17:23:50 EDT
+++ This bug was initially created as a clone of Bug #1271848 +++

Description of problem:

Systems booted and was appearing to do an fsck but was failing because of the args past in via /etc/fstab

/ partition referenced in /etc/fstab looked like this (note the -e)

[root@seaking ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Fri Jan  7 15:10:37 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
-e/dev/mapper/rootvg-rootlv /                       ext4    defaults        1 1
UUID=1d960796-c08d-4a0d-926f-3cf3c193ebd2 /boot                   ext4    defaults        1 2
/dev/mapper/rootvg-tmplv /tmp                    ext4    defaults        1 2
/dev/mapper/rootvg-varlv /var                    ext4    defaults        1 2
/dev/mapper/rootvg-crashlv /var/crash              ext4    defaults        1 2
/dev/mapper/rootvg-swaplv swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/md0	        /data		ext4	defaults,nodiratime,noatime,barrier=0	0 0

Notice how mount -a doesn't recognize an issue

[root@seaking ~]# mount -a
[root@seaking ~]#

Now if I add a space after -e an issue is recognized.

[root@seaking ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Fri Jan  7 15:10:37 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
-e /dev/mapper/rootvg-rootlv /                       ext4    defaults        1 1
UUID=1d960796-c08d-4a0d-926f-3cf3c193ebd2 /boot                   ext4    defaults        1 2
/dev/mapper/rootvg-tmplv /tmp                    ext4    defaults        1 2
/dev/mapper/rootvg-varlv /var                    ext4    defaults        1 2
/dev/mapper/rootvg-crashlv /var/crash              ext4    defaults        1 2
/dev/mapper/rootvg-swaplv swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/md0	        /data		ext4	defaults,nodiratime,noatime,barrier=0	0 0

[root@seaking ~]# mount -a
[mntent]: line 9 in /etc/fstab is bad

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

mount -a
echo $? returns 0 


Expected results:

mount -a should be able to catch the noted typo above


Additional info:

[root@seaking ~]# for fs in $(awk '!/^#/ {print $1}' /etc/fstab) ; do mount -fv ${fs} >/dev/null || echo ${fs} ; done
mount: invalid option -- 'e'
Usage: mount -V                 : print version
       mount -h                 : print this help
       mount                    : list mounted filesystems
       mount -l                 : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
       mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
       mount device             : mount device at the known place
       mount directory          : mount known device here
       mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
       mount --bind olddir newdir
or move a subtree:
       mount --move olddir newdir
One can change the type of mount containing the directory dir:
       mount --make-shared dir
       mount --make-slave dir
       mount --make-private dir
       mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
       mount --make-rshared dir
       mount --make-rslave dir
       mount --make-rprivate dir
       mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say  man 8 mount .
-e/dev/mapper/rootvg-rootlv
mount: according to mtab, /dev/sdb1 is already mounted on /boot

UUID=1d960796-c08d-4a0d-926f-3cf3c193ebd2
mount: according to mtab, /dev/mapper/rootvg-tmplv is already mounted on /tmp

/dev/mapper/rootvg-tmplv
mount: according to mtab, /dev/mapper/rootvg-varlv is already mounted on /var

/dev/mapper/rootvg-varlv
mount: according to mtab, /dev/mapper/rootvg-crashlv is already mounted on /var/crash

/dev/mapper/rootvg-crashlv
mount: according to mtab, /dev/mapper/rootvg-swaplv is already mounted on swap

/dev/mapper/rootvg-swaplv
mount: according to mtab, tmpfs is already mounted on /dev/shm

tmpfs
mount: according to mtab, devpts is already mounted on /dev/pts

devpts
mount: according to mtab, sysfs is already mounted on /sys

sysfs
mount: according to mtab, proc is already mounted on /proc

proc
mount: according to mtab, /dev/md0 is already mounted on /data

/dev/md0
Comment 2 Karel Zak 2015-10-15 06:18:35 EDT
Well, RHEL7 libmount based mount(8) behaves differently than the original mount(8) from RHEL6. 

Unfortunately, it does not ignore malformed fstab lines, this bug affects mount, umount, findmnt, lsblk, swapon and swapof.

Note that RHEL7 does not use "mount -a" during boot (systemd handles this).

Fixed in upstream tree, commit 1cd9d0d7463850ef6b16a78b8a55e56dbf9a8db1
(and optionally also 1bb02a2da9f1bf7d80b352d540b29371099ab570).
Comment 4 Mike McCune 2016-03-28 18:54:17 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 8 errata-xmlrpc 2016-11-03 17:25:11 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2605.html

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