某些windows软件破坏Grub2的信息导致无法启动

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
tempestglen
帖子: 137
注册时间: 2009-07-16 23:09

某些windows软件破坏Grub2的信息导致无法启动

#1

帖子 tempestglen » 2010-12-23 11:35

ubuntu的工程师Colin Watson在blog中写道
http://www.chiark.greenend.org.uk/ucgi/ ... table.html
Sat, 28 Aug 2010

Windows applications making GRUB 2 unbootable

If you find that running Windows makes a GRUB 2-based system unbootable (Debian bug, Ubuntu bug), then I'd like to hear from you. This is a bug in which some proprietary Windows-based software overwrites particular sectors in the gap between the master boot record and the first partition, sometimes called the "embedding area". GRUB Legacy and GRUB 2 both normally use this part of the disk to store one of their key components: GRUB Legacy calls this component Stage 1.5, while GRUB 2 calls it the core image (comparison). However, Stage 1.5 is less useful than the core image (for example, the latter provides a rescue shell which can be used to recover from some problems), and is therefore rather smaller: somewhere around 10KB vs. 24KB for the common case of ext[234] on plain block devices. It seems that the Windows-based software writes to a sector which is after the end of Stage 1.5, but before the end of the core image. This is why the problem appears to be new with GRUB 2.

At least some occurrences of this are with software which writes a signature to the embedding area which hangs around even after uninstallation (even with one of those tools that tracks everything the installation process did and reverses it, I gather), so that you cannot uninstall and reinstall the application to defeat a trial period. This seems like a fine example of an antifeature, especially given its destructive consequences for free software, and is in general a poor piece of engineering; what happens if multiple such programs want to use the same sector, I wonder? They clearly aren't doing much checking that the sector is unused, not that that's really possible anyway. While I do not normally think that GRUB should go to any great lengths to accommodate proprietary software, this is a case where we need to defend ourselves against the predatory practices of some companies making us look bad: a relatively small number of people do enough detective work to realise that it's the fault of a particular Windows application, but many more simply blame our operating system because it won't start any more.

I believe that it may be possible to assemble a collection of signatures of such software, and arrange to avoid the disk sectors they have stolen. Indeed, I have a first draft of the necessary code. This is not a particularly pleasant solution, but it seems to be the most practical way around the problem; I'm hoping that several of the programs at fault are using common "licence manager" code or something like that, so that we can address most of the problems with a relatively small number of signatures. In order to do this, I need to hear from as many people as possible who are affected by this problem.

If you suffer from this problem, then please do the following:

* Save the output of fdisk -lu to a file. In this output, take note of the start sector of the first partition (usually 63, but might also be 2048 on recent installations, or occasionally something else). If this is something other than 63, then replace 63 in the following items with your number.
* Save the contents of the embedding area to a file (replace /dev/sda with your disk device if it's something else): dd if=/dev/sda of=sda.1 count=63
* Do whatever you do to make GRUB unbootable (presumably starting Windows), then boot into a recovery environment. Before you reinstall GRUB, save the new contents of the embedding area to a different file: dd if=/dev/sda of=sda.2 count=63
* Follow up to either the Debian or the Ubuntu bug with these three files (the output of fdisk -lu, and the embedding area before and after making GRUB unbootable.

I hope that this will help me to assemble enough information to fix this bug at least for most people, and of course if you provide this information then I can make sure to fix your particular version of this problem. Thanks in advance!


难怪我安装windowxp和ubuntu 9.10以后的版本的双系统,反复进入ubuntu没有任何问题,而一旦进入windows之后,再重启,就发现grub2坏了 ,机器根本无法进入grub2菜单,在反复重启。当时狂骂grub2,使用grubfordos解决了问题。
上次由 tempestglen 在 2010-12-23 12:11,总共编辑 1 次。
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

Re: 他妈个把子,某些windows软件破坏Grub2的信息导致无法启动

#2

帖子 leeaman » 2010-12-23 11:42

呵呵,没说是那些软件哦,一般我是以为bios写保护呢
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
tempestglen
帖子: 137
注册时间: 2009-07-16 23:09

Re: 他妈个把子,某些windows软件破坏Grub2的信息导致无法启动

#3

帖子 tempestglen » 2010-12-23 11:47

leeaman 写了:呵呵,没说是那些软件哦,一般我是以为bios写保护呢

网上一些 资料说是如下软件:

HP Protect Tools
PC angels
Adobe flexnet


在我的机器上,就是他妈的Adobe flexnet,占据了我的第33扇区。
tempestglen
帖子: 137
注册时间: 2009-07-16 23:09

Re: 某些windows软件破坏Grub2的信息导致无法启动

#5

帖子 tempestglen » 2010-12-23 12:13

我对流氓软件从来就不文明,从来就是张口就骂。这问题折腾了我好长时间。怒不可遏。
头像
onshoestring
论坛版主
帖子: 4666
注册时间: 2009-09-06 5:53

Re: 某些windows软件破坏Grub2的信息导致无法启动

#6

帖子 onshoestring » 2010-12-23 12:50

It seems that the Windows-based software writes to a sector which is after the end of Stage 1.5, but before the end of the core image. This is why the problem appears to be new with GRUB 2.
换到grub1不就解决了么?
tempestglen
帖子: 137
注册时间: 2009-07-16 23:09

Re: 某些windows软件破坏Grub2的信息导致无法启动

#7

帖子 tempestglen » 2010-12-23 14:11

onshoestring 写了:
It seems that the Windows-based software writes to a sector which is after the end of Stage 1.5, but before the end of the core image. This is why the problem appears to be new with GRUB 2.
换到grub1不就解决了么?
没错,已经换过来了,好了。grub2的core image太大。。。。。
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 某些windows软件破坏Grub2的信息导致无法启动

#8

帖子 billbear » 2010-12-23 14:52

他妈的 adobe 还会干这种偷偷摸摸,自作聪明的事情
回复