Bug#482345: grub-install fails to read /boot/grub/stage1

Pedro Ribeiro pedrib at gmail.com
Sun Feb 9 10:27:47 UTC 2014


Package: grub-legacy
Version: 0.97-67
Followup-For: Bug #482345

Hi,

this is an old bug, but still present.

I recently upgraded to grub2, but I didn't like and didn't need all the bells
and whistles, so decided to delete grub2 and reinstall grub-legacy.

Reinstalling fails when doing:
The file /boot/grub/stage1 not read correctly.

I tried many ways (you can see in the log below) but eventually found
the solution in linuxforums: http://www.linuxforums.org/forum/ubuntu-
linux/119894-file-boot-grub-stage1-not-read-correctly.html#post615895

Apparently the installer skips a step, running depmod before doing update-grub.

Please see the log below for details.



-- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (750, 'stable'), (650, 'testing'), (600, 'unstable'), (550,
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12.9-try2-grsec-dirty (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub-legacy depends on:
ii  grub-common  1.99-27+deb7u2

grub-legacy recommends no packages.

Versions of packages grub-legacy suggests:
pn  grub-legacy-doc  <none>
pn  mdadm            <none>
pn  multiboot        <none>

-- no debconf information

*** /home/botto/tmp/grub-install.log
grub > sudo aptitude reinstall grub-legacy grub-common
The following packages will be REINSTALLED:
  grub-common grub-legacy
0 packages upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 34 not
upgraded.
Need to get 0 B/2,458 kB of archives. After unpacking 0 B will be used.
(Reading database ... 468880 files and directories currently installed.)
Preparing to replace grub-common 1.99-27+deb7u2 (using .../grub-
common_1.99-27+deb7u2_amd64.deb) ...
Unpacking replacement grub-common ...
Preparing to replace grub-legacy 0.97-67 (using .../grub-
legacy_0.97-67_amd64.deb) ...
Unpacking replacement grub-legacy ...
Processing triggers for man-db ...
Setting up grub-common (1.99-27+deb7u2) ...
Setting up grub-legacy (0.97-67) ...

grub > ls
grub > cd ..
boot > cd grub/
grub > ls
grub > cd ..
boot > ls
config-3.12-0.bpo.1-amd64       grub
initrd.img-3.12.9-try2-grsec-dirty      lost+found
System.map-3.12.9-try2-grsec-dirty  vmlinuz-3.12.9-try2-grsec-dirty
config-3.12.9-try2-grsec-dirty  initrd.img-3.12-0.bpo.1-amd64
initrd.img-3.12.9-try2-grsec-dirty.bak  System.map-3.12-0.bpo.1-amd64
vmlinuz-3.12-0.bpo.1-amd64

grub > sudo grub-install /dev/sda1
Searching for GRUB installation directory ... found: /boot/grub
The file /boot/grub/stage1 not read correctly.
grub > sudo grub-install --recheck /dev/sda1
Searching for GRUB installation directory ... found: /boot/grub


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> root (hd0,0)
 Filesystem type is xfs, partition type 0x83
grub> setup  --stage2=/boot/grub/stage2 --prefix=/boot/grub (hd0,0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/xfs_stage1_5" exists... yes
 Running "embed /boot/grub/xfs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "embed /boot/grub/xfs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "install --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0,0)
/boot/grub/stage2 p /boot/grub/menu.lst "... failed

Error 22: No such partition
grub> quit
grub > ls
default  device.map  e2fs_stage1_5  fat_stage1_5  jfs_stage1_5  menu.lst
minix_stage1_5  reiserfs_stage1_5  stage1  stage2  xfs_stage1_5
grub > pwd
/boot/grub
grub > sudo grub-install --recheck /dev/sda1
Searching for GRUB installation directory ... found: /boot/grub


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> root (hd0,0)
 Filesystem type is xfs, partition type 0x83
grub> setup  --stage2=/boot/grub/stage2 --prefix=/boot/grub (hd0,0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/xfs_stage1_5" exists... yes
 Running "embed /boot/grub/xfs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "embed /boot/grub/xfs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "install --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0,0)
/boot/grub/stage2 p /boot/grub/menu.lst "... failed

Error 22: No such partition
grub> quit
grub > sudo depmod
grub > sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-3.12.9-try2-grsec-dirty
Found kernel: /boot/vmlinuz-3.12-0.bpo.1-amd64



More information about the Pkg-grub-devel mailing list