Comment 0 for bug 898012

Revision history for this message
Brian Milliron (b-milliron) wrote :

Background: Looking at raw data for my MBR I saw grub had not overwritten old data from previous installation that was wiped on suspicion of rootkit infection. I zeroed MBR manually and grub could not install. Restoring old MBR allows grub install to complete without error. However, since grub-install does not fully overwrite existing data, a user who wants confidence the entire MBR is clean must zero it out. This behavior could make cleaning bootkits impossible.

Troubleshooting steps already taken:
sudo grub-mkdevicemap
sudo grub-mkconfig
sudo update-grub2
sudo grub-setup -r /dev/mapper/group0-root /dev/sda
switching (hd0) and (hd1) in device.map has no effect

Steps to reproduce:

Step 1 sudo dd if=/dev/zero of=/dev/sda bs=512 count=63
Step 2 sudo grub-install /dev/sda (error below)
Step 3 sudo dd if=~/backup.mbr of=/dev/sda bs=512 count=63
Step 4 sudo grub-install /dev/sda (no error)

Error messages:
sudo grub-probe --device-map="/boot/grub/device.map" --target=fs -v /boot/grub
grub-probe: info: Scanning for dmraid_nv RAID devices on disk hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: scanning hd0 for LVM.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: no LVM signature found.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: Scanning for mdraid09 RAID devices on disk hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: Scanning for mdraid1x RAID devices on disk hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: Scanning for mdraid09 RAID devices on disk hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: Scanning for mdraid1x RAID devices on disk hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: scanning hd0 for LVM.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: no LVM signature found.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: info: /dev/sda3 starts from 62926848.
grub-probe: info: opening the device hd0.
grub-probe: info: the size of hd0 is 117210240.
grub-probe: error: cannot find a GRUB drive for /dev/sda3. Check your device.map.

device.map
(hd0) /dev/disk/by-id/mmc-00000_XXXXXXXXXX
(hd1) /dev/disk/by-id/ata-TOSHIBA_XXXXXXXXXXXX_XXXXXXXXXX

Fdisk output:
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders, total 117210240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: XXXXXXXXXXXXX

   Device Boot Start End Blocks Id System
/dev/sda1 2048 52434943 26216448 83 Linux
/dev/sda2 52434944 62926847 5245952 83 Linux
/dev/sda3 * 62926848 63318015 195584 83 Linux
/dev/sda4 63318016 117209087 26945536 83 Linux

Disk /dev/mapper/sda4_crypt: 27.6 GB, 27591176192 bytes
255 heads, 63 sectors/track, 3354 cylinders, total 53889016 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/sda4_crypt doesn't contain a valid partition table

Disk /dev/mapper/group0-root: 9588 MB, 9588178944 bytes
255 heads, 63 sectors/track, 1165 cylinders, total 18726912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/group0-root doesn't contain a valid partition table

Disk /dev/mapper/group0-var: 9588 MB, 9588178944 bytes
255 heads, 63 sectors/track, 1165 cylinders, total 18726912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/group0-var doesn't contain a valid partition table

Disk /dev/mapper/group0-home: 5398 MB, 5398069248 bytes
255 heads, 63 sectors/track, 656 cylinders, total 10543104 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/group0-home doesn't contain a valid partition table

Disk /dev/mapper/group0-tmp: 645 MB, 645922816 bytes
255 heads, 63 sectors/track, 78 cylinders, total 1261568 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/group0-tmp doesn't contain a valid partition table

Disk /dev/mapper/group0-swap: 956 MB, 956301312 bytes
255 heads, 63 sectors/track, 116 cylinders, total 1867776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/group0-swap doesn't contain a valid partition table

Disk /dev/mmcblk0: 32.3 GB, 32295092224 bytes
64 heads, 32 sectors/track, 30799 cylinders, total 63076352 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: XXXXXXXXXXXX

        Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 32 411647 205808 83 Linux
/dev/mmcblk0p2 411678 63076351 31332337 5 Extended
/dev/mmcblk0p5 411680 63076351 31332336 83 Linux

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: grub-common 1.99-12ubuntu5
ProcVersionSignature: Ubuntu 3.0.0-13.22-generic 3.0.6
Uname: Linux 3.0.0-13-generic i686
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Tue Nov 29 22:31:25 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111011)
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: grub2
UpgradeStatus: No upgrade log present (probably fresh install)