debootstrap handles that, arch-install-scripts has got a lot of helpful tools. after the initial install, you arch-chroot to it and install stuff you want, via apt, tasksel, etc.
Thanks, taking a look at debootstrap and virt-manager ATM.
I would use a virtual machine
It sounds to me like you are looking to create a "portable" linux install.
This used to be quite common when linux was much less common.
A lot of live distros, including ubuntu, support using an extra partition on the USB as the 'drive', so you boot to the standard live distro but your files and history are all there too.
Here's a couple links. Google "portable linux" for more info.
A general list of portable linux distros.
https://www.ubuntupit.com/best-portable-linux-os-distros-to-install-run-from-usb/
Detailed instructions on doing this.
(I reviewed this, looks accurate, didn't really dig through it. Their method is to create an installer USB in one port, boot from it, and then install to another USB in another port. The UEFI directions at the end look a bit sus. YMMV.)
https://coastipc.com/blog/post/creating-a-portable-linux-operating-system-on-a-usb-drive
I'm not sure that I follow the rationale. If this is your only active machine, what is the issue with having to shut down and boot into an installer to install Linux?
Is your goal to overwrite your existing OS with Linux, or to dual boot?
No, my goal is to set up a portable hard drive to use as an external system (to eg.: connect to machines to repair/diagnose them) without having to spend the 2+ hours of install and configure off my one working machine ATM.
Ah, okay. Then yes, as others have mentioned, it sounds like you want a portable linux install.
I keep around install USBs of both Arch Linux and Mint, as both boot into a live version of the distro, and I can either open a terminal to debug things, or arch-chroot into my arch install if I broke my bootloader or something.
What you want is to bootstrap using a tool called debootstrap
deboostrap from the package manager the same that we can use to set up Debian chroots? It can be used that way too? ๐
If you want to run NixOS (which you don't seem to wamt) this is a possibility!
Look up NixOS amywhere.
Can install NixOS from almost any running Linux system live without boot USB.
Requires a machine on the same network though.
Pretty cool!
NixOS sounds interesting for a Sometime when I have more experience, certainly!
So far I've only had experience with a Nix thing that functions like a package manager, something like a Nix version of Brew.
I think the most straigthforward solution for you would be to boot the live ISO installer in a virtual machine, and then connect the USB device to it and then install. This is mostly guaranteed to work, since it is already using the actual ISO.
Alternatively, the program that most Linux distro's use to install nowadays is called calamares. And yes, you can install it on a non-live system.
sudo apt install calamares calamares-settings-debian
This might be easier, but it also might be harder, if say, the installer is not preconfigured with the various settings the live ISO comes with.
Good question.
Hrmm. First janky thought... "dd the running system to the USB". LOL. Dear oh dear, do not do that, LOL.
Actually, first thought, before reading the post, just from the title, was "install gentoo", ... and that still works, ... if it's gentoo you want.
I wonder if you could do it from a virtual system... with whatever passthrough(?) or whatever needed to let it install to USB. So [in virtualbox or qemu or whatever] boot from whatever distro's live/installer [~ even, ventoy(?)], and install to USB, much like you would if running the live/installer on bare metal, except you're in virtual, and have access to your current daily driver OS and all your comforts there.
I noticed recently some distros do not like being installed to USB (~ is that a recent thing? Maybe I'd not been installing distros to USB from as diverse a pool of distros as I thought, and it'd always been like this.)
I feel like I'm forgetting some other obvious avenue. There may be just distro-specific methods. Like gentoo's stage3 handbook install method's already sufficiently flexible way [(or exherbo or decibellinux (oh noes, decibellinux.org is still down) or other distro that does a similar manual install)]. [edit: oh!]
- dd (lol, no!)
- gentoo (or exherbo etc ~ / distro-specific ways)
- virtual (pick me!)
- the other ways I'm overlooking [edit: debootstrap]
... Then, depending upon what you need/want it for, and need/want avoid a reboot for, other options may offer solutions not considered further back in the decision tree... distrobox, bedrocklinux, distro-agnostic package management, manual (compile&)installs, or perhaps even just using something like virtualbox gets you far enough? ... But no, none of that's what you asked for. What you asked for is better. :)
[edit: oh!: I did make a start on a distro-agnostic distro-installer script, a decade or two ago, before life interrupted. I must have thought it possible. It would have allowed you to accomplish this. ... Pity "life" happened, or I'd surely have that made already. Is doable.]
dd (lol, no!)
Same! I get capitalist anxiety every time I have to write a bootable ISO to a thimb drive!
Linux Questions
Linux questions Rules (in addition of the Lemmy.zip rules)
- stay on topic
- be nice (no name calling)
- do not post long blocks of text such as logs
- do not delete your posts
- only post questions (no information posts)
Tips for giving and receiving help
- be as clear and specific
- say thank you if a solution works
- verify your solutions before posting them as facts.
Any rule violations will result in disciplinary actions