GRUB2 upgrade trigger
There is this piece of code in grub2.spec: > %triggerpostun -- %{name} < %{version}-0 > if [ $1 -le 1 ]; then > exit 0 > fi > echo "Grub was upgraded, trying to setup it to boot sector" > /sbin/grub-install '(hd0)' || : And I don't like it. Having grub installed does not mean one wants it installed to the MBR of the first HDD. Some cases when it is not what one wants: – system booted from a different drive than the first HDD - EFI-booted system. MBR is not used then. And GRUB may have no place to write its MBR bootloader. grub-install invocation is different in this case – grub2 installed on a partition not on a disk (e.g. (hd0,1) instead of (hd0)) – grub installed for booting remote systems via PXE – grub installed for building system images, not to boot the host etc. In most of this cases writing grub to disk is JUST WRONG and may destroy other data (some other specialized bootloader may be needed for this machine). Any idea what to use instead? Maybe an option in /etc/sysconfig/grub? Would this be ok: in /etc/sysconfig/grub: GRUB_INSTALL=/sbin/grub-install '(hd0)' in grub.spec: %triggerpostun -- %{name} < %{version}-0 if [ $1 -le 1 ]; then exit 0 fi GRUB_INSTALL="" if [ -f /etc/sysconfig/grub ] ; then . /etc/sysconfig/grub || : fi if [ -n "$GRUB_INSTALL" ] ; then echo "Grub was upgraded, trying to setup it to boot sector" echo "running: $GRUB_INSTALL" $GRUB_INSTALL || : else echo "Grub was upgraded, GRUB_INSTALL not set in /etc/sysconfig/grub," echo "not the updating boot-loader." fi Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 09:27:29PM +0100, Grzesiek wrote: > > I guess you mean one of the options often used with legacy grub: > > 1. the space between MBR and the first partition > > 2. the unused space at the beginning of a ext[234] file system > > > > Which one? And how much space do you have there? > The first one, first partition starts on 32256B > > I'm using ext4 partition on lvm on one disk. So you cannot write grub into ext4 partition and you need the LVM module in the base grub image, right? This may be tricky, indeed. > Numer Początek Koniec Rozmiar Typ System plików Flaga > 1 32256B 30005821439B 30005789184B primary ntfs ładowalna > 2 30005821440B 999782783999B 969776962560B primary > 3 999782784000B 1000202273279B 419489280B primary linux-swap(v1) > > I'm trying to install grub by "grub-install /dev/sda" and it fails > because core.img is to big, is there any other way to install grub in > this configuration? You could try to create a dedicated /boot partition – putting it at the end of the disk should be doable, provided you still have some space in your LVM PV. In such case the lvm grub module would not be needed and the image would be smaller. But it is probably not a solution you are looking for. I am looking for a ways to make the modules smaller too… Hmm… $ file /lib/grub/i386-pc/normal.mod /lib/grub/i386-pc/normal.mod: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped So there are some debug symbols there… I wonder if grub needs them… Can you try stripping all those modules (backup, 'strip /lib/grub/*/*.mod'), re-install grub (make sure the copies in /boot are also updated) and see if it helps? I don't feel like testing this at my machine at this moment. Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
W dniu 28.10.2012 20:46, Jacek Konieczny pisze: On Sun, Oct 28, 2012 at 08:12:29PM +0100, Grzesiek wrote: I'm using grub2 but some old version from RCD because new packages from TH won't fit into my MBR. Why do you want grub installed in MBR? I don't think any GRUB would fit into 446 bytes. I guess you mean one of the options often used with legacy grub: 1. the space between MBR and the first partition 2. the unused space at the beginning of a ext[234] file system Which one? And how much space do you have there? The first one, first partition starts on 32256B I was playing with GUID Partition Table on both my laptop and the EFI server and used a dedicated BIOS Boot Partition to hold grub in both cases. Probably just an optimisation issue. And optimisation is the thing to do last, when everything else is working. Unless your case is a very common one. I'm using ext4 partition on lvm on one disk. Numer Początek Koniec Rozmiar Typ System plików Flaga 1 32256B 30005821439B 30005789184B primary ntfs ładowalna 2 30005821440B 999782783999B 969776962560B primary 3 999782784000B 1000202273279B 419489280B primary linux-swap(v1) I'm trying to install grub by "grub-install /dev/sda" and it fails because core.img is to big, is there any other way to install grub in this configuration? ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 08:12:29PM +0100, Grzesiek wrote: > I'm using grub2 but some old version from RCD because new packages from > TH won't fit into my MBR. Why do you want grub installed in MBR? I don't think any GRUB would fit into 446 bytes. I guess you mean one of the options often used with legacy grub: 1. the space between MBR and the first partition 2. the unused space at the beginning of a ext[234] file system Which one? And how much space do you have there? I was playing with GUID Partition Table on both my laptop and the EFI server and used a dedicated BIOS Boot Partition to hold grub in both cases. > I have compared grub2-2.00-3 and Ubuntu grub-2.0 and almost all modules > in PLD are bigger: > > module,PLD,Ubuntu > ext2.mod,7608bytes,5784bytes > lvm.mod,6760bytes,6296bytes > msdospart,2956bytes,2412bytes > > Anyone have idea why? Probably just an optimisation issue. And optimisation is the thing to do last, when everything else is working. Unless your case is a very common one. Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
W dniu 27.10.2012 22:56, Jacek Konieczny pisze: Hello, I wanted to boot my servers natively, from UEFI, instead of BIOS compatibility mode. I wanted to use GRUB for that, but found out GRUB2 in PLD lacks EFI support. First I have updated out grub2.spec from version 1.99 to 2.00, then I have started adding EFI support. For that I have removed some patches that were moving grub installed files from /boot/grub/${platform} to /lib. That was IMHO wrong because: 1. only one platform could be installed (PC in this case, so no place for EFI) 2. the /boot partition would be cluttered with GRUB modules even if the GRUB bootloader was not actually installed (via grub-install). I have finally managed to boot my server from this new grub2 package, both in legacy BIOS mode and via UEFI, but the changes I have introduced could potentially break some existing installations. Anybody using GRUB2, please test the new grub2-2.00-0.1 package. I'm using grub2 but some old version from RCD because new packages from TH won't fit into my MBR. I have compared grub2-2.00-3 and Ubuntu grub-2.0 and almost all modules in PLD are bigger: module,PLD,Ubuntu ext2.mod,7608bytes,5784bytes lvm.mod,6760bytes,6296bytes msdospart,2956bytes,2412bytes Anyone have idea why? ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 06:48:59PM +0100, Jacek Konieczny wrote: > > What ISO should I burn for the starters? > Oops... that is not that easy ;) I have assumed you are familiar with PLD > Linux... Rather theoretically, I st^H^Hborrowed a *lot* of PLD specs and patches into ALT Linux packages over the years and I like your approach very much :) (hence my lurking here, actually) > We don't have any 'installation' or 'Live' ISO images, the > system is usually installed via chroot from already running > system. > > If you really want to try, you may start with: http://rescuecd.pld-linux.org/ > Then chroot install of current PLD Th packages, installation of the > newest grub2 from th-test and the rest as I wrote in previous mails. > > But if you are not familiar with PLD Linux yet... then I guess > you should start with installing some plain PLD first. Then, if > you still are eager to help (most people run away at this > point), you can try the EFI testing or anything. I can fall into swap in addition to simply running away :( The PLD Rescue CD is also one of the most liked parts so far, so maybe there's a chance of getting through. Thank you for the hints, and if you get around to some kind of more or less pristine chroot tarball it might help (I'm also willing to discuss installers as that's what I'm hacking on at times but that's pretty much another topic). -- WBR, Michael Shigorin -- Linux.Kiev http://www.linux.kiev.ua/ ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 07:27:26PM +0200, Michael Shigorin wrote: > On Sun, Oct 28, 2012 at 06:19:58PM +0100, Jacek Konieczny wrote: > > Can you test the GRUB/EFI installation with standard PLD kernel? > > What ISO should I burn for the starters? Oops… that is not that easy ;) I have assumed you are familiar with PLD Linux… We don't have any 'installation' or 'Live' ISO images, the system is usually installed via chroot from already running system. If you really want to try, you may start with: http://rescuecd.pld-linux.org/ Then chroot install of current PLD Th packages, installation of the newest grub2 from th-test and the rest as I wrote in previous mails. But if you are not familiar with PLD Linux yet… then I guess you should start with installing some plain PLD first. Then, if you still are eager to help (most people run away at this point), you can try the EFI testing or anything. Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 06:19:58PM +0100, Jacek Konieczny wrote: > Can you test the GRUB/EFI installation with standard PLD kernel? What ISO should I burn for the starters? -- WBR, Michael Shigorin -- Linux.Kiev http://www.linux.kiev.ua/ ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 06:09:30PM +0200, Michael Shigorin wrote: > On Sun, Oct 28, 2012 at 02:56:25PM +0100, Jacek Konieczny wrote: > > Migrating a server with / on LVM on hardware RAID from > > GRUB-legacy/BIOS to GRUB2/EFI was much more complicated > > Just in case, I've got an AMD C60 based board for UEFI testing > and would be glad to help out PLD if that's needed. Can you test the GRUB/EFI installation with standard PLD kernel? My test were not on 'vanilla PLD', especially the kernel package was quite different. I assume PLD kernel does have everything enabled, but I have not verified that. Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 02:56:25PM +0100, Jacek Konieczny wrote: > Migrating a server with / on LVM on hardware RAID from > GRUB-legacy/BIOS to GRUB2/EFI was much more complicated Just in case, I've got an AMD C60 based board for UEFI testing and would be glad to help out PLD if that's needed. Thanks for the walkthrough! -- WBR, Michael Shigorin -- Linux.Kiev http://www.linux.kiev.ua/ ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 01:39:54PM +0100, Paweł Sikora wrote: > > Booted without problems :) > > so, can you wraite a mini-howto for migrating from grub-legacy to grub2-eufi > for machines with "/" on lvm on raid ? :) I don't have EFI on my laptop. And no RAID, but Luks. Migrating from grub-legacy to grub2+grub2-platform-pc for a machine with / on LVM on Luks: poldek> uninstall grub poldek> install grub2 grub2-platform-pc poldek> ^D # vim /boot/grub/grub.cfg :new /boot/grub/menu.lst.rpmsave tutaj sobie skopiować swoje ustawienia ze starego gruba do składni nowego :wq # /sbin/grub-install --no-floppy '(hd0)' Earlier, for some experience, I have converted my HDD partitions from MBR to GPT, but it is another story, not needed for GRUB2/PC. Migrating a server with / on LVM on hardware RAID from GRUB-legacy/BIOS to GRUB2/EFI was much more complicated… – first I had to get GPT partitioning… but there was not even place for GPT, because someone (or 'parted' rather) have put the first partition on the first sector after MBR – then I had to recompile kernel a few times until it worked (I don't use PLD kernel there, most features were disabled) – I have Xen there – it made things both easier (Xen 4.2 boots from EFI with no problems and no extra configuration) and harder – Linux started under Xen does not see EFI – efibootmgr won't work and grub won't install itself as the default boot loader ('cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI' helps). But the short tutorial would be (I have no idea if the software RAID needs special handling here): 1. Make sure your disk has GPT and an EFI system partition. In the simplest case running 'gdisk' and adding the EFI system partition should do. But in real life things are more complicated. I managed to resize and move both /boot and LVM partitions with gdisk/e2resizefs/pvmove/etc with no data loss (by removing them, recreating smaller, creating temporary partitions behind them, moving data, removing and recreating target partitions in the right places, moving data gain). But it was a test system that could be destroyed. I would not dare that on a production system ;) You may also want to add a 'BIOS boot partition' somewhere at the beginning of the disk too, to install grub2 for BIOS booting. 2. Install grub2 and grub2-platform-efi and 'efibootmgr' 3. mount the EFI partition at /boot/efi 4. 'grub-install --target=x86_64-efi --efi-directory=/boot/efi' 4a. optionally: 'grub-install --no-floppy --target=i386-pc (hd0)' to have the system bootable via BIOS too. 5. 'cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI' 6. edit /boot/grub/grub.cfg it may be good idea to add (otherwise grub complains 'the OS won't have console' or something like that): -- cut -- insmod efi_gop insmod efi_uga insmod font if loadfont dejavu then insmod gfxterm set gfxmode=auto set gfxpayload=keep terminal_output serial gfxterm fi -- cut -- and: mkdir -p /boot/grub/fonts grub-mkfont -o /boot/grub/fonts/dejavu.pf2 /usr/share/fonts/TTF/DejaVuSans.ttf 7. Reboot, the system should boot via EFI/GRUB2 8. make the proper EFI boot loader entry: - modprobe efivars - grub-install --target=x86_64-efi --efi-directory=/boot/efi – rm /boot/efi/EFI/BOOT/BOOTX64.EFI 9. reboot again Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sunday 28 of October 2012 12:34:30 Jacek Konieczny wrote: > On Sun, Oct 28, 2012 at 12:23:16PM +0100, Paweł Gołaszewski wrote: > > On Sat, 27 Oct 2012, Jacek Konieczny wrote: > > > Please note: now the 'grub2' package does not contain any platform > > > files. You have to install grub2-pc (or grub2-efi) too. > > > > virtual provides "grub2-platform" in each platform package and "requires: > > grub2-platform" in main package will do that job. > > > > Better safe than sorry. > > You are right. I am so happy to have 'Suggests', so I forgot about > Requires with virtual provides ;) > > > > P.S. I have installed the new grub2 on my laptop too… I hope it will > > > boot tomorrow ;) > > > > Let us know :) > > Booted without problems :) so, can you wraite a mini-howto for migrating from grub-legacy to grub2-eufi for machines with "/" on lvm on raid ? :) ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sun, Oct 28, 2012 at 12:23:16PM +0100, Paweł Gołaszewski wrote: > On Sat, 27 Oct 2012, Jacek Konieczny wrote: > > Please note: now the 'grub2' package does not contain any platform > > files. You have to install grub2-pc (or grub2-efi) too. > > virtual provides "grub2-platform" in each platform package and "requires: > grub2-platform" in main package will do that job. > > Better safe than sorry. You are right. I am so happy to have 'Suggests', so I forgot about Requires with virtual provides ;) > > P.S. I have installed the new grub2 on my laptop too… I hope it will > > boot tomorrow ;) > > Let us know :) Booted without problems :) Greets, Jacek ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: GRUB2 changes, introducing EFI
On Sat, 27 Oct 2012, Jacek Konieczny wrote: > Please note: now the 'grub2' package does not contain any platform > files. You have to install grub2-pc (or grub2-efi) too. virtual provides "grub2-platform" in each platform package and "requires: grub2-platform" in main package will do that job. Better safe than sorry. > P.S. I have installed the new grub2 on my laptop too… I hope it will > boot tomorrow ;) Let us know :) -- pozdr. Paweł Gołaszewski jid:bluesjabbergdapl -- If you think of MS-DOS as mono, and Windows as stereo, then Linux is Dolby Pro-Logic Surround Sound with Bass Boost and all the music is free.___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en