-
Junior Member
registered user
GPT and Grub2 (grub2 1.99 -> 2.01)
Hi, been a while posting but got into a situation where i have purchaced a new ASUS 550 with EFI boot + GPT installed.
It took a while to get grub2 working, but have somewhat.
Manual install is needed if you
1) want to EFI boot off GPT type hd's and dont want to destroy existing partitions or data (in my case an existing Windows Install)
2) If you have a USB style install to your HD, ie with a KNOPPIX/knoppix-data.img setup.
I have been using a USB install to HD since about knoppix 6.4. I also wanted to keep windows for one and only one reason (Turbo Tax) which i have been using for years.
Plus with usb sticks protruding out of the side of my PC is a matter of time until bump/breakage.
So I needed to manually install grub2 (of which i knew nothing about until this EFI/GPT PC).
With a USB style install to HD you need to have a bootable usb stick or mmc boot. To this day i rarely use lilo boot, but came in handy with GPT.
I still use all the syslinux/*.cfg files as a basis for grub entries.
And the linux/linux64 files. So my /mnt-system looks like the following:
# /dev/sda2 aka (hd0,1) aka (hd1,gpt2) EFI boot on GPT partition 2
# I duplicate this also to /dev/sda4 (hd0,3) and on grub2 (hd1,gpt4) which is big enough to hold 3 DVD KNOPPIX versions which is aka /mnt-system after boot
# /mnt-system is what grub-* cmds wiill alter for the ones that will work with --boot-directory
boot/isolinux -> syslinux # compatibility with lilo (important again with EFI+GPT) # symlink on fs that support it, eg ext2-4, etc just a copy on fs such as VFAT that do not support symlinks.
boot/syslinux -> syslinux74 # defaults to latest # symlink on fs that support it, eg ext2-4, etc just a copy on fs such as VFAT that do not support symlinks.
boot/syslinux72 # Knoppix 7.0 syslinux dir
boot/syslinux70 # Knoppix 7.2 syslinux dir
boot/syslinux74 # Knoppix 7.4 syslinux dir
boot/grub # prior to grub2 this only had menu.lst but with grub2 now al the files that come with grub2 (modules, etc) + grub.cfg
boot/grub/menu.lst # legacy grub <= 0.97 file for reference and "master copy from combining syslinux*.cfg entries into grub-legacy entries
boot/grub/grub.cfg # generated grub-menulst2cfg or by grub-pc.postinst using menu.lst in same dir
# This goes in the first partition with enough size along with a duplicate boot partition above, which is /dev/sda4 - aka grub legacy: (hd0,3) and grub2: (hd1,gpt4)
KNOPPIX -> KNOPPIX74 # symlink on fs that support it, eg ext2-4, etc just a copy on fs such as VFAT that do not support it.
KNOPPIX70 # entries with knoppix_dir=KNOPPIX70
KNOPPIX72 # entries with knoppix_dir=KNOPPIX70
KNOPPIX74 # entries with knoppix_dir=KNOPPIX70
/boot/grub/menu.lst # prior to grub2 install this is the only file in boot grub
boot/syslinux* # duplicate of all above dirs
Rememeber to apt-get install -t testing util-linux to update fdisk to even see your GPT properly. Do ths for each usb drive and knoppix-data.img you have.
1.99 grub2 is not compatible with 2.02 grub2. The difference between apt-get install grub2 grub-pc and apt-get install -t testing grub-pc as of 3/30/2015
The format is basically the same except 1.99 has entries like this:
grub2 2.02 grub2 1.99 grub 0.97
linux legacy_kernel vs kernel legacy grub <= 0.97
initrd legacy_initrd vs initrd
vi /mnt-system/boot/grub/*.cfg
:%s@legacy_kernel@linux@
:%s@legacy_initrd@initrd@
:%s@hd0,1@hd1,gpt2@ # this maps to /dev/sda2 the GPT efi boot/partition which may be different on your system
The errors on 1.99 and 2.02 are the same on any usb style install:
apt-get install [-t testing] grub2 grub-pc has many errors on install
Wether grub2 v1.99 or grub2 v2.02
You must edit the /var/lib/dpkg/info/grub-pc.postinst script and add this to beginning of 1st executable line:
root=/mnt-system # set to "" to get default behaviour
sudo vi grub-pc.postinst and substituted every /boot with /mnt-system/boot by making $root/boot...:
:%s@/boot@$root/boot#@g # many of these in script
:%s@ / /@ $root/ /@ # there's one lonesome root without /boot in the grub-pc.postinst script
:%s@grub-install@grub-install --boot-directory=/mnt-system@
:wq
then sudo ./grub-pc.postinst configure # this will run the command within
After this change you can simple change export root="/mnt-system" to "fix" for knoppix usb installs or "" to restore original script to it's regular operation
Even with this change grub-probe will return with an grub-probe error that it cant find the device for /boot,
but well after it's done most of the installation (and conversion of menu.lst to grub.cfg and many other conversion steps).
Even with this change, until grub2 supports an enviroment var, eg export ROOT_BOOT=/mnt-system, manyl grub2 cmds will report errors.
An alternative is to add --boot-directory=/mnt-system/boot to the grub-install commands and all that will accept it but this is only a few that I have found.
Note that you may try this with export root="" at beginning of grub-pc.postinst
then run: sudo grub-pc.postinst configure to convert those in the /boot/grub stuff as well (although i dont think it will be a complete conversion, it should remove all those legacy stage files and create a new grub.cfg from menu.lst).
after this error you can now rsync /mnt-system/boot /media/sda2 (after mounting /dev/sda2) to get a dup of the resulting files. Remember i am using /dev/sda2
as gpt2 on my primary hard drive since it's EFI/grub_boot partition.
setting grub_boot flag on GPT partition via parted or gdisk (a fdisk replacement) is much different from legacy boot flag of ATA drives/partitions.
you may need to set this flag on your EFI/fat partition if not already set (via gdisk or parted).
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Cisco 24 Ports UPoE Managed Network Switch P/N: C9300-24UX-A Tested
$340.00
Cisco CBS350 Series Business Managed Switch 24-Port CBS350-24T-4X-NA
$285.00
New | CISCO NEXUS N2K-C2348UPQ-10GE V02 48-PORTS 10Gb SFP DUAL N2200-PAC-400W
$129.99
Cisco Nexus N3K-C3064PQ-10GX 48P 10GbE SFP+ 4P QSFP+ Switch
$215.00
Cisco WS-C2960-48TT-L Catalyst 2960 48 Port Managed Network Switch
$33.01
🔥🔥🔥Genuine Cisco SFP-10G-SR V03 10GBASE-SR SFP+ Transceiver 10-2415-03 🔥🔥🔥
$8.00
Cisco C3850-NM-2-10G Catalyst 3850 2 x 10GE Network Module
$29.00
CISCO C3850-NM-4-10G 4 PORT Network Expansion Module
$89.99
Cisco WS-C3850-24XU-L Catalyst 24 100Mbps/1/2.5/5/10 Gbps UPOE Ethernet Switch
$279.99
Cisco Nexus N9K-C92160YC-X 48P 25GbE SFP28 6P QSFP+/QSFP28 PE Switch
$399.00