Bug 4072 - mkbootdisk does not respect comment indicators in /etc/fstab
Summary: mkbootdisk does not respect comment indicators in /etc/fstab
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mkbootdisk
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Matt Wilson
QA Contact:
URL: http://www.owlriver.com
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-07-16 14:06 UTC by R P Herrold
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-09-25 04:03:13 UTC
Embargoed:


Attachments (Terms of Use)

Description R P Herrold 1999-07-16 14:06:44 UTC
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 04:03:59 UTC
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.