• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Linux Run a LiveCD (Linux) without Burning to disk or mount to USB

Steve Albert

Banned User
Joined
Dec 9, 2018
Messages
267
Solutions
13
Reaction score
104
This is a topic I haven't seen yet on the forum but it is an important topic because not everyone likes to or can work in the standard Ubuntu.

On my laptop I don't have a cd/dvd drive. All I have is 3 usb ports but I only have 1 physical usb to play with and I have a lot of different versions of Linux that I would like to try out. I could just install every version of linux I have on my hard as a single or multi-boot setup but that would be too much especially if I don't like any particular version.

So I came up with this idea to use the grub2 boot loader to load & install the live cd (iso files) of linux at boot time into ram just as a physical LiveCD does.

** Important **
You need a minimum of ram that exceeds the size of the iso. So if the iso you want to boot from is 1.6 GB you should have at least 2 gigs of ram to work with.

Linux
1. First thing we'll do is download a version of linux that pretty much anyone can run Ubuntu Studio 16.04 (Xenial Xerus). This version of Ubuntu has a low latency kernel & is built for developers who work in graphics, sound & video editing but you can also compile & run TFS, the otclient, the rme map editor and even a webserver with database support. It is a decent testing environment for people with low end machines.

2. Once we have the iso file open up a terminal and type
Bash:
sudo blkid
It will then ask you for sudo's password
Bash:
[sudo] password for <username>:

Enter the password and then you will see something similar to this.
Bash:
/dev/sda1: UUID="a629c5a0-7700-41cf-9b79-bcfdb72d291e" TYPE="ext4" PTTYPE="dos" PARTUUID="2cd8498a-01"
/dev/sda2: UUID="56f8494d-3b4d-47e6-b963-78b92fdfdc75" TYPE="swap" PARTUUID="2cd8498a-02"
/dev/sda3: LABEL="backup" UUID="672EEBE04B167493" TYPE="ntfs" PARTUUID="2cd8498a-03"

We are going to use this information as a reference for the linux iso's
The next thing we'll need to do is edit the grub2 boot menu; in the terminal type
Bash:
sudo nano /etc/default/grub
You can copy the above command by selecting it here and paste it into the terminal with CTRL+SHIFT+V
The grub file should look something like this
Code:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Place a hash tag (#) in front of this line
Bash:
GRUB_HIDDEN_TIMEOUT=0
So your entry should look like this
Bash:
#GRUB_HIDDEN_TIMEOUT=0

To save the file hold CTRL and hit X it will ask you to confirm the save and then it will close the file.

While still in the terminal type
Bash:
sudo update-grub
This will update the boot-loader.

If you don't want to make any changes to grub then you can hold the SHIFT when you are booting up your machine to access the grub boot menu.

Right click the iso that you downloaded and select open with "Archive Manager" look for a folder labeled "casper" open up that directory and search for 2 files one labeled vmlinuz & initrd we want to the know if the initrd file has an extension and what is it. If it doesn't then just exit the program.

Head back to the terminal and type
Bash:
sudo nano /etc/grub.d/40_custom

When you open the file you should see something like this
Bash:
#!/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.

Placing a menu entry in this file will load when the grub boot menu loads. (every time you make a change and save it you have to update grub)
Bash:
menuentry "Ubuntu Studio 16.04.5 LTS - ISO" {
set isofile="path_to_iso"
loopback loop  (hdX,n)$isofile
linux (loop)/live/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject toram --
initrd (loop)/live/initrd.gz
}

Where is says set isofile="path_to_iso" replace that with the location of the iso where you saved it.
An example is
Bash:
set isofile="/ISO/ubuntustudio-16.04.5-dvd-amd64.iso"

Where it says loopback loop (hdX,n)$isofile you are going to replace the letter n with the number of your partition. If we refer back to the output of sudo blkid we can see the different partitions and their numbers. Since I am storing my iso's in my backup partition i would replace n with the number 3. I get the number 3 from this information /dev/sda3. Where it says X your going to replace X with the number of your hard drive you can determine this information by converting the letter a to 0, b to 1, c to 2...
Bash:
loopback loop  (hd0,3)$isofile

In the end my setup for this menu entry will look like this
Bash:
#!/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 "Ubuntu Studio 16.04.5 LTS - ISO" {
set isofile="/ISO/ubuntustudio-16.04.5-dvd-amd64.iso"
loopback loop  (hd0,3)$isofile
linux (loop)/live/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject toram --
initrd (loop)/live/initrd
}
When your done hold CTRL+X to save & exit; open up the terminal and type
Bash:
sudo update-grub

To test this out and reboot the machine type
Bash:
sudo reboot

When the grub menu loads the last entry will be Ubuntu Studio 16.04.5 LTS - ISO if you select it it will load the iso file where you can select try it and boot up the iso into your ram.

Trouble Shooting
If you install a new version of linux and end up booting into the grub rescue then type
Bash:
ls

You will see a listing similar to this
Bash:
(hd0,msdos1) (hd0,msdos2)...

Just type
Bash:
ls (hd0,msdos1)/

What your looking for is a folder labeled boot, if you happen to find it type
Bash:
# assuming its on hd0,msdos1
set prefix=(hd0,1)/boot/grub
set root=(hd0,1)
insmod normal
normal

The computer will then boot up; open up a terminal and type
Bash:
sudo upgrade-grub
sudo grub-install /dev/sda

If anyone knows of a better to approach this I would be happy to hear from you.
 
Last edited:
I made a windows installation version of this but its a little risky because it requires a certain partition segment makeup.
 
I made a windows installation version of this but its a little risky because it requires a certain partition segment makeup.
is up to date in your main post? i use windows cause i need it atleast in my college and i own only one pc. where is it?
 
Back
Top