[Techtalk] Restoring boot set-up
Chris Wilson
chris+linuxchix at aptivate.org
Sun Jan 20 16:08:43 UTC 2013
Hi David,
On Sun, 20 Jan 2013, David Sumbler wrote:
> My hard drive is set up roughly as follows:
> /dev/sda1 90Mb
> /dev/sda2 45Gb
> /dev/sda3 45Gb
> /dev/sda5 4Gb
> /dev/sda6 4Gb
> /dev/sda7 850Gb
That's a lot of partitions. You might want to look into switching to LVM,
as it gives you a lot more flexibility to move space around.
> Until yesterday /dev/sda3 had my working Ubuntu 11.10 system.
> [...]
It no longer works? It sounds like you can still boot into it, using the
Grub2 menu:
> both versions (12.04 and 11.10 on /dev/sda2 and/dev/sda3 respectively)
> are functioning as they should.
> /dev/sda1 contains nothing but a /boot/grub folder.
Empty? Or with all the Grub1 files in it? (menu.lst, stage1_5, stage2
etc.)
> The only thing I did wrong, rather foolishly, was slightly to mess up
> the booting arrangement.
>
> Previously, the machine booted to /dev/sda1, which presented a grub menu
> giving the choice of the systems on /dev/sda2 and /dev/sda3. (The menu
> is in /boot/grub/menu.lst - does this mean that it is using Grub v1?)
Yes.
> After making the choice, I would be presented with another Grub menu
> from the chosen system, and these would be updated with new versions of
> the kernel from time to time. These menus definitely use Grub v2,
This sounds like the staged (safe) upgrade path to Grub2 presented by
older Debian and Ubuntu versions, where Grub1 was configured to chain-load
Grub2.
> which I find much harder to get my head around than v1.
I agree that Grub2 is much more complex, but it is the future, and I
recommend that you bite the bullet and get used to it.
The biggest help for me in understanding Grub2 is that the configuration
file is not AT ALL written by hand any more. In Grub1, there were various
scripts that tried to make small changes to your menu.lst without breaking
it, usually successfully.
In grub2, grub.cfg is a complex script generated entirely by the
update-grub script. It's not very readable, I recommend you don't let it
scare you. It looks like shell script, but actually it's grub commands,
loaded and interpreted by the new Grub core image (core.img). The "insmod"
command means "load this Grub module" rather than "load this kernel
module" for example. There is no kernel at this stage, when this file is
being read, so loading a kernel module would be impossible.
The update-grub script runs various scripts in /etc/grub.d which try to
detect all Linux installations and kernels on all your hard disk
partitions, and output menu entries for them, which end up in grub.cfg.
It's virtually impossible to remove items from the Grub2 menu, without
manually hacking scripts in /etc/grub.d, which is dangerous and not
recommended. However you can add grub menu items and change settings, once
you understand the Grub configuration syntax, by adding them to
/etc/grub.d/40_custom.
> Unfortunately, I told the 12.04 installer to put grub on to /dev/sda.
> So now I am presented with a single grub menu, offering the choice of
> Ubuntu 12.04, or 11.10 with the latest and several older kernel
> versions. This is OK, but I much preferred the old arrangement.
Why? Surely it means an extra menu for no reason?
> Before I try to rectify things, and run the risk of screwing everything
> up (Grub always scares me, especially version 2!), can someone with more
> knowledge and confidence than I have tell me exactly what steps I need
> to take to restore the old booting arrangement?
Most likely all you need to do is boot into 11.10, which has the old Grub
installation, and run "grub-install /dev/sda", which will replace the
Grub2 in the /dev/sda MBR with Grub1.
However, 11.10 presumably has both Grub1 and Grub2 in it, and I'm not sure
which of these will be installed. It's possible that grub-install in 11.10
will install (the older) Grub2 that's in 11.10, instead of the newer Grub2
that's in 12.04, and thus overwrite your working boot configuration with
another one.
I recommend that you run update-grub in 11.10 first, so that if this
happens, you will still be able to boot 12.04. Otherwise the older Grub2
in 11.10 will probably have the old menu configuration that knows nothing
about 12.04.
There is some risk if you change your boot loader that your 12.04
installation will become inaccessible and it could be a bit tricky to fix.
Hopefully no more than booting the 12.04 CD in rescue mode and asking it
to fix your boot loader. Hopefully.
Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 967 838
Future Business, Cam City FC, Milton Rd, Cambridge, CB4 1UY, UK
Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.
More information about the Techtalk
mailing list