Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Debian with persistence on usb for both uefi and bios?
Debian with persistence on usb for both uefi and bios?
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.
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.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Debian with persistence on usb for both uefi and bios?
Unpack the ISO, unsquash the squashfs, chroot in and install what you want then resquash, repack and burn the new ISO. Job done.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.
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/
deadbang
Re: Debian with persistence on usb for both uefi and bios?
Thx
Does this work for both live and install isos?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.
Re: Debian with persistence on usb for both uefi and bios?
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.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Debian with persistence on usb for both uefi and bios?
I'm not sure tbh, I only make the live images and have no interest in installing those to a disk permanently.sandwich wrote:Does this work for both live and install isos?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.
deadbang
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Debian with persistence on usb for both uefi and bios?
Tricky with Debian because the grub-pc & grub-efi packages are not co-installable.sandwich wrote:how to install full on usb so it works on both uefi and bios
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
deadbang
Re: Debian with persistence on usb for both uefi and bios?
Code: Select all
apt install live-config-doc
or
Code: Select all
apt install live-config-html
Code: Select all
apt install live-config-pdf
Code: Select all
apt install live-config-txt
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 Tools for Buster/Sid and Beowulf/Ceres now maintained by fsmithred
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Debian with persistence on usb for both uefi and bios?
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.Head_on_a_Stick wrote:Tricky with Debian because the grub-pc & grub-efi packages are not co-installable.sandwich wrote:how to install full on usb so it works on both uefi and bios
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.
Re: Debian with persistence on usb for both uefi and bios?
I am using: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.
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.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Debian with persistence on usb for both uefi and bios?
Yes, sorry, that was an unfortunately inaccurate use of the word "unpack", I don't know why I used that word tbhsandwich wrote:I unpacked the iso file but I don't know how to find a squashfs file in there.
This will get what you need:
Code: Select all
# mount debian-live-9.6.0-amd64-lxde+nonfree.iso /mnt
Code: Select all
mkdir ~/image && cd ~/image
cp -a /mnt iso
EDIT: @p.H, thanks for the information about the GRUB packages in Debian, that's very useful.
deadbang
Re: Debian with persistence on usb for both uefi and bios?
Thanks @Head_on_a_Stick, that solves my immediate problem.
Thanks @liivv and @p.H for the additional info and sources.
Thanks @liivv and @p.H for the additional info and sources.