Debian with persistence on usb for both uefi and bios?

Help with issues regarding installation of Debian

Debian with persistence on usb for both uefi and bios?

Postby sandwich » 2019-01-17 07:48

I am trying to create a "rescue" installation of debian on a usb stick that will run on both, uefi/gpt and bios/mbr computers.

Unfortunately the live version by itself is not sufficient as I need to use a chunk of additional software that would just be too painful to install each and every time I need to use the stick.

After lots of googling and reading I tried the following 2 approaches:

1. Installing a full version of debian on the stick.

When I try this, the resulting installation only works on whichever type of machine I used to make the installation. If I used a uefi machine to install, then the stick only works on uefi machines; if I used a bios machine then it only works on bios machines. I suspect this may have to do with the installer detecting the type of machine being used and installing appropriately. Whatever the case may be, no love with this approach.

2. Attempting to add persistence to a live iso (I tried the one with non-free drivers and firmware).

Basically this involved:
downloading the iso file from the debian website,
copying the contents to a writable directory,
modifying /isolinux/menu.cfg so that the entries after "boot= ..." include the word "persistence",
re-creating an iso file from the modified contents using xorriso,
copying the resulting iso to the stick,
adding a new partition to the empty space of the stick, formatting it as ext4 and labeling it with "persistence", and
mounting the new partition and adding to it a persistence.conf file containing the string "/ union\n".

Unfortunately this attempt also failed. After re-booting the stick, the resulting system has *no* persistence, nothing can be saved from one boot to the next.

I am not too surprised that my attempts failed; after all I pieced them together from fragmentary info, and consequently I really don't.understand what I'm doing. I suppose it's the nature of the beast. Nonetheless, I'd be most thankful to anyone who has any ideas on how to accomplish my goal and/or increase my understanding on the subject matter.
sandwich
 
Posts: 7
Joined: 2018-12-03 18:18

Re: Debian with persistence on usb for both uefi and bios?

Postby Head_on_a_Stick » 2019-01-17 08:00

sandwich wrote:Unfortunately the live version by itself is not sufficient as I need to use a chunk of additional software that would just be too painful to install each and every time I need to use the stick.

Unpack the ISO, unsquash the squashfs, chroot in and install what you want then resquash, repack and burn the new ISO. Job done.

I have all the required commands if you need them, I've done this myself.

I think Refracta have a script based solution that will do this for you but I haven't tried it.

The grml ISO image also has a live build framework:

https://grml.org/grml-live/
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian with persistence on usb for both uefi and bios?

Postby sandwich » 2019-01-17 08:40

Thx

Head_on_a_Stick wrote:Unpack the ISO, unsquash the squashfs, chroot in and install what you want then resquash, repack and burn the new ISO. Job done.


Does this work for both live and install isos?
sandwich
 
Posts: 7
Joined: 2018-12-03 18:18

Re: Debian with persistence on usb for both uefi and bios?

Postby sandwich » 2019-01-17 08:42

Never mind, there is no point with insall iso's. I wouldn't know how to install full on usb so it works on both uefi and bios.
sandwich
 
Posts: 7
Joined: 2018-12-03 18:18

Re: Debian with persistence on usb for both uefi and bios?

Postby Head_on_a_Stick » 2019-01-17 08:54

sandwich wrote:
Head_on_a_Stick wrote:Unpack the ISO, unsquash the squashfs, chroot in and install what you want then resquash, repack and burn the new ISO. Job done.


Does this work for both live and install isos?

I'm not sure tbh, I only make the live images and have no interest in installing those to a disk permanently.
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian with persistence on usb for both uefi and bios?

Postby Head_on_a_Stick » 2019-01-17 09:04

sandwich wrote:how to install full on usb so it works on both uefi and bios

Tricky with Debian because the grub-pc & grub-efi packages are not co-installable.

It can be done though if you use an Arch Linux live ISO image and mount the /boot partition to /mnt/boot and the EFI system partition to /mnt/boot/efi then run
Code: Select all
grub-install --target=i386-pc --boot-directory=/mnt/boot /dev/sdX
grub-install --target=x86_64-efi --boot-directory=/mnt/boot --efi-directory=/mnt/boot/efi

This will need a disk with a GUID partition table and a BIOS boot partition (and a functional grub.cfg) to work.
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian with persistence on usb for both uefi and bios?

Postby llivv » 2019-01-17 09:43

Code: Select all
apt install live-config-doc
find it in /usr/share/doc/
or
Code: Select all
apt install live-config-html
or
Code: Select all
apt install live-config-pdf
or
Code: Select all
apt install live-config-txt

I'd stick with one of those and get persistance working first.

The dual boot issue is a bit more advanced and fought with possible issues...
But if there is a debian way of doing it - it should be in
Code: Select all
live-boot-doc


refracta live tools are based on Debian-live - I watched deanlinkous develop them with the refracta distro from posts in various forums while the Debian-live maintainer was getting lambasted on debian kernel with "use unionfs" regarding Danials' wishlist bugs. Back in what are now considered by many, the Debian Dark Ages...

Refracta Tools for Buster/Sid and Beowulf/Ceres now maintained by fsmithred
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.
User avatar
llivv
 
Posts: 5488
Joined: 2007-02-14 18:10
Location: cold storage

Re: Debian with persistence on usb for both uefi and bios?

Postby p.H » 2019-01-17 12:07

Head_on_a_Stick wrote:
sandwich wrote:how to install full on usb so it works on both uefi and bios

Tricky with Debian because the grub-pc & grub-efi packages are not co-installable.

Not a problem. You don't need grub-pc and grub-efi. All you need is grub-pc-bin, grub-efi-amd64-bin and possibly grub-efi-ia32-bin if you want to boot on the rare x86 machines with 32-bit UEFI, which do not conflict with one another. Then you can run the grub-install commands.
Note : add --removable when installing GRUB for EFI.

The real problem is elsewhere : conflicting firmware requirements to boot either in BIOS and EFI mode. For example :
- Some firmwares require a GPT partition table to boot in EFI mode.
- Some firmwares require a DOS/MBR partition table and an entry with the boot flag set to boot in BIOS mode.
- The GPT standard requires that the GPT partition in the protective MBR has the boot flag cleared. Some UEFI firmwares enforce this requirement.

The Debian installer and live images solve this with a GPT partition table and a normal (not protective) MBR/DOS partition table.
p.H
 
Posts: 1036
Joined: 2017-09-17 07:12

Re: Debian with persistence on usb for both uefi and bios?

Postby sandwich » 2019-01-17 19:06

Head_on_a_Stick wrote:Unpack the ISO, unsquash the squashfs, chroot in and install what you want then resquash, repack and burn the new ISO. Job done.


I am using:

debian-live-9.6.0-amd64-lxde+nonfree.iso

which I obtained from:

https://cdimage.debian.org/images/unoff ... so-hybrid/

I unpacked the iso file but I don't know how to find a squashfs file in there. There isn't one with an obvious name or extension. Neither are there any /bin /etc /home /lib /usr nor /var directories; I would assume that they are possibly compressed in some other form. What there is, is: /boot /d-i /.disk /dists /firmware /isolinux /live and /pool directories

I would hazard a guess that, creating a chroot jail from scratch without somehow decompressing what's there already, installing whatever software, and re-packing and burning is probably not what you intended, is it?

Would you happen to know if there is a workable procedure to add additional packages to this particular live iso file?

Thanks very much.
sandwich
 
Posts: 7
Joined: 2018-12-03 18:18

Re: Debian with persistence on usb for both uefi and bios?

Postby Head_on_a_Stick » 2019-01-17 19:13

sandwich wrote:I unpacked the iso file but I don't know how to find a squashfs file in there.

Yes, sorry, that was an unfortunately inaccurate use of the word "unpack", I don't know why I used that word tbh :?

This will get what you need:
Code: Select all
# mount debian-live-9.6.0-amd64-lxde+nonfree.iso /mnt

Then as your normal user:
Code: Select all
mkdir ~/image && cd ~/image
cp -a /mnt iso

The contents of the ISO will then be found in the iso folder with filesystem.squashfs in iso/live ;)

EDIT: @p.H, thanks for the information about the GRUB packages in Debian, that's very useful.
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian with persistence on usb for both uefi and bios?

Postby sandwich » 2019-01-17 20:51

Thanks @Head_on_a_Stick, that solves my immediate problem.
Thanks @liivv and @p.H for the additional info and sources.
sandwich
 
Posts: 7
Joined: 2018-12-03 18:18


Return to Installation

Who is online

Users browsing this forum: No registered users and 13 guests

fashionable