[Bug 432128] [NEW] GRUB 2 grub-install writes inside first partition
Malcolm Scott
launchpad at malc.org.uk
Thu Sep 17 21:07:13 UTC 2009
Public bug reported:
Binary package hint: grub-pc
When I install GRUB 2 (1.97~beta3-1ubuntu4, in karmic) to the MBR (grub-
install /dev/sda), sectors 78 and 79 are modified. The first partition
starts on sector 63; this partition is a NTFS Windows installation so
should not be modified by this process.
The data written to sectors 78 and 79 appears to be a key part of GRUB
-- if I restore the contents of these sectors to their state before
running grub-install, GRUB gets as far as "GRUB Loading" then freezes.
Luckily for me, this happened not to cause data loss on the NTFS
partition -- however booting Windows from this partition causes the
sectors to be modified and thus prevents GRUB from loading on the next
reboot. I suspect this is pure luck though: installing part of GRUB
inside an unrelated partition is not a good thing to be doing, and could
cause data loss depending on what's in that partition.
To produce the diff below, I installed GRUB, booted Windows (thus
resetting sectors 78 and 79), then took a hexdump of the first 64KB of
the disk as "grub.1". I then reinstalled GRUB with the same settings
and took another hexdump as "grub.2". I.e. "grub.1" doesn't boot, and
"grub.2" does.
20:48:07 !120 ubuntu at ubuntu:~$ sudo fdisk -ul /dev/sda
Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125045424 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x855b855b
Device Boot Start End Blocks Id System
/dev/sda1 63 94735304 47367621 7 HPFS/NTFS
/dev/sda2 94735305 120053744 12659220 5 Extended
/dev/sda3 120053745 124664399 2305327+ 82 Linux swap / Solaris
/dev/sda4 * 124664400 125033894 184747+ 83 Linux
/dev/sda5 94735368 120053744 12659188+ 83 Linux
20:48:09 !121 ubuntu at ubuntu:~$ diff -u grub.1 grub.2
--- grub.1 2009-09-17 20:30:49.000000000 +0000
+++ grub.2 2009-09-17 20:35:43.000000000 +0000
@@ -1173,14 +1173,38 @@
000049d0 fa 7e 10 f7 0a 07 6d b2 37 8d 10 3a ed 47 54 a5 |.~....m.7..:.GT.|
000049e0 b7 64 1d b2 af 83 8f 4e 72 52 e4 ba 15 5a bb 2a |.d.....NrR...Z.*|
000049f0 22 47 d0 7f 03 ff aa ca 68 e5 6d f7 3a 77 51 5b |"G......h.m.:wQ[|
-00004a00 4e 35 69 33 63 88 f2 fc ae 3d 86 fd b1 55 3e e0 |N5i3c....=...U>.|
-00004a10 ae 3d 86 fd b1 55 3e e0 11 e2 0e 6c 35 88 01 75 |.=...U>....l5..u|
-00004a20 f0 34 21 93 1d 10 b2 68 67 97 da 00 72 0c 36 57 |.4!....hg...r.6W|
-00004a30 8f 05 85 3a df 36 3a d8 24 6a c4 45 4a be a9 eb |...:.6:.$j.EJ...|
-00004a40 31 09 49 fd ad 00 b8 a1 6e 29 75 59 45 24 fd 87 |1.I.....n)uYE$..|
-00004a50 3f 38 f0 b5 ee 85 2c 52 9c e2 5f 37 06 ff ca 2b |?8....,R.._7...+|
-00004a60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-*
+00004a00 36 16 d9 99 15 a0 58 0b ee f7 87 21 b2 6a ae 9d |6.....X....!.j..|
+00004a10 04 07 7e b2 4b c8 21 4b 92 f0 e7 fc e4 30 b5 f9 |..~.K.!K.....0..|
+00004a20 d6 7e a1 94 c5 94 0f 85 fc f0 7e 16 54 e8 f4 d7 |.~........~.T...|
+00004a30 a3 10 da 43 f4 ea 57 ac bc 3d d7 94 ca e9 b4 0e |...C..W..=......|
+00004a40 c8 af 0c 1d 30 48 c6 59 75 93 03 a8 27 5d ca 19 |....0H.Yu...']..|
+00004a50 4e 3b 17 a9 8d 70 b9 d1 c8 4a d4 10 2b d4 e1 cf |N;...p...J..+...|
+00004a60 fe 4d c9 32 24 8c d5 be 09 6d bd fa 10 1c 85 47 |.M.2$....m.....G|
+00004a70 2f a2 bf 26 6e 2c 36 5e 9c bd b4 cb 2b 22 c6 5d |/..&n,6^....+".]|
+00004a80 dd 03 87 4a 83 7e 78 91 48 48 95 87 58 3c ba e9 |...J.~x.HH..X<..|
+00004a90 f3 f6 99 df 90 20 12 41 3d f6 a7 ce 3f b9 12 5f |..... .A=...?.._|
+00004aa0 3a e5 67 26 c4 ff 66 a8 81 33 b7 34 a1 fd 9f f9 |:.g&..f..3.4....|
+00004ab0 56 36 bf 5b 91 47 0e a5 bf 7e 90 db 1f 71 44 2c |V6.[.G...~...qD,|
+00004ac0 eb 2e e6 b1 5c c5 22 25 f3 0e 73 bf df 6e ab f1 |....\."%..s..n..|
+00004ad0 d1 17 e3 d2 0a f0 fe ca c3 7c 71 26 7e b0 28 3c |.........|q&~.(<|
+00004ae0 90 56 00 0a f0 68 68 95 10 77 2f 27 80 18 01 42 |.V...hh..w/'...B|
+00004af0 dd db 28 33 27 73 be 55 dc f2 85 07 43 5c 48 eb |..(3's.U....C\H.|
+00004b00 c4 f8 3e a5 14 dc bb 21 00 4d df e8 1a e3 ed 53 |..>....!.M.....S|
+00004b10 10 1a 36 fd 83 3b aa 81 13 ae 88 88 dd e4 8e 8d |..6..;..........|
+00004b20 00 bb 7b 96 a4 59 82 46 b3 b4 61 87 cc 05 09 95 |..{..Y.F..a.....|
+00004b30 5d dd 93 a5 a7 21 12 00 a2 6a fb e7 09 b0 32 2a |]....!...j....2*|
+00004b40 c3 72 4e bc 63 2a 43 2a 9f 7d f9 30 4e a2 50 cd |.rN.c*C*.}.0N.P.|
+00004b50 21 75 d8 2e c7 0c ca df c0 4f 70 3a 40 8d b3 45 |!u.......Op:@..E|
+00004b60 cf 8b 33 2a d4 ad 56 29 80 b9 cb 3c 01 30 75 f7 |..3*..V)...<.0u.|
+00004b70 67 9c 51 93 e4 b9 76 d1 2e 74 93 79 69 dc 7d 95 |g.Q...v..t.yi.}.|
+00004b80 aa bd 5a ab 94 15 1d 04 c6 74 6d 2f bb 13 1d 0d |..Z......tm/....|
+00004b90 0e 01 ad da 00 ff 36 00 37 94 0e a8 3f 62 d0 a8 |......6.7...?b..|
+00004ba0 5c bc 06 a1 75 34 6d 0b 03 bb 30 d1 2f e9 f4 be |\...u4m...0./...|
+00004bb0 a8 02 b3 2e 2e ff ba 08 18 ca 79 cb 7d af 1f 65 |..........y.}..e|
+00004bc0 61 bc a1 d4 07 4e 21 7e 9d fb b4 82 68 8d 34 43 |a....N!~....h.4C|
+00004bd0 5a 13 e6 a1 aa 5c 54 f0 05 f0 ad 16 31 2c b7 1c |Z....\T.....1,..|
+00004be0 68 e8 6e 27 f4 f6 33 dc a5 91 45 80 00 36 f5 59 |h.n'..3...E..6.Y|
+00004bf0 30 02 e4 6e 37 59 64 12 0c 7c c6 c5 a8 11 ef 53 |0..n7Yd..|.....S|
00004c00 06 cb c2 6a f6 7a 94 8a ed e9 bb 70 58 f0 2f 92 |...j.z.....pX./.|
00004c10 77 c8 e5 09 7a 09 c5 46 b0 ac e2 3b 1e 38 68 a3 |w...z..F...;.8h.|
00004c20 7d 19 8e 1e 0e 56 42 21 7b 05 15 58 b8 f7 34 6e |}....VB!{..X..4n|
** Affects: grub2 (Ubuntu)
Importance: Undecided
Status: New
--
GRUB 2 grub-install writes inside first partition
https://bugs.launchpad.net/bugs/432128
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list