Run Kali Linux , BackBox and Gentoo Distrubutions Directly from Hard Disk in Ubuntu 14.04 using Grub Menu

Most of Linux distributions provide ISO files that are designed and build to run in Live mode directly from a bootable media such as CD /DVD, Flash/USB cards or even directly form an Hard Drive using Linux Grub menu without the need to burn it to an CD/DVD or create a bootable USB.

Run Linux From Hard Disk

Run Linux From Hard Disk

This tutorial will concentrate on presenting a way you can run some Linux ISO distributions directly from your hard disk by editing Ubuntu 14.04 GRUB2 menu which is the default boot loader in most modern Linux distributions, which provides a faster way of using a Linux Operating System, and also has a great impact on privacy because all your settings and live sessions are not preserved by default.

The distributions presented in this topic are: Kali Linux 1.0.7, Backbox 3.13 and Gentoo Live DVD.

Requirements

Ubuntu 14.04 ( or any other Linux distributions with GRBU2 boot loader) installed on your system hard drive.

  1. Ubuntu 14.04 Installation Guide

Step 1: Download required ISO files

Kali Linux, formerly known as BackTrack Linux, is the most advanced Operating System for security and penetration testing, based on mainstream Debian, which provides a great deal of forensics and penetration testing programs, developed by Offensive Security Ltd, who recently released their last version 1.0.7.

Download Kali Linux
  1. http://www.kali.org/downloads/

BackBox is an alternative distribution for Kali Linux, based on Ubuntu, who uses XFCE as a Desktop Environment, build to run fast and easy to use and provides tools for penetration and security tasks.

Download BackBox
  1. http://www.backbox.org/downloads

Gentoo is the most versatile Linux distribution designed for professionals who uses source code packages complied locally, has a complex and difficult installation procedure for newbies but provides an excellent Live DVD for testing purposes.

Download Gentoo
  1. http://www.gentoo.org/main/en/where.xml

Step 2: Add ISO Images to GRUB2 Menu

1. After you have downloaded your favorite ISO Live DVD, open Ubuntu Nautilus with root privileges using ‘sudo nautilus‘ command from Terminal and create a directory called live in your system root path and move ISO file to this folder.

Create Live Directory

Create Live Directory

Copy ISO Files to Live Directory

Copy ISO Files to Live Directory

2. To continue further will need to provide Grub2 with our disk partition UUIDUniversally Unique Identifier (partition where ISO files are located). To get partition UUID run the following commands.

$ sudo blkid
## For automatically mounted partition or hard disks  on system boot ##

$ sudo cat /etc/fstab   
Get Partition UUID

Get Partition UUID

Confirm Partition UUID

Confirm Partition UUID

3. Another method to get your partition UUID is, to open visualize grub.cfg file content located in /boot/grub/ path and search for –fs-uuid string (in case you don’t have a separated partition for /boot).

Open grub.cfg File

Open grub.cfg File

Verify Partition UUID

Verify Partition UUID

4. After you obtained your root partition UUID code move to /etc/grub.d/ directory, open 40_custom file for editing and add the following lines at the bottom of this file.

menuentry 'Kali Linux 2014 Live' --class os --class gnu-linux --class gnu --class os --group group_main {
                set isofile="/live/kali-linux-1.0.7-amd64.iso"

         insmod ext2
         insmod loopback
         insmod iso9660      
                loopback loop (hd0,msdos1)$isofile      
                search --no-floppy --fs-uuid --set=root 59036d99-a9bd-4cfb-80ab-93a8d3a92e77                            
                linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda1/$isofile noconfig=sudo username=root hostname=kali
                initrd (loop)/live/initrd.img
}
Add Kali Linux Boot Kernel Parameters

Add Kali Linux Boot Kernel Parameters

Verify Kali Linux Boot Kernel Parameters

Verify Kali Linux Boot Kernel Parameters

Here the following directives represents:

  1. set isofile = A variable the holds ISO system path location.
  2. (hd0,msdos1) = First partition from first hard disk (In Linux disks are numbered starting with 0) – the same as /dev/sda1.
  3. –fs-uuid –set=root 59036d99-a9bd-4cfb-80ab-93a8d3a92e77 = First partition from first hard disk UUID code.
  4. linux and initrd = Custom kernel booting parameters – they are different depending on every Linux distribution.

5. After you finish editing file update grub to add the newly ISO (in this case Kali Linux) to your Grub2 menu. To verify it open /boot/grub/grub.cfg and search at the botton for your ISO entry.

$ sudo update-grub
Update Grub to Add ISO Images

Update Grub to Add ISO Images

Verify ISO Images Entry

Verify ISO Images Entry

6. To run Kali Linux Live ISO reboot your computer, select Kali Linux entry from GRUB menu then press Enter key.

Select Kali Linux From Grub Menu

Select Kali Linux From Grub Menu

Booting Kali Linux Live ISO

Booting Kali Linux Live ISO

Kali Linux Desktop

Kali Linux Desktop

7. If you don’t have enough free space on your root partition, to host other Linux ISO files you can add another hard disk and move all your Linux distribution ISO files there. After you create an partition and add a file system mount it on /mnt path to make it available.

$ sudo mount /dev/sdb1 /mnt

8. Then move all ISO on the new hard disk and grab its UUID using blkid command.

$ sudo blkid
Move ISO Images and Verify UUID

Move ISO Images and Verify UUID

Verify All ISO Images

Verify All ISO Images

9. Again open and edit /etc/grub.d/40_custom grub file and add the following entries.

For BackBox Live DVD
menuentry 'Backbox Live ISO' --class os --class gnu-linux --class gnu --class os --group group_main {
                set isofile="/backbox-3.13-amd64.iso"
                loopback loop (hd1,1)$isofile
                linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
                initrd (loop)/casper/initrd.gz
}
For Gentoo Live DVD
menuentry 'Gentoo Live DVD ISO' --class os --class gnu-linux --class gnu --class os --group group_main {
                set isofile="/livedvd-amd64-multilib-20121221.iso"
                loopback loop (hd1,1)$isofile   
                linux (loop)/boot/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=/boot/gentoo.igz isoboot=$isofile
                initrd (loop)/boot/gentoo.igz

}
Add BackBox and Gentoo Boot Kernel Parameters

Add BackBox and Gentoo Boot Kernel Parameters

10. Then update your GRUB menu again with ‘sudo update-grub‘, reboot your computer and choose your preferred Linux distribution ISO from GRUB menu.

Select Gentoo from Grub Menu

Select Gentoo from Grub Menu

Booting Gentoo Live ISO

Booting Gentoo Live ISO

Gentoo Desktop

Gentoo Desktop

Select BackBox from Grub Menu

Select BackBox from Grub Menu

Booting BackBox Live ISO

Booting BackBox Live ISO

BackBox Desktop

BackBox Desktop

Now you can use Kali Linux, BackBox or Gentoo live ISO images directly from your hard disks without the need to burn it to a DVD but you can, also, add other Linux Live ISO distribution images to GRUB2 menu using the same procedure but pay attention to every distribution Live Kernel booting parameters which can be inspected by mounting the ISO image using mount -o loop option or consult distribution Wiki pages.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

21 Responses

  1. Saurabh Sugandh says:

    Does it work for other distros? Can I do it in my manjaro for backbox?

  2. Ruben says:

    Does anyone know how to make this iso persistent?

    I used this to boot and works for me.

    menuentry ‘Kali Linux 2014 Live’ –class os –class gnu-linux –class gnu –class os –group group_main {
    set isofile=”/live/kali-linux-1.1.0a-amd64.iso”
    insmod ext2
    insmod loopback
    insmod iso9660
    loopback loop (hd0,msdos2)$isofile
    search –no-floppy –fs-uuid –set=root 07c0e976-866d-49f6-9ac7-018b5b4d9a8a
    linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda2/$isofile noconfig=sudo username=root hostname=kali
    initrd (loop)/live/initrd.img
    }

  3. Six2Dez says:

    Hey guys,
    Great article!! It works fine for me (Ubuntu Gnome 14.04).
    Only 1 more question, how can I know (or find) the linux and initrd section for other kind of live distros?
    Thanks a lot!

  4. charles says:

    hi guys im running ubuntu 14.04 (hd0,gpt7) the thing is when I launch kali there’s an error that pops up

    Begin: Mounting root file system …/init: .: line 224: cant open ‘ /scripts/Live’
    kernel panic – not syncing: attempted to kill init!

    please help me

  5. Tafari says:

    nice, but just wondering will this work for kali 1.0.9? thankyou

  6. madkongo says:

    forgot to add my current 40_custom config
    my grub file shows: hd1,msdos5

    menuentry ‘Kali Linux 2014 Live’ –class os –class gnu-linux –class gnu –class os –group group_main {
    set isofile=”/live/kali-linux-1.0.9a-amd64.iso”

    insmod ext2
    insmod loopback
    insmod iso9660
    loopback loop (hd1,msdos5)$isofile
    search –no-floppy –fs-uuid –set=root b86769fa-9af1-4d92-b8f0-dc528f9a0f0f
    linux (loop)/live/vmlinuz boot=live fromiso=/dev/sdb1/$isofile noconfig=sudo username=root hostname=kali
    initrd (loop)/live/initrd.img
    }

    menuentry ‘Backbox Live ISO’ –class os –class gnu-linux –class gnu –class os –group group_main {
    set isofile=”/backbox-4.0-amd64.iso”
    loopback loop (hd1,5)$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
    initrd (loop)/casper/initrd.gz
    }

  7. madkongo says:

    hey
    first of all thx for the tutorial, but i do have a problem.
    i did manage to add the kali linux to the grub menu
    but after i pick it it simply restarts my computer and comes back to the grub menu
    and ideas on how to fix?

  8. Waheed says:

    Dear, can we use the same ubuntu partition for persistance live kali linux, without creating another partition?

Leave a Reply to Waheed Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.