10

A person has a computer with no HDD but 16GB RAM and USB3 port.

Also has 16GB USB3 pendrive with Ubuntu Live on it, (Non persistent).

The computer is then started with the pendrive using toram.

The pendrive is then removed and reinserted while the O/S is running.

Is the O/S that is running in RAM able to do a "Full" install to the pendrive?

This was asked in:

Can I install Ubuntu onto a USB flash drive using the SAME flash drive?

However for some reason this unique question was marked as "Duplicate".

4
  • 3
    I think so. When the content of the boot drive is copied to ram, it is no longer mounted (and can be removed). Then it depends on the installer, if it understands the situation or 'remembers' from where it was booted. I have not tried, but I would be very happy to know. Please try and share your experience :-) (This case is different from a persistent live system with the casper-rw partition on the boot drive as you hint in your question.)
    – sudodus
    Nov 29, 2016 at 18:39
  • 1
    Thank you Sudodus, I am a little worried about yanking the pendrive if it is being written to, perhaps OK if it is non-persistent. Nov 30, 2016 at 1:55
  • 2
    Yes a non-persistent pendrive. I don't think you would destroy the pendrive itself, probably the worst case is that the partition table or file system would be borked, but it can be fixed after wiping the first megabyte with mkusb :-)
    – sudodus
    Nov 30, 2016 at 5:14
  • 1
    I didn't yank it, only rebooted :-)
    – sudodus
    Nov 30, 2016 at 10:09

1 Answer 1

16

I was too curious to wait for you to check if it works. So I tried and here is my result:

Yes, it works with the following recipe :-)

  • Create a live-only drive by cloning ubuntu-16.04.1-desktop-amd64.iso to a 32 GB USB 3 pendrive with mkusb

  • Add the boot option toram and boot

  • When running live, unmount all mounted partitions in the pendrive (in this case it was only one), run in a terminal window

      sudo umount /media/{and press the TAB key for 'tab completion'}
      # or
      sudo umount /media/*/*  # if more than one partition
    

    Check that all partitions on the pendrive are unmounted with

      df
    
  • Start the installer with the desktop icon

  • Follow the instructions like any other installation

  • Reboot

I did it in a laptop computer with 4 GiB RAM in BIOS mode without any internal drive.

If there is an internal drive, things may be more tricky in order to avoid writing bootloading things to the internal drive, but this is not due to the fact that it is installed to the same drive as the system was booted from.

-o-

Edit 1: I tested in UEFI mode. The final 'Reboot' got stuck at the plymouth 'five dots'.

  • I waited for a couple of minutes and could finish gracefully with SysRq r e i s u b

and when rebooted, the installed system works. A better alternative is to

  • 'Continue testing' instead of reboot

  • Flush the buffers in a terminal window

      sync
    
  • Reboot the live system

and it finishes and reboots beautifully.

-o-

Edit 2: You find help how to add the boot option toram at this link,

How to unmount a live DVD/USB?

Edit 3: Install Lubuntu Mantic to the same drive as you booted live from

Lubuntu uses the installer Calamares, and the version [of Lubuntu] is newer than what is described above, so there are a few more things to fix:

  • boot with the boot options toram and nopersistent
  • unmount the mounted partitions on the USB drive
  • install gparted and create a fresh GUID partition table, GPT (no partition).

Now the installer is happy to install Lubuntu Mantic (23.10) into the USB drive, and the installed system works well.

Comment: I could have used an already available text mode tool to create a fresh GPT partition table, but gparted is convenient.

More details at Lubuntu Discourse

6
  • 3
    Well done Sudodus, I have not seen this solution posted anywhere on the Internet. And to think the answer might have been lost due to the overzealousness of the Duplicate Post Police on the referenced question. I hope they eventually learn to read both questions before calling one a duplicate. Dec 1, 2016 at 3:44
  • Why does the drive have to be live only? Aug 29, 2021 at 17:52
  • Will this work with Ubuntu 21.04? How do we add the boot option toram? Aug 29, 2021 at 18:03
  • @JohnSmith, The system that you want to install from must be live-only, because the alternative, a persistent live system is tied to a partition, that cannot be unmounted. (And installed system have no installer to run). I have not tested it in 21.04, but I think it can work. However, if you make a mistake, and fail to make a working system, you have start from the beginning and make the USB drive a live drive again. So it is much better to get (borrow or buy) a USB pendrive. A cheap 4 GB pendrive is good enough to install from (while installing to another drive (internal or external).
    – sudodus
    Aug 29, 2021 at 22:21
  • Today, with Ubuntu 22.04.1 LTS, a partition labeled 'writable' might be mounted, and you don't want that. So boot with the boot options toram and nopersistent to avoid that, and then you can unmount also that partition. Maybe you want to keep the live system. Then you can put the installed system into the partition labeled 'writable'.
    – sudodus
    Sep 11, 2022 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .