Booting Manjaro iso using grub2

grub
boot

#1

Use only this first post
.
.
.
.
.

############## beginning of basic current entry ####################
################## edited 20181004 #########################
################## latest tested 18.0 beta 8 #########################
################## works from 17.0.3 #########################

Notes:
While the entry will work for both grub-legacy and uefi grubs,
o uefi grub will boot up and install in uefi mode
o and bios-legacy grub will boot up and install in bios-legacy mode.
.
.

Latest valid menuentry here

menuentry "Manjaro  grub_iso" {
    set isofile="/miso/manjaro-kde-17.1.6-stable-x86_64.iso"
    set dri="free"
    search --no-floppy -f --set=root $isofile
    probe -u $root --set=abc
    set pqr="/dev/disk/by-uuid/$abc"
    loopback loop $isofile
    linux  (loop)/boot/vmlinuz-x86_64  img_dev=$pqr img_loop=$isofile driver=$dri tz=utc lang=en_us keytable=us
    initrd  (loop)/boot/intel_ucode.img (loop)/boot/initramfs-x86_64.img
}

The following must be added to the linux line for specific options. Below are examples.

o lang=zh_CN
o tz=Europe/Madrid
o keytable=no (norwegian)

So for a Berliner, the following applies…

menuentry "Manjaro  grub_iso"  {
    set isofile="/miso/manjaro-kde-17.1.6-stable-x86_64.iso"
    set dri="free"
    search --no-floppy -f --set=root $isofile
    probe -u $root --set=abc
    set pqr="/dev/disk/by-uuid/$abc"
    loopback loop $isofile
    linux  (loop)/boot/vmlinuz-x86_64  img_dev=$pqr img_loop=$isofile driver=$dri tz=Europe/Berlin lang=de_DE keytable=de
    initrd  (loop)/boot/intel_ucode.img (loop)/boot/initramfs-x86_64.img
}

Further notes:
o set isofile="/miso/manjaro.iso"
This sets the path to the Manjaro iso. So in our example above, manjaro.iso is in a directory “miso”.
It is a good habit to put any file in a directory, never in a raw partition. Preferably, in a data or non-os partition.
If it is in directory /abc/def/ghi/ of any partition and the file is “manjaro-lxqt-community-16.06-x86_64.iso”, then

set isofile="/abc/def/ghi/manjaro-lxqt-community-16.06-x86_64.iso"

And remember, always install to another partition, not where the iso file resides.
So if the iso file is in sda8, do not install Manjaro to sda8.
You can put the iso file in a usb partition (in a directory) but a file in an internal disk is faster.

o set dri=“nonfree” or dri="free’

This sets the installer to using either proprietary or free drivers.
Currently, it is recommended to use non-free drivers for nvidia cards and ‘free’ for amd graphic cards. Intel graphic cards is always ‘free’

o Reminder
You need to change only the 2 set lines
set isofile=
set dri=
And your locale in linux line
lang=
tz=
keytable=

All others do not need to be amended.

##################### end #######################
,
,
,

A recommendation on where to put the above entry.
The best place to put any non-OS generated grub entry is in /boot/grub/custom.cfg
If file is not available, first create this file

sudo touch /boot/grub/custom.cfg

Open up this file, put entry in it and save file. Done.
There is no need to update-grub.
Note entries in /boot/grub/custom.cfg will not be shown in os-prober, update-grub or ‘grub-mkconfig -o …’
Entries in it will never be changed by any grub-install or update-grub
And can only be modified or deleted manually by user.

###########################################################

ps: The ‘old’ way is to put entries in 40_custom in /etc/grub.d
and do an update-grub
If you use this, careful you do not remove the header in this 40_custom file.
Check whenever any grub-install or new grub version to see if entries in 40_custom is removed.
Any error in the entries in 40_custom can result in a borked grub after ‘update-grub’.
This method is still valid. Poor choice.

Another way is to put directly the entry in /boot/grub/grub.cfg (like in grub-legacy).
There will be ‘serious warnings’ by the system and any grub-install or update-grub will remove this entry but could be used for temporary entries, like in this case.
In some DE’s like KDE, this amendment to /boot/grub/grub.cfg will be disallowed unless the file is opened with SUDO_EDITOR=kate sudoedit <file> .
Errors using this method (like in custom.cfg) will not bork grub. Just that the entry won’t work.
IMO, a better choice than using 40_custom.


Boot from extracted ISO file on hard drive?
Install Manjaro onto a 16 GB USB Stick
Install Manjaro ISO from HDD
[stable] ISOs of Manjaro 16.11/LXQt 0.11 released
Installing from external hdd
Black screen after grub menu
Resolved - Grub error during installation
Using Manjaro stable, unable to boot from iso on hard disk
GRUB2 ISO Boot-Menu Design
2-partion bootable usb stick
GRUB2 ISO Boot-Menu Design
Installation problem 17.02
How make an USB Live with Manjaro OpenRC?
Boot Manjaro ISO from Grub2 loopback
HowTo - Restore an unbootable system after an interrupted kernel update
Booting Tails ISO from grub
Not booting from LiveCD
Plans for the next bspwm edition release
[SOLVED] rEFInd: Live-USB won't boot w/manjaro-xfce-17.1-pre2 (nor 17.06)
What I like in Linux
Your thoughts on the different DEs?
Testing for bspwm editions
Incompatibility between graphical grub and some laptops models
Incompatibility between graphical grub and some laptops models
[solved] Boot from ISO file
How to install manjaro linux to external ssd without using a flashdrive/DVD
Boot entirely to RAM and disconnect medium
Corrupt Installation of Xfce [Solved]
Unable to load Manjaro KDE from live-usb
[TOC] Manjaro Installation
Alienware Optimus: Stuck at Welcome to GRUB - no grub rescue
[Illyria] Manjaro XFCE v18.0-beta9 online now!
GRUB2 ISO Boot-Menu Design
Not booting after installation. grub problems?
Install without boot
MaboxLinux - Manjaro re-spin with Openbox WM
The new silent boot - I dont think it's good to have it as default
How to install Manjaro using ISO image on HDD
How to install Manjaro using ISO image on HDD
Jakarta: Manjaro on UEFI
Inconsistent installer boot results
Manjaro architect 0.9.2
#2

Notes.


All we need to do is to modify only the first 4 “set” lines.

o set isofile="/miso/manjaro.iso"

This sets the path to the Manjaro iso. So our example above is manjaro.iso in directory “miso”.
If it is in directory /abc/def/ghi/ and the file is “manjaro-lxqt-community-16.06-x86_64.iso”, then

set isofile=/abc/def/ghi/manjaro-lxqt-community-16.06-x86_64.iso

It is good habit to put any file in a directory, never in a raw partition. Preferably, in a data or non-os partition.

And remember, always install to another partition, not where the iso file resides.
So if the iso file is in sda8, do not install Manjaro to sda8.
You can, and I expect many (not me) will do this, put the iso file in a usb partition (in a directory).

o set mlabel="MJRO1606"

This is the volume id label of the manjaro iso.
Currently, it is now MJRO1606, older iso’s may be different and future iso’s may change.
To check, use “iso-info” or isoinfo -d -i" (depending on DE version).

iso-info /path/to/manjaro.iso isoinfo -d -i /path/to/manjaro.iso

o set archi="x86_64"

Our example is on 64 bit architecture; if using 32 bit, then

set archi="i686"

o set dri="nonfree"

Our example is using non-free graphic drivers, if we want to boot up in free graphics (or using intel graphic cards),

set dri="free"

Note I am taking advantage of grub ignoring meaningless or non-applicable parameters here.

o probe -u

A note here about the ‘probe’ command.
Instead of uuid (img_dev=UUID=$abc), we can boot up using plain ‘/dev/sdxy’ or use label.
But always uuid is most precise and secure.
If we want to (and we have labelled the partition), we can change to

probe -l $root --set=abc img_dev=LABEL=$abc
or just img_dev=LABEL=<your label here> img_dev=/dev/sdxy

o Other notes

Manjaro is of course not the only distro we can boot isofiles. We can boot Debian, Ubuntu (and their derivatives), gparted, knoppix, grml and many others.

It may be useful to include their entries and I will do so in later posts.
Your contribution will be most helpful.


Install without boot
Installation of manjaro deepin on a second hdd: error at bootup
Grub2 iso boot menu entry
Grub Issues initrd
Installation problem 17.02
#3

Adding entries to existing grub menu

Create a new text file, custom.cfg in /boot/grub/
sudo touch /boot/grub/custom.cfg
Open up this new file, add new entry/entries, save file and exit.


Restore Manjaro boot
Grub Boot not working with EFI
#4

'LLo gohlip,

If i understand fine (don’t use grub anymore since a while…!), as a live & no more Usb key needed ?


#5

Heh heh… See my edited post2 above. You can use usb stick.
You don’t use grub for a while? What are you using?


#6

Cool but usb stick is not absolutly needed, right ?
With Linux tripleboot & so Redmondia free, syslinux only -> “enjoy the simplicity” !


#7

Correct. [quote=“gohlip, post:2, topic:3132”]
You can, and I expect many (not me) will do this, put the iso file in a usb partition (in a directory).
[/quote]

[quote=“fassil, post:6, topic:3132”]
syslinux only
[/quote]Ha ha. I’ve forgotten most. like lilo , grub-legacy (I was er… good (humility aside) in it and loved it when it came out, just that grub 2 is much much better). Personally don’t like gummiboot, bootctl (systemd boot), efistub or rEFInd. Too plain, featureless and cannot do much if things go wrong and always need manual intervention (with new kernels, new installations, etc…).

Cheers.


#8

Nice one. I like it. Thank you very much for sharing.


#9

[quote=“gohlip, post:7, topic:3132”]
Ha ha. I’ve forgotten most. like lilo , grub-legacy (I was er… good (humility aside) in it and loved it when it came out, just that grub 2 is much much better). Personally don’t like gummiboot, bootctl (systemd boot), efistub or rEFInd.[/quote]
Nothing of all that, just syslinux !

With specific aliases to cp right initramfs & vmlinuz before/after next failing boot when updated kernels come, no manual intervention, too !
& if i change kernel, modify syslinux.cfg is easy as pie !

Imho, grub is only unified/needed to share your DD with Redmondia/Cupertinia (EFI f*****g stuff) !


#10

For all following, change “insmod part_msdos, insmod ext2”… where appropriate.

gparted

menuentry "Gparted  iso" {
    insmod part_msdos
    insmod ext2
    set isofile="/miso/gparted.iso"
    search --no-floppy -f --set=root $isofile
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live findiso=$isofile union=overlay username=user config components quiet noswap noeject  toram=filesystem.squashfs ip=  nosplash 
    initrd (loop)/live/initrd.img
}

xUbuntu’s

menuentry "Casper iso" {
    insmod part_msdos
    insmod ext2
    set isofile="/miso/xenial-desktop-amd64.iso"
    search --no-floppy -f --set=root $isofile
    loopback loop $isofile
    linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noeject noprompt quiet splash
    initrd (loop)/casper/initrd.lz
}

Ubuntu derivatives
Use same above but for some, need to change initrd line from above to

   initrd (loop)/casper/initrd.gz 

Some developers use the simpler .gz instead of.lz to create the initrd.

Also some (older versions) use plain “vmlinuz” instead of “vmlinuz.efi”
Note vmlinuz.efi will apply for bios-legacy also for the live boots; just the naming change.

We can verify all these if we check inside of isofile with “mount -o loop” command.

Note:
Casper live boots allow persistent keep of changes with a partition properly labelled and a boot parameter added. Not with kernel changes though.


How make usb flash with 2 iso?
Data recovery after resizing partitions
#11

Finally tried this method and like it quite a lot.
LXQt 16.11 ISO boots this way, KDE 16.10 ISO however gives an endless loop of error messages:

INFO: No miso system found on /dev/sda1
INFO: No miso system found on /dev/sdb1
>>>ERROR: Could not mount /dev/sdc1

Not the exact wording, but s.th. with no miso
My Grub code:

menuentry "Manjaro KDE ISO 16.10.1"  {
    set isofile="/manjaro-kde-16.10.1-stable-x86_64.iso"
    set mlabel="MJRO1610"
    set archi="x86_64"
    set dri="free"
    search --no-floppy -f --set=root $isofile
    probe -u $root --set=8420b865-fc33-4c2f-985c-57776a094d0f
    loopback loop $isofile
    linux  (loop)/manjaro/boot/$archi/manjaro  img_dev=UUID=8420b865-fc33-4c2f-985c-57776a094d0f  img_loop=$isofile misobasedir=manjaro misolabel=$mlabel i915.modeset=1 logo.nologo overlay=$dri $dri=yes
    initrd  (loop)/manjaro/boot/intel_ucode.img (loop)/manjaro/boot/$archi/manjaro.img
}

The almost same code works for LXQt. Both ISOs are in the top directory of a CF card.
If you think it will take too much for troubleshooting I will move my question to a separate topic.
However, necrobumping here might revive the idea of booting an ISO directly.

Update: After updating grub (2.02.beta3-2 -> 2.02.beta3-3) the KDE ISO boots fine. Thanks for the guide!


#12

Glad you find it useful.

2 things.
o I find that it is best to have the isofile in a directory not in a raw partition

When I first started out booting isofiles (Manjaro was not around then), I faced some issues that the isofile is not detected (unless I put it in the partition where the boot grub is - which I find restrictive). Then I found it worked very well when I put in any partition provided it is placed in a directory.
I would think many here would put the isofile in a usb drive and that would also work well, provided you put in a directory in a partition in the usb drive).

o You used

probe -u $root --set=8420b865-fc33-4c2f-985c-57776a094d0f
linux (loop)/manjaro/boot/xxxxxxxxxxxxxxx img_dev=UUID=8420b865-fc33-4c2f-985c-57776a094d0f xxxxxxxxxxxxxx

. (this dot is necessary to have a break here - stupid bbcode thngy)

probe -u $root --set=abc
linux /xx/xxx/xx xxxxx img_dev=UUID=$abc xxxxxxxxxxxxxx

would be more…er ‘exact’, ‘simple’ and ‘direct’, I would think.
We just need to modify the first 4 "set xxxx=“yyyy” lines to work in all situations.
_And leave the rest of the lines unchanged.

Ps: I think (almost sure) the “no miso system” error is not due to grub versions (works for all versions) but most likely you did not put in in a directory, (and it works later for you because it finally found it when you install a new grub version because this grub is now changed to the the same partition as the isofile).

Nevertheless, glad you liked it. Also isofile booting from grub2 will work for all debian, ubuntu and derivatives and more.
Cheers.


#13

Or I can get rid of the line

if I pass the value to img_dev=UUID=8420b865-f....
As for placing the ISO on a partition, the whole behaviour is somewhat indeterministic. It worked for the LXQt ISO which is in the same place. What might be the reason is that I ran “Verify local date” with Transmission for the KDE ISO, maybe it repaired a broken Byte somewhere and Grub upgrade was only a coincidence. The CF card is also not my Grub drive where Grub sits in the MBR. Next time I will put the ISO file in a directory.


#14

Yes, you can but you will need to manually input the UUID (which can be error-prone).
“probe -u $root --set=abc” gets the UUID for you and the variable created is "$abc"
You can check with "echo $abc"
So all this already done for you without any manual input.

Note this line “search --no-floppy -f --set=root $isofile” will set root (grub root not / root) to the partition where the isofile is
and so “probe -u” will get that partition UUID

Better explanation here .


#15

Now got it :bulb:, thanks!


#16

Does the isofile have to be on the same partition as the system whose grub you are adding it to? Can you put the iso on a different, partition? If yes, how does the path change? Do you have to include the device name, like set isofile="/sda2/Manjaro/manjaro.iso"?


#17

No. Doesn’t have to be.
.
.

The path is set as shown in

or in

No. that same search command will look for the partition that it resides in. It will do the work for us.

Cheers.

ps: since I’m here, I’ll add to the first post on 2 things.
o uefi grub will boot and install in uefi and bios-legacy grub will boot and install in bios-legacy.
o the ‘new method’ installer derived from manjaro-architect will not work in this menuentry.


#18

Thanks for your quick reply!
I created custom.cfg, copied it into /boot/grub but for some reason it wont work. I also tried different locations for the iso, but not even the menuentry shows up in grub. What am I doing wrong?

menuentry "Manjaro Xfce 16.10.3 iso"  {
    set isofile="/manjaro-xfce-16.10.3-stable-x86_64.iso"
    set mlabel="MJRO1610"
    set archi="x86_64"
    set dri="free"
    search --no-floppy -f --set=root $isofile
    probe -u $root --set=abc
    loopback loop $isofile
    linux  (loop)/manjaro/boot/$archi/manjaro  img_dev=UUID=$abc  img_loop=$isofile misobasedir=manjaro misolabel=$mlabel nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=$dri $dri=yes
    initrd  (loop)/manjaro/boot/intel_ucode.img (loop)/manjaro/boot/$archi/manjaro.img
}

I don’t want to keep you, though, I just had some time and thought to play around with it.


#19

I’m trying now with KDE 17.0 because LXQT 17.0 won’t work.
Don’t know for sure if KDE 17.0 is like LXQT 17.0 in that LXQT now uses the new manjaro-architect (or what some people call the ‘netinstall’ installer - we better come up with a name everybody can agree on :grin: ).

I have to boot up the KDE 17.0 using dd or dvd to find out for sure (like I did for LXQT)
Anyway, I don’t think (not sure again, sorry) if the XFCE 16.10 is like the 'netinstall’
The menuentry looks alright but right now (I come back to you later - maybe a day later after I find out more about the 17.0) I can comment only on the custom.cfg.

It works for me and I’ve tested on Manjaro grub as well (because I use my own).

You can try to put anything, really anything, in /boot/grub/custom.cfg (just save the file after putting anything inside) and it appear at the bottom of grub menu when you boot up.

Oh… ‘update-grub’ (which isn’t necessary) or os-prober will not show these entries at all.

By the way, check in your /boot/grub/grub.cfg that the follwing is there.
This script will pull in anything you put into /boot/grub/custom.cfg.

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

I’ll leave here for now. i’ll come back later after I find more about the 17.0 iso versions.
The parameters are different, which is okay to fix, but it doesn;t seem to pull in the squash overlays to boot up.
(canonical path of overlays)

Cheers.


#20

I was using Xfce, but loaded from KDE’s grub. I reinstalled grub from Xfce, and now it’s all working.
Thanks for your detailed guides and explanations.