2

i want boot ubuntu iso file pure from ramdisk/memdisk so hdd only used for copying or extracting the iso image to ramdisk, so partition is not locked by system cause used by iso file.....i was read to using memdisk but failed with error message kernel must load first

My grub2 Config :

menuentry "Ubuntu Desktop 20.04" --class ubuntu {
        insmod ntfs
        insmod memdisk
        set isoDRV=(hd2,gpt2)
        set isoDIR="/ISO-SOFT/OS/LINUX"
        set IsoFILE="ubuntu-20.04-desktop-amd64.iso"
    ## i just try this but fail :(
    linux16 memdisk $isoDRV/$isoDIR/$IsoFILE 
    initrd16 (memdisk)/casper/initrd
  }

can this be done as I mean?

Mortred
  • 48
  • The Desktop Installer's "Try Ubuntu" environment seems to match your description. It's an Ubuntu .iso, works from RAM, does not mount/lock any partitions. If you have additional criteria, please edit your question to add it. – user535733 Jun 27 '20 at 13:40
  • 1
    See https://askubuntu.com/questions/1251729/20-04-booting-iso-from-grub-menu – heynnema Jun 27 '20 at 13:49
  • i not have problem to boot ubuntu from iso file directly using loopback method...but partition will locked if using that method... i just wanna find solution how to extract iso file to ramdrive from grub so i can boot without locking partition – Mortred Jun 27 '20 at 14:48
  • Why do you want to boot without locking the partition? Would it be OK with some other configuration (to clone the iso file to a partition instead of using the iso file directly)? That way you can use the boot options toram and nopersistent, and your drive will be released. I know this, because it works with persistent live drives made by mkusb. – sudodus Jun 27 '20 at 15:23
  • i was try with toram parameter linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$IsoFILE toram noprompt noeject but still locking partition.. i will try with nopersistant can u send me link all parameter can be passed booting from iso file ? – Mortred Jun 27 '20 at 16:21
  • toram does not work when booting from an isofile (at least I don't know how to make it work). But it works when booting from a partition with an image (with the file system iso9660) as I described in my previous comment. You can see how it looks and works in a separate drive made persistent live with mkusb, and then implement something similar in your current drive. – sudodus Jun 27 '20 at 16:24
  • @heynnema: I recall that we did have toram working with that procedure. – C.S.Cameron Jun 28 '20 at 03:15
  • @C.S.Cameron yes toram working on iso mode as well but still locking partition even i add nopersistant parameter – Mortred Jun 28 '20 at 06:02
  • @mortred Please see my answer. It is a little uncouth but worked for me. – C.S.Cameron Jun 28 '20 at 07:29
  • @mortred, Why do you want to boot without locking the partition? Please tell us what you want to do. Maybe there is a way to do it without unmounting the isodevice partition. For example, you are allowed to write into it (with sudo on its top level, but if it is an ext4 partition, you can create directories, and set permissions, that allow the default user ('ubuntu' in Ubuntu live) to read,write etc in those directories). – sudodus Jun 28 '20 at 07:53
  • @mortred: I wrote a new answer that uses Ask Ubuntu accepted methods to unmount a partition. – C.S.Cameron Jun 28 '20 at 08:24
  • 1
    @sudodus cause my iso partition is external hdd i want after ubuntu boot i can safe to remove my external hdd and also to avoid data corruption from my external hdd – Mortred Jun 29 '20 at 06:27

1 Answers1

2

Experience with Booting ISO file toram

I booted a Ubuntu ISO file using GRUB2 with the following menuentry.

menuentry "Ubuntu 20.04 ISO" {
    rmmod tpm
    set root=(hd0,3)
    set isofile="/isos/ubuntu-20.04-desktop-amd64.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile persistent persistent-path=/ub2004-1/ fsck.mode=skip quiet splash toram -- 
        initrd (loop)/casper/initrd
}

Opened Nautilus and entered sudo umount -lrf /dev/sdxy Where sdxy is the partition containing the running ISO file.

Then opened Nautilus and clicked the little triangle on the left next to a partition on the ISO's USB.

Received a message that it was safe to remove the drive. I did so.

Then plugged the USB drive back in and proceeded to modify the unlocked partition.

When work was complete shut down the computer as normal.

C.S.Cameron
  • 19,519
  • For reference my ISO is on a NTFS partition that is accessible to Windows and Linux. – C.S.Cameron Jun 28 '20 at 08:26
  • +1; My comments: 1. Nice that this works :-). See also oldfred's answer using the sledgehammer options -lrf (Easy to remember for me bcause LRF is the national organisation of farmers in Sweden); 2. The isodevice (where the iso file is stored) works better for me, when I use an ext4 file system. Some of my test computers get stuck at shutdown, if I use NTFS for the isodevice. I can use another partition for transfer of data to and from Windows. – sudodus Jun 28 '20 at 09:04
  • I will give sudo umount -lrf /isodrive a try. – C.S.Cameron Jun 29 '20 at 03:32
  • 2
    @sudodus: sudo umount -lrf /isodrive did not work for me.. When I boot an Ubuntu ISO file the ISO directory becomes "isodevice", sudo umount -lrf /isodevice did work, but I am not sure of the advantage of adding the "rf", unless -l fails to unmount. – C.S.Cameron Jun 29 '20 at 04:47
  • 1
    sudo umount -lrf /dev/sdxy work for me thanks – Mortred Jun 29 '20 at 06:28