[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#666974: marked as done (installs to /dev/sda when grub-installer/bootdev = /dev/sdb)



Your message dated Tue, 25 Feb 2014 15:35:56 +0000
with message-id <E1WIK32-0004VN-Du@franck.debian.org>
and subject line Bug#666974: fixed in grub-installer 1.92
has caused the Debian Bug report #666974,
regarding installs to /dev/sda when grub-installer/bootdev = /dev/sdb
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
666974: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666974
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: grub-installer
Version: 1.60+squeeze3
Severity: important

*** Please type your report below this line ***

When I specify in my preseeding file:
  d-i partman-auto/disk                  string  /dev/sdb
  d-i grub-installer/bootdev             string  /dev/sdb

grub-installer ignores me and installs to /dev/sda.
partman-auto does the right thing.

In some cases this can result in an unbootable system.

Attached is a syslog excerpt for the execution of grub-installer,
with DEBCONF_DEBUG=5 set in the boot line. You can see that it
reads in the right disk name from the preseeding file, but somewhere
in the step_os_probe .. step_bootdev .. step_install_loader sequence it
changes $bootdev to /dev/sda.

I have also observed (on other installations, using software RAID-1) that
  d-i grub-installer/bootdev             string  /dev/sda /dev/sdb
is read in but also ultimately ignored and grub-installer only installs to
/dev/sda.



This installation was on a machine with two hard disks of identical size,
but only one was intended to be used in the installation.
The partioning was one ext3 partition for /, and one LVM for everything else.
No separate /boot partition. No software raid is specified.

I was able to stop the installer at the end and ran grub-installer again
on one of the installer consoles:

  sh -vx /usr/bin/grub-installer /target 1>/target/var/log/gi 2>&1

This shows the problem comes when parsing the grub-mkdevicemap output.

+ os-prober
+ db_settitle debian-installer/grub-installer/title
+ _db_cmd SETTITLE debian-installer/grub-installer/title
+ IFS=  printf %s\n SETTITLE debian-installer/grub-installer/title
+ IFS=
 read -r _db_internal_line
+ RET=OK
+ return 0
+ tmpfile=/tmp/menu.lst.extras
+ [ -s /tmp/os-probed ]
+ q=grub-installer/only_debian
+ state=1
+ [  ]
+ chroot /target grub-mkdevicemap --no-floppy -m+  -head -n1
+ cut -f2
+ default_bootdev_os=/dev/disk/by-id/scsi-35000c50017a6040b
+ [ /dev/disk/by-id/scsi-35000c50017a6040b ]
+ chroot /target readlink -f /dev/disk/by-id/scsi-35000c50017a6040b
+ default_bootdev=/dev/sda

when I run that grub-mkdevicemap on the host after installation, I get:

# grub-mkdevicemap --no-floppy -m -
(hd0)   /dev/disk/by-id/scsi-35000c50017a6040b
(hd1)   /dev/disk/by-id/scsi-35000c50017a7843b

so it seems that there is a disconnect here from the specification
of $bootdev and the attempt to guess $default_bootdev_os.

The consequences are as follows.

A little further down the script there is this, er, dense if statement:

case $ARCH:$grub_package in
    *:grub|*:grub-pc|sparc:grub-ieee1275)
	if [ "$(device_to_disk "$cdsrc")" = "$default_bootdev" ] || \
	   ([ -n "$hdsrc" ] && [ "$(device_to_disk "$hdsrc")" = "$default_bootdev" ]) || \
	   ([ "$default_bootdev" = '(hd0)' ] && \
	    (([ -n "$cdfs" ] && [ "$cdfs" != "iso9660" ]) || \
	     [ "$hybrid" = true ])) || \
	   ([ "$default_bootdev" != '(hd0)' ] && \
	    ! partmap "$default_bootdev" >/dev/null && \
	    ! grub_probe -t fs -d "$default_bootdev" >/dev/null); then
		db_fget grub-installer/bootdev seen
		if [ "$RET" != true ]; then
			bootfs=$(findfs /boot)
			[ "$bootfs" ] || bootfs="$(findfs /)"
			disk=$(device_to_disk "$bootfs")
			db_set grub-installer/bootdev "$disk"
			state=2
		fi
	fi
	;;
...

This fails out at the "$default_bootdev" = '(hd0)' comparison.
+ device_to_disk
+ echo
+ sed s:\(/dev/\(cciss\|ida\|rs\)/c[0-9]d[0-9][0-9]*\|/dev/mmcblk[0-9]\|/dev/\(ad\|da\)[0-9]\+\|/dev/[a-z]\+\).*:\1:
+ [  = /dev/sda ]
+ [ -n  ]
+ [ /dev/sda = (hd0) ]

Then we come to step_bootdev, a loop that continues until we have a suitable
value of $state. There $default_bootdev supercedes what I set $bootdev to.
$state is already set to 1 and $q to grub-installer/only_debian (see above).

db_progress STEP 1
db_progress INFO grub-installer/progress/step_bootdev

while : ; do
	if [ "$state" = 1 ]; then
		db_input high $q || true
		if ! db_go; then
			# back up to menu
			db_progress STOP
			exit 10
		fi
		db_get $q
		if [ "$RET" = true ]; then
			bootdev="$default_bootdev"
			break
		else
			# Exit to menu if /boot is on SATA RAID/multipath; we
			# don't support device selection in that case
			if [ "$frdev" ]; then
				db_progress STOP
				exit 10
			fi
			state=2
		fi
...

+ db_progress STEP 1
+ _db_cmd PROGRESS STEP 1
+ IFS=  printf %s\n PROGRESS STEP 1
+ IFS=
 read -r _db_internal_line
	   RET=OK
+ return 0
+ db_progress INFO grub-installer/progress/step_bootdev
+ _db_cmd PROGRESS INFO grub-installer/progress/step_bootdev
+ IFS=  printf %s\n PROGRESS INFO grub-installer/progress/step_bootdev
+ IFS=
 read -r _db_internal_line
	Determining GRUB boot device...       RET=OK
+ return 0
+ :
+ [ 1 = 1 ]
+ db_input high grub-installer/only_debian
+ _db_cmd INPUT high grub-installer/only_debian
+ IFS=  printf %s\n INPUT high grub-installer/only_debian
+ IFS=
 read -r _db_internal_line
+ RET=30 question skipped
+ return 30
+ true
+ db_go
+ _db_cmd GO
+ IFS=
 read -r _db_internal_line
+ RET=ok
+ return 0
+ db_get grub-installer/only_debian
+ _db_cmd GET grub-installer/only_debian
+ IFS=  printf %s\n GET grub-installer/only_debian
+ IFS=
 read -r _db_internal_line
+ RET=true
+ return 0
+ [ true = true ]
+ bootdev=/dev/sda
+ break
+ db_progress STEP 1
+ _db_cmd PROGRESS STEP 1
+ IFS=  printf %s\n PROGRESS STEP 1
+ IFS=
 read -r _db_internal_line
	5	 RET=OK
+ return 0
+ db_subst grub-installer/progress/step_install_loader BOOTDEV /dev/sda
+ _db_cmd SUBST grub-installer/progress/step_install_loader BOOTDEV /dev/sda
+ IFS=  printf %s\n SUBST grub-installer/progress/step_install_loader BOOTDEV /dev/sda
+ IFS=
 read -r _db_internal_line
+ RET=0
+ return 0
+ db_progress INFO grub-installer/progress/step_install_loader
+ _db_cmd PROGRESS INFO grub-installer/progress/step_install_loader
+ IFS=  printf %s\n PROGRESS INFO grub-installer/progress/step_install_loader
+ IFS=
 read -r _db_internal_line
	Running "grub-install /dev/sda"...	 RET=OK
+ return 0
+ info Installing grub on '/dev/sda'
+ log info: Installing grub on '/dev/sda'
+ logger -t grub-installer info: Installing grub on '/dev/sda'


preseeding details:

d-i partman-auto/method                string  lvm
d-i partman-auto/disk                  string  /dev/sdb
d-i grub-installer/bootdev             string  /dev/sdb

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/grub2_instead_of_grub_legacy boolean true

d-i partman-auto-lvm/no_boot           boolean true

d-i partman-md/device_remove_md        boolean true
d-i partman-md/confirm boolean true

d-i partman-lvm/device_remove_lvm      boolean true
d-i partman-lvm/confirm                boolean true

d-i partman/choose_partition           select  finish
d-i partman/confirm                    boolean true

d-i partman/mount_style select uuid

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true

d-i partman-auto/expert_recipe         string  my_server : \
    2048 2000 2048 ext3        \
        $primary{ }            \
        $bootable{ }           \
        method{ format }       \
        format{ }              \
        use_filesystem{ }      \
        filesystem{ ext3 }     \
        label{ root }          \
        mountpoint{ / }        \
    .                          \
    100% 2000 200% linux-swap  \
        $defaultignore{ }      \
        $lvmok{ }              \
        method{ swap }         \
        format{ }              \
    .                          \
    10240 1000 10240 ext3      \
        $defaultignore{ }      \
        $lvmok{ }              \
        method{ format }       \
        format{ }              \
        use_filesystem{ }      \
        filesystem{ ext3 }     \
        mountpoint{ /usr }     \
    .                          \
.. etc...

It happens that /dev/sda has a software raid signature, but from the
discussion above I think it is not causing the bug.

# fdisk -l /dev/sda

Disk /dev/sda: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002eb77

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         125      999424   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             125       36473   291968000   fd  Linux raid autodetect

After installation this is the state of /dev/sdb
# fdisk -l /dev/sdb

Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000de478

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         249     1998848   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2             250       36473   290967553    5  Extended
/dev/sdb5             250       36473   290967552   8e  Linux LVM


I would really like to see this fixed in the stable release, how can I help?


-- System Information:
Debian Release: 6.0.4
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Attachment: syslog.grub-installer.gz
Description: Binary data


--- End Message ---
--- Begin Message ---
Source: grub-installer
Source-Version: 1.92

We believe that the bug you reported is fixed in the latest version of
grub-installer, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 666974@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Dimitri John Ledkov <xnox@ubuntu.com> (supplier of updated grub-installer package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Tue, 25 Feb 2014 14:08:07 +0000
Source: grub-installer
Binary: grub-installer
Architecture: amd64 source
Version: 1.92
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Dimitri John Ledkov <xnox@ubuntu.com>
Closes: 666974
Launchpad-Bugs-Fixed: 1012629
Description: 
 grub-installer - Install GRUB on a hard disk (udeb)
Changes: 
 grub-installer (1.92) unstable; urgency=medium
 .
   * Adapt patch from Guilhem Moulin to always honor
     grub-installer/bootdev, when it was preseeded, instead of insisting on
     automatic detection which may lead to unpredictable results (e.g. use
     a different device, or fail unattended installation). Closes:
     #666974. LP: #1012629.
Checksums-Sha1: 
 431654046d9df9fe75c0dfea69b8e13bbcdf3896 1885 grub-installer_1.92.dsc
 b5488e898eaf5c024bdd977d9523156cdc9913d0 227488 grub-installer_1.92.tar.gz
 bcbe1c600b57d690d09c91142459f00989b311be 260778 grub-installer_1.92_amd64.udeb
Checksums-Sha256: 
 075ba13eb65c77229ddadede5fe0ac1d4f89efab9595d05e2cc3b9eb53b47b80 1885 grub-installer_1.92.dsc
 7ac83911fb1fc045cf6ce3af71daa918271d930165c6819bcccece21e94fb6f3 227488 grub-installer_1.92.tar.gz
 afa776f34cc6ecdea38e719174dc78924b3ff418128c3281d49626afd3fd8371 260778 grub-installer_1.92_amd64.udeb
Files: 
 c31d2a4f6373a0006d902c9f3365106b 1885 debian-installer standard grub-installer_1.92.dsc
 3d3ef121e5c50edcd7ddb116895af686 227488 debian-installer standard grub-installer_1.92.tar.gz
 18b97c86e4f621cafef51571069ee8df 260778 debian-installer standard grub-installer_1.92_amd64.udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTDKWtAAoJEIh7YGGLPBau0csP/1e3uzNod1N6+6aC2qpzaXzJ
wJfNwVcYlZP4e/wUw2e97S0M48E/sBNIh4ZPUyHvwGsK4NV7jGtGg9dPA79BIbWs
ONFU0UuMDpm+rJF9uAJUd0vxHFS9+y5ZJtfKlMlOChlJJ3HSFgYkCJw6vK5sBNsc
AZZJDuiO6AZP7/BrmPXbepdAtQOfuwYBITkWfhDckuXRYeiMgQXzd21pibjgmltM
VHh91GVrl6p2cFswaQR4luqrUWp1+RdN4Km3awIK/IMbqWll3IBFNnxbaOeeaiXF
XpMU+k9+xkahs9H5cMxVaJmtCbiXhNzQHCCiUFNq+Pcw3UEor8rLNrb5h9Mln4xa
hqSlolcxrZtutckvDn7/DnUGk8I7kViqbWLRhIY0hVrlW2a93TB0onX1BUraClSA
MbsAHSLzD3kyuPnERcBED1bUcm0gpe4VVpZiEeWoUWec1svKApUznN2/rjHXNj4s
vdRmQLF6a7ETQdpRq2algC2VcWQ08AtL7jUvX7YFQ/XJ8R3BdjZrRt6yW9dEfV31
u72zLrEKJ+oaFtLDlu96xlumdXyYHKpzj8hCEonroSv+19rSw/LgNzData2sVb7e
8briF/PNhm05jU2WD/XZmC2Y9F7EYFZSvzw2wgL3gdanD/IDuPRGLxOknP1S/EmF
IX6IbsFoL76cYd3AMMgM
=BPVN
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: