AIO Create any Windows/Linux Bootable USB Drive

Post tutorials, HOWTO's and other useful resources here.
neonred
White ninja
White ninja
Posts: 11
Joined: 04 Sep 2020, 14:20
Distribution: Runtu, Porteus, Q4OS

AIO Create any Windows/Linux Bootable USB Drive

Post#1 by neonred » 13 Sep 2021, 12:30

This is a rewrite of my previous tutorial; greatly simplified, streamlined and expanded.

Some of you are trying to install linux to usb drive and may get an error on etcher.
Others are trying to install Porteus or Tails to a non-usb hard drive.
Some of you might be trying to get a Windows 10 / Linux bootable USB drive from installed Linux or from Live Linux.

In this tutorial I will show you a bullet proof way to get it working.
You will find no better guide on the internet, but attention to detail is important.

So you've downloaded the iso you need.
Typically you will then create a bootable usb drive (stick or hard drive...flash cards don't work for this purpose).
However, what if you wanted to "install" Tails?
Then you could use the internal hard drive; this only becomes problematic with multi boot.
This tutorial won't cover multiboot, but I'm sure some one would appreciate such a follow up i.e., install Windows and then Tails to hard drive.
So decide which device you would like to use for bootable medium and know that all information on it will be destroyed.

Preamble: EFI requires MSDOS partition table (not GPT) and FAT32 File System, macs also require this.

Clear your USB stick with Gparted

1. Select your USB stick from available drives
2. Right click on the partition bar, and select either format to → Cleared, or simply delete the partition.
3. Click on the checkmark to apply.

Prepare your USB stick with Gparted
1. Under Device Menu, select create partition table, choose MS-DOS.
2. Right click on partition bar and select format to FAT32; use defaults.
3. Click on the checkmark to apply.
4. Right click on partition bar and select manage flags, select BOOT and select close.
5. Pay attention to your usb device name; namely is it: sda, sdb, sdc?

Your USB Stick is ready, now Open a Terminal and execute these commands:

1. sudo mount -o loop /path/to/distro.iso /mnt
2. cd /media
3. sudo mkdir drive
4. sudo mount /dev/sdc1 /media/drive/
(add the number 1 to your device name, this selects primary parition)
5. time sudo rsync -rltD /mnt/ /media/drive

Your done.
Remember Windows 8 and beyond uses secure boot by default.
Remember Linux does not use secure boot by default.
Remember you can Boot UEFI without secure boot, but some linux distros absolutely require legacy boot.

Special Instructions for Tails:

1. Enable Legacy Boot in Bios
2. Enable Virtualization in Bios
3. When you get to the Tails boot menu press e or tab to edit and remove "live-media=removable" from the boot sequence, and press F10 to continue.

If the image extension is "img" or if you otherwise get this error:
wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Then you are going to multiply the sector size by the start sector (i.e., sector size is 512, sector start is 2048) = 1048576
To view this information for your image you need to use this command:
sudo fdisk -l -u=sectors /home/username/Downloads/tails-amd64-4.13.iso
sudo mount -o loop,offset=1048576 /home/username/Downloads/tails-amd64-4.13.img /media/iso

Cleanup up Post USB Creation
df -h (locate greatest loop)
sudo umount /dev/loop1
sudo umount /media/drive/

Wim Greater than 4GB considerations


Download wimlib 1.13.4 and extract. CD to extracted folder from terminal.
sudo apt install libxml2-dev libfuse-dev pkg-config
./configure --without-ntfs-3g && make && sudo make install
sudo ldconfig -v
sudo wimsplit /mnt/sources/install.wim /home/demo/install.wim 3999

Now you may require 2 clone USB drives (cloned in content except one has wim 1, the other wim 2)
That way when windows asks for disc 2, you can insert the usb drive with wim 2.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

AIO Create any Windows/Linux Bootable USB Drive

Post#2 by Ed_P » 13 Sep 2021, 15:14

Thank you neonred. A lot of the tutorials here are old and need updating.

Two questions, what is Tails and how do your instructions compare to the USB_INSTALLATION.txt file's instruction in the Porteus ISOs. We don't want to confuse new users.
Ed

neonred
White ninja
White ninja
Posts: 11
Joined: 04 Sep 2020, 14:20
Distribution: Runtu, Porteus, Q4OS

AIO Create any Windows/Linux Bootable USB Drive

Post#3 by neonred » 14 Oct 2021, 23:30

Tails is a Live Linux distribution focused on privacy routing all traffic through Tor.

Over-Simplification:

Regular internet: home computer -> ISP -> Server's ISP -> Server computer (website)
Tor: home computer -> hop1 to hop100 -> ISP -> Server's ISP -> Server (website)
Consequence: each packet will have the IP of one of the hops instead of your machine.
Result: Anonymity (kindof)

Live linux means intended to run from read-only source as opposed to an install which is a read-write system that grows, changes and adapts.
Live linux is more secure in that since the system is always new it is always starts free from infection short of the distribution isos being infected.
Installs are more practical for everyday.
Then there's Live linux with persistence which if you know what your needs are in a flash, then why not create a fresh system in your image from a fresh base system that you trust?

As for how this guide compares to the porteus guide; I have no idea.
All linux distributions install easily onto USB with Etcher on any OS.

The point of the guide is where you have any struggle either getting the ISO written to USB or having the resulting usb fail to boot then just use this guide and its full proof.
And even if you encounter an error, you will know exactly at which step the error is occurring as opposed to some generic GUI error that gives you the middle finger.
Knowledge is empowering.
Linux is hard, but the terminal is more and more rewarding because it always points to why. The how is usually Google.
Linux doesn't hold your hand, it gives you full control.
In the end, I know from personal experience the terminal can feel extremely annoying but is the innocent bystander.
What you are actually frustrated with is the existence or absence of some configuration.
And that in my opinion is what makes or breaks great linux distributions; how well they are configured because the perpendicular is Terminal Hell.
So if I'm on this forum, this means that I respect the authors of Porteus largely by their well executed efforts into system configuration.

nanZor
Shogun
Shogun
Posts: 381
Joined: 09 Apr 2019, 03:27
Distribution: Porteus 5.01 x86-64 LXQT

AIO Create any Windows/Linux Bootable USB Drive

Post#4 by nanZor » 04 Nov 2021, 22:15

I'm with you Ed. Too confusing for many.

I would posit that most distro's should follow Porteus' example of not needing any 3rd party "installer" at all. Porteus has it all.

Not many read the usb readme file sadly and see how easy it is, or if they do assume that they /have/ to use the windows exe or linux shell script. Not always so. Some may not even realize that double-clicking a downloaded iso in windows will mount it so that the files can be read and assume they have to use etcher, rufus, unetbootin etc.

How can we make it clearer that on modern machines, all one has to do is:

1) Double click the downloaded iso to mount it. (linux gurus can use cli of course, or an advanced file manager like spacefm etc)
2) Copy the files/folders within to a *freshly formatted* usb stick. Eject / unmount when done. Don't just yank it out.

Reboot and designate that new stick in bios or with a bios boot-choice menu, as the one to boot first.

3) If the above actually fails, then navigate to the new Porteus stick, and either run the windows exe installer, or if coming from another linux distro, run the shell script and try again since your hardware may be older or unique. Not always necessary!

This simplicity and independence from having to rely on 3rd party utilities is just one of the many things that makes me love Porteus.
That's a UNIX book - cool. -Garth

Post Reply