grub2 minimal configuration entry THIS IS UNRELIABLE

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
gerry
Posts: 986
Joined: Thu 26 Jul 2007, 21:49
Location: England

grub2 minimal configuration entry THIS IS UNRELIABLE

#1 Post by gerry »

EDIT: sorry folks- the wind changed direction, or something, and it stopped working.
EDIT2: Silly me- I'd been trying some other ideas, and forgotten the final "update-grub". Working again now.

EDIT3: DON'T DO IT. This is unreliable, Grub needs more than this.

I run Mint 17, Debian 7.7, and Slacko 5.7 on my Thinkpad T60 laptop.
The bootloader is GRUB2, residing in Mint ('cos that's the latest long term support version, and will stay for years). The grub2 autofind function is a bit snooty, and refuses to find Puppy- so an entry in /etc/grub.d/40_custom has to be created.

I read lots of topics in lots of forums, and lots of grub2 configuration manuals, but could not understand most of what they said had to go into the configuration file- mainly because they were all different.

Eventually, I realised that all grub2 needs to be told is where to find the vmlinuz and initrd.gz files. Everything else was either default values or it could work it out.

My Puppy is a frugal install. Initially, I had all files installed directly into the partition.

Puppy is on the first and only hard drive, in partition 6. To edit /etc/grub.d/40_custom you can either use the distro where it resides, but you have to use sudo or become root. It's easier to use Puppy to mount the (in my case Mint) partition, and then edit /etc/grub.d/40_custom file using Puppy.

Note that when you edit this file you must not touch what is there already- just add your own lines below that. So here's my first go:

menuentry "Slacko" {
linux (hd0,6)/vmlinuz
initrd (hd0,6)/initrd.gz
}

Simple, isn't it? That really is (in my case!) all the information that is needed.

After doing this and saving the file, you need to boot your major distro, and open a root terminal, and do:
#update-grub

then reboot, and you should see Puppy at the bottom of the menu list. Click on that, and Puppy should boot.

If you want to put several Puppies in sub-folders, the entry becomes:

menuentry "Slacko57" {
linux (hd0,6)/slacko57/vmlinuz
initrd (hd0,6)/slacko57/initrd.gz
}

for a Slacko in a folder named slacko57.

Gerry
Last edited by gerry on Wed 17 Dec 2014, 08:04, edited 1 time in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Grub is special

Version 2 even supports gettext to localize text

Does anyone know if Grub2 handles kezyzyzyzyboard layouts ?


Grub1 has setkey but that is almost useless

Code: Select all

setkey y F10
setkey z F9
setkey z y
and voila there is z on z, y, F10 and F9 -- four times z - but no y anywhere

:lol:
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

gerry
Posts: 986
Joined: Thu 26 Jul 2007, 21:49
Location: England

#3 Post by gerry »

This minimal configuration turns out to be unreliable; Sometimes it works, sometimes it doesn't.

In the end I did as I was advised, and installed GRUB4DOS. Much better idea.

Gerry

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

Be aware that most commands now have to be insmod.
Even

Code: Select all

insmod help
is needed in the grub2 shell to be able to use the help command .

And Grub2-2.02 supports more commands than Grub2-1.98 .

Don't mix their modules . Always delete everyting in /boot/grub/*.mod , before installing grub2 after up/downgrade .

Code: Select all

insmod menuentry
menuentry "Some LNXLNX" {
insmod linux
insmod initrd
insmod ext2
insmod set
set root='(hd0,6)'

linux /boot/vmlinuz-distro-version
initrd /boot/initrd-distro-version
}
:lol:
root is two things now : A command like in old Grub1 and a variable set by "set"


Grub2 has the ability to boot a complete iso like

Code: Select all

menuentry "Iso Mount" {
insmod loop
losetup (loop0) (hd0,1)/Puppy/puppy.iso
linux (loop0)/vmlinuz
initrd (loop0)/initrd.gz
}
But Puppy's initrd is not configured to search for ISO files :cry:
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

User avatar
Ted Dog
Posts: 3965
Joined: Wed 14 Sep 2005, 02:35
Location: Heart of Texas

#5 Post by Ted Dog »

cool iso mount it will help me organize my collection of Fatdog64. You unpack those and everything has the exact same name as the version before very confusing. :wink:

bobc
Posts: 87
Joined: Wed 14 May 2014, 23:07

#6 Post by bobc »

Gerry, your syntax looks like its not for grub2. It looks like for grub-legacy or maybe grub4dos (I only used that once), but maybe grub2 accepts that syntax also, I wouldn't know.

I am certainly no expert, learned a lot by screwing up many times.

I prefer grub2 because it finds most operating systems that I have.

I will never try grub or grub4dos again. Puppy package manager has a grub2 package available. I have installed it and have it working on my full install of Slacko 5.7.0. As part of the install it also installed the os-prober package. Once the package is installed:

if I want to change grub defaults, they are in the file /etc/defaults/grub.

then if I need to manually add other operating systems to the boot menu, I need to modify /etc/grub.d/40_custom.

then I run the install. my boot drive is sda. it installs the boot loader to /dev/sda and points it back to running this operating system and its grub configuration by default

grub-install --recheck /dev/sda

then I run

update-grub

to rebuild the configuration.

then I close everything and select reboot from the main menu. This operating system should be listed first.

I like karl's ideas :) It would be neat to be able to boot from an iso file.

My opinion is that grub2's worst problem is how it fails to correctly identify different systems on the grub menu, and either mis-identifies them or says they are unknown. I am surprised there is no standard place to look for text to identify any particular operating system.

I have found with Slackware based distros that if I create a file

/etc/slackware-version

On my Slackware 14.1 partition the file says "Slackware 14.1"

I can put a descriptive line in it like "Slacko-5.7.0 14.0" and that will get used in the generated grub2 boot menu along with the name of the partition.

This worked for Slacko and Slackel and Salix

Its a shame it doesn't use the label of the partition because I always put the description I would want to see there.

I don't know if this would work for any other distros or not. For example, in a debian based distro a file

/etc/debian-version

looks like it might work similar to the slackware one above, but in this case the file existed and had "7.2" in it, so I changed it to "7.2 antiX-13.2"

This worked for antiX

What I don't know is if it will affect anything else, that I can't say, since you will note that different distros use this method in different ways.

PS: Arch linux has a file /etc/arch-release and Manjaro which is an Arch derivative has a file /etc/manjaro-release.

I did find that if someone upgrades an OS it may check or want to update these version or release files, so I'd be extra careful changing the file if it already exists, because it would likely cause potentially major problems if the os is looking for it and using it.

The code I found this in is called 90linux-distro in the os-prober package of debian.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#7 Post by rufwoof »

Came across this old thread. Just to add that you configure grub in /etc/grub.d/40_custom, such as in my case adding a entry to boot OpenBSD on the 4th partition (unlike grub4dos partition numbering is 1,2,3,4 instead of 0,1,2,3)

Code: Select all

menuentry "OpenBSD" {
	set root=(hd0,4)
	chainloader +1
}
Or other boot commands such as mentioned in earlier posts. And then run

Code: Select all

grub-mkconfig -o /boot/grub/grub.cfg
If you've something like Debian installed then within that you can alternatively run

Code: Select all

update-grub
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

Post Reply