probably no grub-install in FAI installation

2010-12-09 Diskussionsfäden Henning Fehrmann
Hello,

we are currently testing a FAI-Squeeze installation and struggled with the 
grub2 installation. We are using the FAI-server v 3.4.5 and install the current 
Squeeze grub-ps package v 1.98+20100804-8.
After the installation the system does not boot from the hard drive. It turned
out that '/usr/sbin/grub-install' never has being called in the postinst script 
of the grub-pc package. 
A quick and dirty work around is a '$ROOTCMD grub-install' in a script or a hook
which is probably not meant to be the preferred way.

We added 'set -x' into the postinst script of the grub-pc package to increase 
the verbosity. 
The 'db_get grub-pc/install_devices' in line 494 does not set the RET variable
which avoids the next 'for' loop. So a grub-install is not being called. 

We are not sure, but probably an interactive debconf configuration is required 
at this point. 

Has anybody seen a similar symptom? Is there a clean way to solve this problem?


Thank you and cheers,
Henning



Here is the postinst output:


+ cached_available_ids=
+ case $1 in
+ . /usr/share/debconf/confmodule
++ '[' '!' '' ']'
++ PERL_DL_NONLAZY=1
++ export PERL_DL_NONLAZY
++ '[' '' ']'
++ exec /usr/share/debconf/frontend /var/lib/dpkg/info/grub-pc.postinst 
configure 1.98+20101209-1
+ cached_available_ids=
+ case $1 in
+ . /usr/share/debconf/confmodule
++ '[' '!' 1 ']'
++ '[' -z '' ']'
++ exec
++ '[' '' ']'
++ exec
++ DEBCONF_REDIR=1
++ export DEBCONF_REDIR
+ devicemap_regenerated=
+ egrep -q 
'^[[:space:]]*post(inst|rm)_hook[[:space:]]*=[[:space:]]*(/sbin/|/usr/sbin/)?update-grub'
 /etc/kernel-img.conf
+ case grub-pc in
+ mkdir -p /boot/grub
+ test -e /boot/grub/device.map
+ test -e /boot/grub/core.img
+ grub-mkdevicemap --no-floppy
+ devicemap_regenerated=1
+ test -z 1
++ mktemp -t grub.XX
+ tmp_default_grub=/tmp/grub.oj4eLAeOGT
+ trap 'rm -f /tmp/grub.oj4eLAeOGT' EXIT
+ cp -p /usr/share/grub/default/grub /tmp/grub.oj4eLAeOGT
+ merge_debconf_into_conf /tmp/grub.oj4eLAeOGT GRUB_CMDLINE_LINUX 
grub2/linux_cmdline
+ local tmpfile
+ tmpfile=/tmp/grub.oj4eLAeOGT
+ local setting
+ setting=GRUB_CMDLINE_LINUX
+ local template
+ template=grub2/linux_cmdline
+ db_get grub2/linux_cmdline
+ _db_cmd 'GET grub2/linux_cmdline'
+ IFS=' '
+ printf '%s\n' 'GET grub2/linux_cmdline'
+ IFS='
'
+ read -r _db_internal_line
+ RET=
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ local value
++ sed -e 's,[$`\...@],\\,g'
++ echo ''
+ value=
+ grep -q '^GRUB_CMDLINE_LINUX=' /tmp/grub.oj4eLAeOGT
+ sed -i -re 's...@^(GRUB_CMDLINE_LINUX=)@\1@' /tmp/grub.oj4eLAeOGT
+ merge_debconf_into_conf /tmp/grub.oj4eLAeOGT GRUB_CMDLINE_LINUX_DEFAULT 
grub2/linux_cmdline_default
+ local tmpfile
+ tmpfile=/tmp/grub.oj4eLAeOGT
+ local setting
+ setting=GRUB_CMDLINE_LINUX_DEFAULT
+ local template
+ template=grub2/linux_cmdline_default
+ db_get grub2/linux_cmdline_default
+ _db_cmd 'GET grub2/linux_cmdline_default'
+ IFS=' '
+ printf '%s\n' 'GET grub2/linux_cmdline_default'
+ IFS='
'
+ read -r _db_internal_line
+ RET=
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ local value
++ sed -e 's,[$`\...@],\\,g'
++ echo ''
+ value=
+ grep -q '^GRUB_CMDLINE_LINUX_DEFAULT=' /tmp/grub.oj4eLAeOGT
+ sed -i -re 's...@^(GRUB_CMDLINE_LINUX_DEFAULT=)@\1@' 
/tmp/grub.oj4eLAeOGT
+ ucf --three-way --debconf-ok --sum-file=/usr/share/grub/default/grub.md5sum 
/tmp/grub.oj4eLAeOGT /etc/default/grub
++ cut -d : -f 2
++ ucfq --with-colons /etc/default/grub
+ package=grub-pc
+ grep -q '^grub-'
+ echo grub-pc
+ ucfr --force grub-pc /etc/default/grub
+ case grub-pc in
+ fix_mixed_system=
+ test -e /boot/grub/stage2
+ test -e /boot/grub/stage2
+ question=grub-pc/install_devices
++ grep -v '^(fd[0-9]\+)'
++ grub-mkdevicemap -m -
+ device_map='(hd0) /dev/disk/by-id/ata-QEMU_HARDDISK_QM1'
++ cut -f2
++ echo '(hd0)  /dev/disk/by-id/ata-QEMU_HARDDISK_QM1'
+ devices=/dev/disk/by-id/ata-QEMU_HARDDISK_QM1
+ dpkg --compare-versions 1.98+20101209-1 lt 1.98+20100702-1
+ db_get grub-pc/install_devices
+ _db_cmd 'GET grub-pc/install_devices'
+ IFS=' '
+ printf '%s\n' 'GET grub-pc/install_devices'
+ IFS='
'
+ read -r _db_internal_line
+ RET=
+ case ${_db_internal_line%%[   ]*} in
+ return 0
+ valid=1
+ '[' 1 = 0 ']'
+ :
+ ids=
+ descriptions=
++ usable_partitions
++ local last_partition path partition partition_id
++ last_partition=
++ sort -t: -k2
++ for path in / /boot /boot/grub
+++ grub-probe -t device /
++ partition=/dev/sda2
++ '[' -z /dev/sda2 ']'
++ '[' /dev/sda2 = '' ']'
+++ device_to_id /dev/sda2
+++ local id
 available_ids
 local id path
 '[' '' ']'
 '[' -d /dev/disk/by-id ']'
+ cut '-d ' -f1
+ sort -k2 -s -u
+ for path in '/dev/disk/by-id/*'
+ '[' -e /dev/disk/by-id/ata-QEMU_HARDDISK_QM1 ']'
++ readlink -f /dev/disk/by-id/ata-QEMU_HARDDISK_QM1
+ printf '%s %s\n' /dev/disk/by-id/ata-QEMU_HARDDISK_QM1 /dev/sda
+ for path in '/dev/disk/by-id/*'
+ '[' -e /dev/disk/by-id/ata-QEMU_HARDDISK_QM1-part1 ']'
++ readlink 

Re: probably no grub-install in FAI installation

2010-12-09 Diskussionsfäden Nicolas Courtel

Hello,

we are currently testing a FAI-Squeeze installation and struggled with the
grub2 installation. We are using the FAI-server v 3.4.5 and install the current
Squeeze grub-ps package v 1.98+20100804-8.
After the installation the system does not boot from the hard drive. It turned
out that '/usr/sbin/grub-install' never has being called in the postinst script
of the grub-pc package.
A quick and dirty work around is a '$ROOTCMD grub-install' in a script or a hook
which is probably not meant to be the preferred way.

We added 'set -x' into the postinst script of the grub-pc package to increase 
the verbosity.
The 'db_get grub-pc/install_devices' in line 494 does not set the RET variable
which avoids the next 'for' loop. So a grub-install is not being called.

We are not sure, but probably an interactive debconf configuration is required 
at this point.

Has anybody seen a similar symptom? Is there a clean way to solve this problem?


Thank you and cheers,
Henning

   


You might be able to do it with debconf, but the easy way is to call 
grub-install in an FAI script, like it's done in fai-doc's examples 
(/usr/share/doc/fai-doc/examples/simple/scripts/GRUB_PC) :


[...]
$ROOTCMD grub-mkdevicemap -n -m /boot/grub/device.map
$ROOTCMD grub-mkconfig -o /boot/grub/grub.cfg
$ROOTCMD grub-install --no-floppy (hd0)
[...]

--
Nicolas


Re: probably no grub-install in FAI installation

2010-12-09 Diskussionsfäden Thomas Lange
 On Thu, 9 Dec 2010 10:47:45 +0100, Henning Fehrmann 
 henning.fehrm...@aei.mpg.de said:

 we are currently testing a FAI-Squeeze installation and struggled with 
the 
 grub2 installation. We are using the FAI-server v 3.4.5 and install the 
current 
 Squeeze grub-ps package v 1.98+20100804-8.
 After the installation the system does not boot from the hard drive. It 
turned
 out that '/usr/sbin/grub-install' never has being called in the postinst 
script 
 of the grub-pc package. 
The postinst does not need to call grub-install. If your client
belongs to the class GRUB_PC, the script GRUB_PC/10-setup will be
called and this script calls grub-install. I just tested it here
again, and it works like a charm. 
-- 
regards Thomas