0

Ubuntu has a LiveCD version that is able to boot alongside the regular installation and is useful for tasks like repartitioning the system drive.

I am able to put the LiveCD onto a CD/DVD or USB media.

How can I put the LiveCD onto an internal hard drive such that it is installed alongside the main installation? I would imagine that it would be useful for performing such maintenance tasks as well as if I want to test software without persisting changes.

Note that from the installed LiveCD partition, I'd expect that it runs just as if I had booted it off a CD/DVD/USB in that it loads up a live environment and stores changes in memory without touching disks until I manually mount them.

4 Answers4

1

you can do exactly this, ubuntu has a step by step guide for doing it from linux, it involves making a new partition and setting up grub to read it as an operating system - https://help.ubuntu.com/community/Installation/FromLinux

1

Grub-n-ISO

You can boot from an iso file via grub in your installed system. It is possible to configure it in the file /etc/grub.d/40_custom and make it active by running

sudo update-grub

which copies its menuentry to /boot/grub/grub.cfg.

This is described in detail via the following links and links from them,

sudodus
  • 47,864
0

GUIDE TO BOOTING LIVE UBUNTU IMAGE FROM AN SSD WITH NVMe INTERFACE SPECIFICATIONS


This guide was tested with GRUB version 2.12-1ubuntu7.3 installed on a solid-state drive with NVMe interface specifications. System changes were made using the Ubuntu 24.04.3 LTS operating system.

Please read the text carefully and make a bootable USB stick/CD/DVD before applying any system changes.

Disclaimer: This guide was written for research purposes. The author have no responsibility for any consequences, including potential device brick, violating manufacturer licenses, lose device warranty etc.

Step 1. Create a 10GB Ext4 partition named "Image" via gnome-disks (optionally)

$ gnome-disks

Note: Creating a partition is optional. Learn more by clicking on the following link.

Step 2. Mount the partition manually

Step 3. Save the Live image (ISO file) in the target partition

Note: You can get the image you need by clicking on the following link.

Step 4. Use blkid command to display UUID identifiers

$ sudo blkid

Example:

/dev/nvme0n1p5: LABEL="Image" UUID="55555555-5555-5555-5555-555555555555" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Image" PARTUUID="11111111-1111-1111-1111-111111111111"

Step 5. Use lsblk or fdisk -l command to display partitions

$ sudo lsblk
$ sudo fdisk -l

Example:

nvme0n1     xxx:x    0   x,xT  0 disk 
├─nvme0n1p1 xxx:x    0   xxxM  0 part /boot/efi
├─nvme0n1p2 xxx:x    0  xx,xG  0 part /
├─nvme0n1p3 xxx:x    0 xxx,xG  0 part
├─nvme0n1p4 xxx:x    0    xxG  0 part 
└─nvme0n1p5 xxx:x    0   x,xG  0 part 

Note: For the nvme0n1p5 partition on the nvme0n1 disk, you will need to enter the text (hd0,5).

Step 6. Create a bootloader entry then save the changes

$ sudo nano '/etc/grub.d/40_custom'

Insert the following content:

# Live Image
menuentry "Live Image" {
          set isofile="/ubuntu-xx.xx.x-desktop-amd64.iso"
          set partition="/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"
          loopback loop (hdx,x)$isofile
          linux (loop)/casper/vmlinuz boot=casper layerfs-path=minimal.standard.live.squashfs iso-scan/filename=$isofile
          initrd (loop)/casper/initrd
}

Note: You will need to replace the text fragments ubuntu-xx.xx.x-desktop-amd64.iso, 00000000-0000-0000-0000-000000000000, hdx,x with the correct ones.

Example:

# Live Image
menuentry "Live Image" {
          set isofile="/ubuntu-24.04.3-desktop-amd64.iso"
          set partition="/dev/disk/by-uuid/55555555-5555-5555-5555-555555555555"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper layerfs-path=minimal.standard.live.squashfs iso-scan/filename=$isofile
          initrd (loop)/casper/initrd
}

Step 7. Update GRUB

$ sudo update-grub

Step 8. Edit the grub file then save the changes (optionally)

$ sudo nano /etc/default/grub

Add the following line: GRUB_SAVEDEFAULT=true
Replace the following lines: GRUB_DEFAULT=0, GRUB_TIMEOUT_STYLE=hidden, GRUB_TIMEOUT=0 with GRUB_DEFAULT=saved, GRUB_TIMEOUT_STYLE=menu, GRUB_TIMEOUT=3

Example (fragment of the final text):

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Note: Changes are necessary for easy access and use of the GRUB menu.

Step 9. Update GRUB

$ sudo update-grub

Step 10. Reboot your system

Step 11. Select the Live Image option in the GRUB menu then press Enter.




TROUBLESHOOTING


Problem: Screen tearing occurs during video playback.

Action:

  • Edit the custom.conf file

    $ sudo nano /etc/gdm3/custom.conf

    Comment (#) the line “WaylandEnable=false

  • Restart the GNOME Display Manager

    $ sudo systemctl restart gdm3

  • Try using Wayland instead of Xorg.




ADDENDUM


Bootloader entries for Kali Linux Live image

For normal mode:

# Kali Linux Live
menuentry "Kali Linux Live" {
          set isofile="/kali-linux-xxxx.x-live-amd64.iso"
          loopback loop (hdx,x)$isofile
          linux (loop)/live/vmlinuz boot=live components quiet splash findiso=$isofile
          initrd (loop)/live/initrd.img
}

For a mode similar to “Forensics”:

# Kali Linux Live (toram noswap noautomount)
menuentry "Kali Linux Live (toram noswap noautomount)" {
          set isofile="/kali-linux-xxxx.x-live-amd64.iso"
          loopback loop (hdx,x)$isofile
          linux (loop)/live/vmlinuz boot=live components quiet splash findiso=$isofile toram noswap noautomount
          initrd (loop)/live/initrd.img
}

Note: Was tested with kali-linux-2025.2-live-amd64.iso. You can get the image you need by clicking on the following link.
Note: You will need to replace the text fragments kali-linux-xxxx.x-live-amd64.iso, hdx,x with the correct ones.




REFERENCES


0

All maintenance software in the Live CD can be installed into your existing Ubuntu installation too. Take GParted partition manager for example, you can install it by executing this in terminal: sudo apt-get install gparted. You can perform operation such as resizing or deleting partitions from Ubuntu itself using GParted: right click on target partition (except the current Ubuntu partition itself) and unmount it, then you can modify the partition. Do be careful when working with partitions.

If it is the Ubuntu partition itself you want to modify, then you will either have to use a Live CD or Live USB. Or being fancy, you can have multiple Ubuntu installation in the same hard disk on a different partition from the first Ubuntu installation. By default Ubuntu doesn't mount any partition automatically anyway.

Even more fancy (and safer), would be to boot the Live CD disc image from virtualbox, then do an install for messing around with all Linux goodness safely. Have fun!

  • "multiple Ubuntu installation in the same hard disk on a different partition from the first Ubuntu installation" is exactly what I am looking for. Although I want it to be minimal and volitile just the same as the LiveCD such that no changes are persisted. That partition shouldn't need to be much bigger than the LiveCD itself. I don't want a full normal install in the second partition. – arcyqwerty Oct 26 '14 at 20:14
  • I see. That's easily done. Do a full Ubuntu install on another partition (sized bigger than Live CD to accommodate the temporary changes, e.g. add 1GB if u intend to test software that consume that much for install and other additional files). Then enable Guest session and login using the Guest account whenever you want things to be reset after logging out. More details here: https://help.ubuntu.com/community/CustomizeGuestSession – Ronald Chua Oct 27 '14 at 16:43