Skip to content

GRUB configuration

Let's create a nice and simple boot menu with 3 choices.

Download Clonezilla

Use your favorite search engine to search for "Clonezilla" and choose the official website.

Choose the "Ubuntu-based alternative stable" version.

Make sure the CPU archictecture is "amd64" and the file type is "iso". Click "Download".

The file will be downloaded to the "Downloads" folder.

Create a directory "ISO" and move the file into that directory.

Remove GRUB countdown timer

sudo sed -i 's/GRUB_TIMEOUT=10/GRUB_TIMEOUT=-1/g' /etc/default/grub
1
2
3
guru@lab:~$ sudo sed -i 's/GRUB_TIMEOUT=10/GRUB_TIMEOUT=-1/g' /etc/default/grub
[sudo] password for guru:     
guru@lab:~$ 

Custom configuration

Open /etc/grub.d/40_custom in an editor (as root)

sudo xed /etc/grub.d/40_custom &

Open /boot/grub/grub.cfg in an editor (as non-root user)

xed /boot/grub/grub.cfg &

Copy over the "Linux part".

Copy over the "Windows part". Then close grub.cfg, we don't need that file anymore.

Add "empty menu" entry.

Copy this text to paste later on.

1
2
3
4
5
6
menuentry 'Restore CLEAN INSTALL' {
    set isofile="/home/guru/Downloads/ISO/clonezilla-live-20230426-lunar-amd64.iso"
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap nolocales edd=on nomodeset ocs_prerun=\"mount /dev/sda7 /home/partimag\" ocs_live_run=\"/usr/sbin/ocs-sr --batch -e1 auto -e2 -t -r -j2 -k -scr -p poweroff restoreparts win-lin sda1 sda2 sda3 sda4 sda5 sda6\" ocs_live_extra_param=\"\" keyboard-layouts=\"NONE \" ocs_live_batch=\"yes\" locales= vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
    initrd (loop)/live/initrd.img
}

Add "Clonezilla restore" entry.

Adjust file permissions

1
2
3
4
cd /etc/grub.d/
sudo chmod -x *
sudo chmod +x 00* 05* 40*
ls -lh
guru@lab:~$ cd /etc/grub.d
guru@lab:/etc/grub.d$ sudo chmod -x *
guru@lab:/etc/grub.d$ sudo chmod +x 00* 05* 40*
guru@lab:/etc/grub.d$ ls -lh
total 136K
-rwxr-xr-x 1 root root  11K Dec 18  2022 00_header
-rwxr-xr-x 1 root root 6,2K Dec  2  2022 05_debian_theme
-rw-r--r-- 1 root root  19K Dec 18  2022 10_linux
-rw-r--r-- 1 root root  43K Dec 18  2022 10_linux_zfs
-rw-r--r-- 1 root root  15K Dec 18  2022 20_linux_xen
-rw-r--r-- 1 root root  14K Dec 18  2022 30_os-prober
-rw-r--r-- 1 root root 1,4K Dec 18  2022 30_uefi-firmware
-rw-r--r-- 1 root root  700 Sep 20  2022 35_fwupd
-rwxr-xr-x 1 root root 2,8K Oct 11 13:26 40_custom
-rw-r--r-- 1 root root  215 Dec 18  2022 41_custom
-rw-r--r-- 1 root root  483 Dec 18  2022 README
guru@lab:/etc/grub.d$ 

Regenerate GRUB configuration

sudo update-grub
1
2
3
4
5
6
7
8
guru@lab:~$ sudo update-grub
[sudo] password for guru:     
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
done
guru@lab:~$