Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#1 by neonred » 04 Sep 2020, 14:56

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.

Now you need to put these commands in the terminal.
These should work in Debian/Ubuntu, and may be slightly different in other distros.
A partition cannot end with a forward slash unlike a folder i.e.,
legal : sudo mount /dev/sdc1 /media/drive/
illegal: sudo mount /dev/sdc1/ /media/drive/

cd /media
sudo mkdir iso
sudo mount -o loop /path/to/iso /media/iso
(there's 2 paths in the previous command, failure to include one will produce an /etc/fstab error)

Now use gparted to destroy all partitions wherever you want to install (on that device)
On that same device, create an MS-DOS partition table.
Now Create a fat 32 partition, apply, and then set the flag to boot.
Take note the /dev/ name of that partition which for me is sdc1 in the next step.
Mount the device with your file manager or manually
cd /media
sudo mkdir drive
sudo mount /dev/sdc1 /media/drive/
sudo cp -a --no-preserve=mode,ownership /media/iso/. /media/drive/
(that no-presever=mode,ownership is especially useful for windows isos)
df -h (look for the last loop device which will be the /media/iso loop we created earlier)
(we must unmount this, probably loop7 on porteus live)
sudo umount /dev/loop0 (failure to do this step will yield device in use error in the next step)
sudo umount /media/drive/ (this will take a while but when complete the files are copied)

Last step, set your bios to support legacy boot. Turn secure boot off as well. When you boot up porteus choose EFI.
Normally EFI requires secure boot files, but many distros don't include them.
Using the aforementioned options makes it so that it doesn't require those secure boot files.
Otherwise if those options are not set you will get an error.

This will work on every distribution (Linux and Windows) which include boot files on ISO.
No more errors with Etcher, having to depend on Etcher, be free, with style and proud of using the terminal.

Tested on Windows 10 x64 1607 Enterprise 2016

Note; If you get an unable to find install medium error, it's probably because you are not using one of Microsoft's official ISO. One of the items "Lite Windows" often error on is trimming boot.wim If the exact source to create the "Lite Windows" is known, then the original can be downloaded, then you just extract the original boot.wim and replace the one on your bootable medium.
Last edited by neonred on 01 Oct 2020, 18:12, edited 3 times in total.

User avatar
Ed_P
Contributor
Contributor
Posts: 6338
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

Install Porteus or Any Linux to any medium (Boot Garantee)

Post#2 by Ed_P » 05 Sep 2020, 18:42

On EFI systems one must disable the Secure Boot option.
Ed

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#3 by neonred » 26 Sep 2020, 02:43

Thx Ed, instructions revised.

User avatar
Ed_P
Contributor
Contributor
Posts: 6338
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 4.0 & 5.0rc3 ISOs
Location: Western NY, USA

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#4 by Ed_P » 26 Sep 2020, 14:38

Referencing GPT you might find this thread interesting neonred.
Uefi and porteus 3.0
Ed

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#5 by neonred » 21 Nov 2020, 11:58

Can't edit post, so here's a slight update in case you get an error when you mount the image

sudo mount -o loop /path/to/iso /media/iso
(there's 2 paths in the previous command, failure to include one will produce an /etc/fstab error)
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

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#6 by neonred » 21 Nov 2020, 13:05

Now if you went ahead and tried to copy Tails to your emmc,
You will get bountiful error that can be resolved by 3 things:
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.

Tolkem
Black ninja
Black ninja
Posts: 31
Joined: 10 Aug 2019, 05:53
Distribution: Porteus 4.0 KDE

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#7 by Tolkem » 02 Dec 2020, 17:45

Nice tutorial. However, I do wonder what's the advantage of doing this and doing

Code: Select all

sudo mount -o loop /path/to/distro.iso /mnt
then open a file manager, navigate to /mnt, select everything and copy/paste it to /media/whatever within the file manager? I've done that and it works with both Windows and Linux.

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#8 by neonred » 07 Sep 2021, 17:29

In following with KISS, Tolkem makes a very good point herein are the revised instructions:

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

1. sudo mount -o loop /path/to/distro.iso /mnt
2. cd /media
3. sudo mkdir drive
4. sudo mount /dev/sdc1 /media/drive/
Optional, in case you somehow don't get write privileges.
sudo mount -o remount,rw /media/drive /media/drive
5. sudo FileManager
6. Go to /mnt in FileManager copy and paste into /media/drive
7. df -h (look for the last loop device which will be the /media/iso loop we created earlier)
(we must unmount this)
8. sudo umount /dev/loop# (replace # sign with number, failure to execute this command will yield device in use error in the next step)
9. sudo umount /media/drive/ (this will take a while but when complete the files are copied)
10. Set your bios to support legacy boot and virtualization.
11. If boot medium is windows, turn on secure boot, otherwise turn it off.

This greatly simplifies the process and minimizes errors.
Thanks Tolkem.

Musings:

N.B. sudo mount /dev/sdc1 /media/drive/

This says mount partition 1 of device sdc to /media/drive/

If instead you put sudo mount /dev/sdc /media/drive, you would get this error:
wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.

Basically the mount command means "read in a container".
If you are mounting a device, and merely specify the device, the question remains, read what? Which is why the partition must be specified.
If you are mounting an iso, read what is always answered, but sometimes you need to specify read from what point in the file.
If you write sudo mount /dev/sdc1/ /media/drive
This says read a folder from another folder called drive; kinda stupid and you get a "special device" error. Special indeed.
Loopback means "wait for unmount then loopback to".

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#9 by neonred » 07 Sep 2021, 19:16

Now you could run into the situation where install.wim is greater than 4GB.
You need to split the wim. Easiest way is on a windows machine, but suppose you don't have one.
These instructions are for MX Linux 19.3, but should be similar regardless of distro.
Download wimlib 1.13.4 and extract. CD to extracted folder from terminal.
sudo apt install libxml2-dev libfuse-dev
./configure --without-ntfs-3g && make && sudo make install
sudo ldconfig -v
sudo wimsplit /mnt/sources/install.wim /home/demo/install.wim 1500

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#10 by neonred » 07 Sep 2021, 19:38

forgot to add sudo apt install pkg-config

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

Install Porteus or Any Windows/Linux to any medium (Boot Guarantee)

Post#11 by neonred » 07 Sep 2021, 21:11

cp -r -a --no-preserve=mode,ownership sources/!(install.wim) /media/drive/sources
rsync -av --progress /media/drive --exclude sources

going to rewrite article

Post Reply