This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 4072 - mkbootdisk does not respect comment indicators in /etc/fstab
mkbootdisk does not respect comment indicators in /etc/fstab
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: mkbootdisk (Show other bugs)
6.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Matt Wilson
http://www.owlriver.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-07-16 10:06 EDT by R P Herrold
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-09-25 00:03:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description R P Herrold 1999-07-16 10:06:44 EDT
Summary: The created /etc/lilo.conf on the bootdisk is not
correctly created.  FIX listed at end of text.

Steps to recreate:

[root@pokey etc]# grep  sda1 /etc/fstab
#/dev/sda1               /                       ext2
defaults        1 1
/dev/sda1               /               ext2    defaults
  2 2

(fstab has a commented entry for the boot drive and part'n
listed before the effective entry)

-------------------------------

By not respecting the comment indicator, mkbootdisk tries
to use the commented out drive:

[root@pokey /root]# mkbootdisk 2.2.5-22
/sbin/mkbootdisk: [: too many arguments
Insert a disk in /dev/fd0. Any information on the disk will
be lost.
Press <Enter> to continue or ^C to abort:
cp: #/dev/sda1: No such file or directory
cp: #: No such file or directory

------------------------------------
(mounted the created floppy)
Note that it tries to boot, therefore, off the 'commented'
drive, first listed
[root@pokey etc]# pwd
/mnt/floppy/etc
[root@pokey etc]# cat lilo.conf
boot=/dev/fd0
timeout=100
message=/boot/message
prompt
image=/vmlinuz-2.2.5-22
        label=linux
        root=#/dev/sda1
/dev/sda1
#
        initrd=/initrd.img
image=/vmlinuz-2.2.5-22
        label=rescue
        append="load_ramdisk=2 prompt_ramdisk=1"
        root=/dev/fd0
        initrd=/initrd.img


FIX:

Current code is:

rootdev=`awk '/[ \t]\/[ \t]/ { print $1}' /etc/fstab`
[ -z $rootdev ] && {
    echo 'Cannot find root partition in /etc/fstab.' >&2
    exit 1
}

... change the first line to only consider non-commented
lines in /etc/fstab:

grep -v ^# /etc/fstab > /tmp/fstab
rootdev=`awk '/[ \t]\/[ \t]/ { print $1}' /tmp/fstab`
rm /tmp/fstab
Comment 1 Michael K. Johnson 1999-09-25 00:03:59 EDT
Fixed in mkbootdisk-1.2.2-1 by making fstab parsing generally more
robust.

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