Installing Grub2

Using applications, configuring, problems
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

Installing Grub2

#1 Post by s243a »

I'm trying to set up grub2 for puppylinux and at this point this thread is mostly to document what I've done. Whether this is more of a call for help or a how-to guide remains to be determined.

Most of what I've found online (e.g. The puppylinux wiki) -- including on these forms -- has been about configuring grub2

I'm using tahrpup 6.0.6 so some things may be tahrpup specific.

The reason that I decided to delve into grup2 is because the hard drive has a gpt partition table. My understanding is grup4dos won't work with this type of partition table.

I read on archwiki that there can be issue with setting the bootflag using gparted for gpt partitions. So I used the following command to set the bootflag:

Code: Select all

cfdisk /dev/sdc


Tahrpup comes with grub2 installed but not with all packages. I installed additional packages in the package manager which may or may not have been necessary. The following files are in my ~.packages folder:

Code: Select all

grub2_2.02.files
grub2-common_2.02.files
grub2-splashimages_1.0.1+nmu1.files
grub-common_2.02.files
grub-gfxpayload-lists_0.6.files
grub-imageboot_0.6.files
grub-pc_2.02.files
grub-pc-bin_2.02.files
I'm not sure which are necessary but I didn't want to be missing anything important. The next thing that I did was installed grub 2 the partition:

Code: Select all

root# grub-install --boot-directory=/mnt/sdc1/boot /dev/sdc1
Installing for i386-pc platform.grub-install: 
warning: File system `fat' doesn't support embedding.grub-install: 
warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..grub-install: error: will not proceed with blocklists.
I then modified /etc/grub.d/40_custom

Code: Select all

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "Puppy tahr 6.0.6 (sdc1 - WD My Book 25EE)" {
insmod vfat
search --no-floppy --fs-uuid --set F709-8F1C
linux /vmlinuz pmedia=usbhd psubdir=/ pdrv=F709-8F1C psave=F709-8F1C:tahrsave.4fs
initrd /initrd.gz
} 
as is suggested numerous places. Note that i'm using more puppy boot parameters then is typical for reasons discussed elsewhere on this forum.

The next step is to update grub. The following doesn't work:

Code: Select all

root# update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `unionfs'.
Here is the solution that I found:

Code: Select all

#!/bin/sh
#https://askubuntu.com/questions/254491/failed-to-get-canonical-path-of-cow
MTpoint="/mnt/sdc1"
Mtdev="/dev/sdc1"
mkdir "$MTpoint"
mkdir "$MTpoint/boot"
mount "$Mtdev" "$MTpoint" 
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do
  mkdir "$MTpoint/$dir" && mount --bind /$dir "$MTpoint/$dir"
done
chroot "$MTpoint"
#update-grub2  # Type this at the prompt in the chroot environment
However, before you do it you need to copy:

Code: Select all

/usr/share/syslinux/memdisk
the place where you installed grub2. For me this is at:

Code: Select all

/mnt/sdc1/boot
Now I guess I need to try rebooting and see what happens. I had some warnings above so I'm not sure it will work.

P.S. some interesting low level info on how grub2 works can be found at:
https://pete.akeo.ie/2014/05/compiling- ... 2-for.html

but it is mostly for MBR type installations.

Notes
---------------------------
1 - The puppylinux wiki has two examples of grub2 menu configurations (#1 #2) and some [url=http://puppylinux.org/wikka/grub2tut]instructions on configuring grub2 but they are incomplete.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#2 Post by fredx181 »

Hi, s243a,

I can't really help with the way you are trying to set it up, but I've put together a sort of portable grub2 package (32 bit) that works fine for me (but only tested on removable media)

EDIT: I thought better to move to separate topic in "HowTo" section), see here:
http://murga-linux.com/puppy/viewtopic. ... 727#988727

Fred

watchdog
Posts: 2021
Joined: Fri 28 Sep 2012, 18:04
Location: Italy

#3 Post by watchdog »

I remember I did in the past some experiments:

http://www.murga-linux.com/puppy/viewto ... 562#898562

There also is the expired grub2 1.98 by rcrsn51:

http://www.murga-linux.com/puppy/viewto ... 618#933618

I also experimented with a grub 2.02 package in bionic beaver beta:

http://murga-linux.com/puppy/viewtopic. ... 405#986405

https://drive.google.com/file/d/1PTV3Qi ... sp=sharing

I have not a UEFI machine and so I can't help more. I add the standard example of menuentry for booting a frugal puppy:

Code: Select all

menuentry "Puppy bionic beaver 18.04+5 (sdb1/ubbpup)" {
set root=(hd1,1)
linux /ubbpup/vmlinuz pmedia=usbhd psubdir=ubbpup pfix=fsck
initrd /ubbpup/initrd.gz
}
Finally I discourage any attempt to use the os-prober of grub2 which will not work in puppy. So forget update-grub. You have to manually edit /boot/grub/grub.cfg.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#4 Post by s243a »

watchdog wrote: I have not a UEFI machine and so I can't help more. I add the standard example of menuentry for booting a frugal puppy:
I think there is a size limit to an MRB type partition table but I'll need to read the following link to understand this:
https://blogs.technet.microsoft.com/ask ... s-storage/

but if size isn't the issue I'd at least need to reformat the device and this would involve copying the data elsewhere.
watchdog wrote: Finally I discourage any attempt to use the os-prober of grub2 which will not work in puppy. So forget update-grub. You have to manually edit /boot/grub/grub.cfg.
update-grub2 successfully created /boot/grub/grub.cfg for me on tahrupup, so maybe it works on tahrpup. That said my bios didn't see the device. Maybe I need to try it on a different computer.

That said I don't know what os-prober does so I don't know if it buys me anything.

P.S. I'll check out some of the links above to see if they are helpful.

Post Reply