Is there any easy way to install a Linux distribution directly to a USB drive?
from john89@lemmy.ca to linux@lemmy.ml on 06 Sep 2024 23:06
https://lemmy.ca/post/28455288

I want to install Debian directly onto my USB drive. Is there an easy way to do this directly without having to reboot to run the installer?

#linux

threaded - newest

some_guy@lemmy.sdf.org on 06 Sep 2024 23:17 next collapse

Copy a live cd iso using dd.

bjornsno@lemm.ee on 07 Sep 2024 17:54 collapse

This doesn’t really install it, though, you can’t update or permanently edit and config, set up users, or anything like that. I would guess OP wants something more like booting the ISO in a VM, allocating a thumb drive to that VM, and then installing a full system to it with a boot loader.

Kalcifer@sh.itjust.works on 06 Sep 2024 23:33 next collapse

without having to reboot to run the installer?

I’m not sure that I understand what you mean. Are you saying that you want to be able to load the OS without having to reboot your computer? Or are you saying that you just don’t want to have to click the equivalent of “try the OS” when booting a live USB? If it’s the latter, you should be able to just select the flash drive as the install point (though, tbc, I have never tried this, but I don’t see why it wouldn’t work) (I think you’d need 2 USBs, though — you’d need 1 to be the installer source, and one to be the install point — I don’t think theres any installer that can run as a desktop application. Though, if it’s Arch Linux, you might actually be able to call pacstrap from the host OS — I’ve never tried this after having already installed the OS). There’s even OS’s that are specifically designed to be ephemeral on hardware in this way — eg Tails OS.

NaibofTabr@infosec.pub on 06 Sep 2024 23:37 next collapse

PenDriveLinux or rufus or balena etcher (frequently just referred to as “etcher”) or just dd.

taaz@biglemmowski.win on 06 Sep 2024 23:39 next collapse

So the lower-ish difficulty answer would be to run the iso installer in a VM with the usb stick forwarded to that VM.

Or you can learn what those fancy installers do: on debian you would use debootstrap

Here seems the whole guide on how to install debian manually with it:
gist.github.com/tr3buchet/6407920

Btw, this is also basically how you install Arch. As of until recently there wasn’t any installer and you had to go through each step manually (create partitions and fs, install the base system with <insert distro specific tool>, chroot, update fstab, distro specific finishing touches, voilà)

lud@lemm.ee on 07 Sep 2024 22:57 collapse

Depending on what OP actually wants to do it might be simpler to just install Linux normally in a VM. I recommend Hyper-v if you are using Windows Pro and if you are using Windows Home I recommend upgrading to Pro using MAS scripts or using a workaround to install Hyper-V on Home.

You could also use a hypervisor like virtualbox but they are type 2 hypervisors which are usually slower compared to type 1 like Hyper-v or KVM.

sndmn@lemmy.ca on 07 Sep 2024 00:41 next collapse

Yes

Pogogunner@sopuli.xyz on 07 Sep 2024 00:56 next collapse

I installed from one flash drive with the image (on ventoy) to another flash drive that was plugged in to be the boot drive. On a cheap USB2 drive, it’s unusably slow - so make sure you use the fastest drive you can

thanks_shakey_snake@lemmy.ca on 07 Sep 2024 11:12 collapse

+1 for “it’s unusably slow!”

I tried this last year with Linux Mint, and I learned that a normal USB drive just doesn’t have the read/write speed to even e.g. operate Firefox smoothly. There are different ways to address that, none of which really did the trick for me, so the best bet is to just get a drive with the fastest read/write rate possible. I’ve heard that it can run tolerably well on one of those more performant drives, but I didn’t try it myself.

Hule@lemmy.world on 08 Sep 2024 15:28 collapse

USB SSDs are way faster!

BigDotNet@lemmy.ml on 07 Sep 2024 01:04 next collapse

Boot from one USB then install into another USB, IDK exactly how the booting will work, I believe you will have to install the boot manager into the USB and then in the machine you want to use your OS you should boot from the same USB.

Never did it but I believe that’s the way it should be.

mycodesucks@lemmy.world on 07 Sep 2024 08:12 collapse

This works. I ran a linux distro in off hours on my work laptop for years this way.

sic_semper_tyrannis@lemmy.today on 07 Sep 2024 01:31 next collapse

I used to have a SanDisk Extreme Portable running Ubuntu. If it was unplugged, my computer would boot Windows and when I plugged in the SSD to USB it would auto boot into Ubuntu. I have no idea how I did it though. It was my first time using Linux and I followed a guide online.

Edit: found the video

Magister@lemmy.world on 07 Sep 2024 02:59 next collapse

MX Linux (debian based) works perfectly on a usb drive

CynicusRex@slrpnk.net on 07 Sep 2024 03:34 next collapse

Ventoy.

QuazarOmega@lemy.lol on 08 Sep 2024 10:44 collapse

nuff said.

ikidd@lemmy.world on 07 Sep 2024 05:56 next collapse

MX Linux and it’s predecessor (can’t recall the original version) is a Debian distro that will run with a persistence cache on a USB stick.

spittingimage@lemmy.world on 07 Sep 2024 07:37 next collapse

Fatdog is Debian by way of Ubuntu designed to run from a USB drive. There’s documentation on the website.

eugenia@lemmy.ml on 07 Sep 2024 07:59 next collapse

Linux mint will install and run from a usb drive as long as you unmount it upon loading its live version. Then it will allow to install on it during the installation procedure. I have an old Mac Mini and an old Macbook Air running Mint 22 that way.

MonkderVierte@lemmy.ml on 07 Sep 2024 09:48 next collapse

Rufus. Best for unlocked Windows images btw.

lattrommi@lemmy.ml on 07 Sep 2024 09:52 next collapse

directly onto my USB

directly without having to reboot to run the installer?

You use “directly” three times. Remove all instances of the word from your post and reread it. Does the post make sense to you still? Does it have the same meaning?

I am not trying to be a dick, I want to make sure the word does not have a meaning I am not aware of in this context or if Linux is installable to a USB drive ‘indirectly’ but that does not make sense to me.

Can you rephrase what you are trying to do?

john89@lemmy.ca on 07 Sep 2024 18:02 collapse

I want to install Debian on the USB drive from my currently running OS, Manjaro Linux.

I don’t want to have to boot from Debian installation media to install it on the USB drive.

possiblylinux127@lemmy.zip on 08 Sep 2024 17:28 next collapse

You could use the Debian cloud image. Just download the “no cloud” option and then grow the partitions

lattrommi@lemmy.ml on 10 Sep 2024 15:18 collapse

I am using Manjaro as well.

Are there Debian apps that you want to run but are unable to because Manjaro is Arch-based? I have read that it is not recommended to install programs compiled for Debian, that it is difficult to run them. Using a virtual machine is the recommended way to use them. Asking just in case but I do not think this is what you want.

Computers can only run one operating system at a time, unless you use virtual machines and hypervisors. Most operating systems are launched after the system uses a bootloader to get the system ready for the operating system. This is usually done by the BIOS/UEFI/firmware starting a bootloader, which then launches the operating system.

If you want a USB that you can plug into a machine that is already running, that has an active operating system like Manjaro or Windows or whatever, then have it start running Debian, like you would an Appimage or a Windows .exe program saved to a USB, that is not possible except maybe with a virtual machine program like Virtual Box or Qemu.

USB drives were not intended to be used as drives that run operating systems. It can be done, but it is not simple and can cause a lot of errors.

What do you need the USB for? If you can explain what you are trying to achieve with more detail, there might be ways to do it differently.

bizdelnick@lemmy.ml on 07 Sep 2024 09:54 next collapse

Yes. Just partition the drive manually, install packages with debootstrap, bind-mount /proc, /sys and /dev, chroot into it and install a bootloader. If you don’t understand what I say, you have to run an installer, possibly in a VM.

[deleted] on 07 Sep 2024 18:18 next collapse

.

possiblylinux127@lemmy.zip on 08 Sep 2024 17:28 next collapse

Don’t do that

You can but it will be very slow and your drive will die quickly. Alternatively you could make a USB drive with MX Linux and then only save what you need.

tetris11@lemmy.ml on 08 Sep 2024 18:14 collapse

If the system you have has enough RAM you could load the entire OS to RAM and then change the writeback settings to a high interval

possiblylinux127@lemmy.zip on 08 Sep 2024 18:18 collapse

Still going to bottleneck and then eventually die

tetris11@lemmy.ml on 08 Sep 2024 18:41 collapse

dunno, the system might ran out of RAM due to lack of swap, but the drive should be fine due to the limited writes

possiblylinux127@lemmy.zip on 08 Sep 2024 20:08 collapse

Well no because the cache will fill up faster than writes that are happening. You would be postponing the inevitable.

The only option is to either reduce the number if writes by using MX Linux on the USB or to get something that can handle the writes like a USB NVMe enclosure

tetris11@lemmy.ml on 09 Sep 2024 06:11 collapse

ah good point

mfat@lemdro.id on 08 Sep 2024 21:11 collapse

Buy an external ssd or an internal one with an enclosure.