Need help to edit GRUB

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 10:45 am

Hello, I-ve just installed Mint XFCE 18.2 on a friends small VAIO. All fine except that bluetooth would work until I went back to kernel series 8.

I wish to add an entry to boot the Clonezilla ISO which is on a separate partition. fdisk -l gives:

Device Start End Sectors Size Type
/dev/sda1 3956736 42981375 39024640 18.6G Linux filesystem
/dev/sda2 42981376 100883719 57902344 27.6G Linux filesystem
/dev/sda3 100884480 113285119 12400640 5.9G Linux swap
/dev/sda4 115535872 451635199 336099328 160.3G Linux filesystem
/dev/sda5 2048 3956735 3954688 1.9G BIOS boot

Partition table entries are not in disk order.

An attached image shows the disk order. sda5 is at the beginning because the installer required a special boot partition and, not thinking SSD I put it at the beginning.

Ive created the file 40_custom in /etc/grub.d/ whose contents are

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.

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=7
fi

menuentry "BackupRestore"{
set root=(hd0,5)
set isofile="/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts=\"/usr/share/keymaps/i386/azerty/fr-latin9.kmap.gz\" ocs_live_batch=\"no\" locales=fr_CH.UTF-8 vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img

}

Ive given it execute permission and run update-grub but no result.

Mz first question is, should the about file text say "set root=(hd0,5)" or "set root=(hd0,2)". Ive tried both but to no avail.
Second question, what else am I doing wrong?

Anz assistance much appreciated.

User avatar
administrollaattori
Level 12
Level 12
Posts: 4391
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Need help to edit GRUB

Postby administrollaattori » Thu Oct 12, 2017 10:57 am

How about if

Code: Select all

menuentry "BackupRestore"{
set root=(hd0,5)
set isofile="/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd0,5)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts=\"/usr/share/keymaps/i386/azerty/fr-latin9.kmap.gz\" ocs_live_batch=\"no\" locales=fr_CH.UTF-8 vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

PS. You have unknown filesystem in /dev/sda5, so grub cannot find it.

Edit: set root=(hd0,5) was missing.
Last edited by administrollaattori on Thu Oct 12, 2017 11:45 am, edited 1 time in total.

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Thu Oct 12, 2017 11:01 am

Try changing this line:

Code: Select all

loopback loop $isofile

to

Code: Select all

loopback loop (hd0,5)$isofile


Oops! administrollaattori responded already.

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 11:07 am

administrollaattori wrote:How about if

Code: Select all

menuentry "BackupRestore"{
set isofile="/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd0,5)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts=\"/usr/share/keymaps/i386/azerty/fr-latin9.kmap.gz\" ocs_live_batch=\"no\" locales=fr_CH.UTF-8 vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

PS. You have unknown filesystem in /dev/sda5, so grub cannot find it.


Thank you for your suggestion, I'll try that. My problem at the moment is that I cannot get GRUB to compile its cfg file in order that I see the BackupRestore partition listed in the boot menu. Almost certainly due to the sda5 partition. Is there a way to correct that without starting over?

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 11:09 am

blockhead47 wrote:Try changing this line:

Code: Select all

loopback loop $isofile

to

Code: Select all

loopback loop (hd0,5)$isofile


Oops! administrollaattori responded already.


Thank you anyway. Actually the 40_custom setting does work on my principal laptop, although I'll try improving things with your suggestions.

User avatar
administrollaattori
Level 12
Level 12
Posts: 4391
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Need help to edit GRUB

Postby administrollaattori » Thu Oct 12, 2017 11:11 am

oliverjames wrote:Is there a way to correct that without starting over?

No if you not correct or rebuild /dev/sda5's filesystem.

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Thu Oct 12, 2017 11:18 am

If we assume your installer requires sda5 just create a new small partition, say 3 or 4GB, using one of the unallocated blocks. Then place your ISO(s) there.
Adjust 40_custom accordingly then run update-grub and test.
This is what my system looks like:

Code: Select all

device         fs_type     label        mount point
--------------------------------------------------------
/dev/sda1      vfat        EFI          /boot/efi
/dev/sda2      ext4        Ubuntu       (not mounted)
/dev/sda3      swap                     [SWAP]
/dev/sda4      ext4        SystemRescue (not mounted)
/dev/sda5      ext4        Mint         /

and my 40_custom

Code: Select all

submenu "System Rescue Utils"{
 menuentry "System Rescue 5.1.0" {
 set root=(hd0,4)
 set isofile="/systemrescuecd-x86-5.1.0.iso"
 loopback loop (hd0,4)$isofile
 linux (loop)/isolinux/rescue64 setkmap=us isoloop=$isofile
 initrd (loop)/isolinux/initram.igz
 }
 menuentry "Boot Repair (64-bit) " {
 set root=(hd0,4)
 set isofile="/boot-repair-disk-64bit.iso"
 loopback loop (hd0,4)$isofile
  linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject
  initrd (loop)/casper/initrd.lz
 }
 menuentry "Gparted 0.28" {
 set root=(hd0,4)
 set isofile="/gparted-live-0.28.1-1-i686.iso"
 loopback loop $isofile
 linux (loop)/live/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
 initrd (loop)/live/initrd.img
 }
}


SystemRescue partition contains:

Code: Select all

├── boot
│   └── memdisk
├── boot-repair-disk-64bit.iso
├── gparted-live-0.28.1-1-i686.iso
├── lost+found
└── systemrescuecd-x86-5.1.0.iso


I hope those examples help.

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 11:34 am

blockhead47 wrote:If we assume your installer requires sda5 just create a new small partition, say 3 or 4GB, using one of the unallocated blocks. Then place your ISO(s) there.
Adjust 40_custom accordingly then run update-grub and test.
This is what my system looks like:

Code: Select all

device         fs_type     label        mount point
--------------------------------------------------------
/dev/sda1      vfat        EFI          /boot/efi
/dev/sda2      ext4        Ubuntu       (not mounted)
/dev/sda3      swap                     [SWAP]
/dev/sda4      ext4        SystemRescue (not mounted)
/dev/sda5      ext4        Mint         /

and my 40_custom

Code: Select all

submenu "System Rescue Utils"{
 menuentry "System Rescue 5.1.0" {
 set root=(hd0,4)
 set isofile="/systemrescuecd-x86-5.1.0.iso"
 loopback loop (hd0,4)$isofile
 linux (loop)/isolinux/rescue64 setkmap=us isoloop=$isofile
 initrd (loop)/isolinux/initram.igz
 }
 menuentry "Boot Repair (64-bit) " {
 set root=(hd0,4)
 set isofile="/boot-repair-disk-64bit.iso"
 loopback loop (hd0,4)$isofile
  linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject
  initrd (loop)/casper/initrd.lz
 }
 menuentry "Gparted 0.28" {
 set root=(hd0,4)
 set isofile="/gparted-live-0.28.1-1-i686.iso"
 loopback loop $isofile
 linux (loop)/live/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
 initrd (loop)/live/initrd.img
 }
}


SystemRescue partition contains:

Code: Select all

├── boot
│   └── memdisk
├── boot-repair-disk-64bit.iso
├── gparted-live-0.28.1-1-i686.iso
├── lost+found
└── systemrescuecd-x86-5.1.0.iso


I hope those examples help.


Your examples look good but I think my problem requires a different solution. I set about partitioning my disk for Mint XFCE based on previous experience. Having partitioned everything except the small sda5 partition I started install only to be advised that the installer now needs a separate specialbootpartition. This I squeezed in before my BackupRestore (which was sda1) and the install went well. Problem now is that I have this special boot partition that I apparently cannot access with certain boot related files in it.

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Thu Oct 12, 2017 11:59 am

OK, I'm confused.
Are you trying to solve a problem with your system booting PERIOD or just getting the grub menu to display and boot what you want?

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 12:11 pm

blockhead47 wrote:OK, I'm confused.
Are you trying to solve a problem with your system booting PERIOD or just getting the grub menu to display and boot what you want?


Trying to get the grub menu to display and boot what I want

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Thu Oct 12, 2017 2:20 pm

I still think the solution to your problem is:
If we assume your installer requires sda5 just create a new small ext4 partition, say 3 or 4GB, using one of the unallocated blocks on sda shown in your gparted screen shot. Then place your ISO(s) there and then define 40_custom to look for the ISOs there.

Or am I missing something?

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Thu Oct 12, 2017 2:36 pm

blockhead47 wrote:I still think the solution to your problem is:
If we assume your installer requires sda5 just create a new small ext4 partition, say 3 or 4GB, using one of the unallocated blocks on sda shown in your gparted screen shot. Then place your ISO(s) there and then define 40_custom to look for the ISOs there.

Or am I missing something?


I begin to wonder whether it's the inaccessible sda5 created as a result of the recent Ubuntu/Mint requirement for a special boot partition. The laptop I'm typing this from had no such complication and 18.1 is working well. I'd like to know why this special boot partition is required and what's in it, because my post partition insert of it may be the reason that Grub is not working as planned.

Keep it simple guys, you know it makes sense.

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Thu Oct 12, 2017 4:04 pm

I don't know what this requirement is for the special partition. I am running Mint 18.2 on several different brands and vintage computers and have never been required to add a special partition.
Is this perhaps a requirement of this PC or its BIOS? Are you doing an EFI boot?
As someone else in this forum has said, perhaps if we knew more about your system it would shed some light on the problem.
Show us the output of:

Code: Select all

inxi -Fz

and

Code: Select all

sudo lsblk -o name,fstype,label,mountpoint -x name

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Mon Oct 16, 2017 4:14 am

blockhead47 wrote:I don't know what this requirement is for the special partition. I am running Mint 18.2 on several different brands and vintage computers and have never been required to add a special partition.
Is this perhaps a requirement of this PC or its BIOS? Are you doing an EFI boot?
As someone else in this forum has said, perhaps if we knew more about your system it would shed some light on the problem.
Show us the output of:

Code: Select all

inxi -Fz

and

Code: Select all

sudo lsblk -o name,fstype,label,mountpoint -x name


I'm running Mint 18.1 on my work laptop and my GRUB was installed to MBR on sda. It's always worked perfectly and I been able modify GRUB manually without a problem. However my work laptop's SSD has a MSDos partition table. I've recently installed Ubuntu to a Dell Laptop and Mint to a VAIO laptop and in both cases have installed SSDs and opted for GPT partition table. During both these installs I was obliged to create a special BIOS_Grub partition of at least 1.5 Gbyte. Having done this the install completed. None of these machines have EFI boot.

On the VAIO I've started afresh, partitioned the disk GPT as before but now have the requested BIOS_Grub partition as sda1. see screenshots. I have my Clonezilla backuprestore partition accessible and working from the GRUB menu, by using Grub Customizer.

Grub Customizer put boot manager in sda not sda1 (which it couldn't see) but all works OK.

I may be that this issue relates to the GPT option. Does anyone have experience of this?

User avatar
blockhead47
Level 2
Level 2
Posts: 59
Joined: Wed Jun 15, 2016 4:50 pm

Re: Need help to edit GRUB

Postby blockhead47 » Mon Oct 16, 2017 11:36 am

I apologize. I think I was confused and got off track.
So, your system works just fine.You merely are trying to customize the grub boot menu.
So to get back on track, you are using "grub customizer" and get an error when you try to save the customized menu.
Is that correct? If so, do your get that same error if you run the command "sudo update-grub"?

oliverjames
Level 4
Level 4
Posts: 269
Joined: Fri Aug 10, 2007 3:00 am
Location: Divonne-les-Bains, France

Re: Need help to edit GRUB

Postby oliverjames » Mon Oct 16, 2017 11:47 am

blockhead47 wrote:I apologize. I think I was confused and got off track.
So, your system works just fine.You merely are trying to customize the grub boot menu.
So to get back on track, you are using "grub customizer" and get an error when you try to save the customized menu.
Is that correct? If so, do your get that same error if you run the command "sudo update-grub"?


All OK now. I returned to zero and reformatted the SSD with a MSDOS partition table. The install prog didn't need the special Grub_BISO partition, which I'm informed causes a problem for gparted, and all went well. I used Grub_Customizer and now have a perfect working laptop.


Return to “Installation & Boot”