Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Live System on USB

1 view
Skip to first unread message

Stefan Kropp

unread,
Aug 14, 2022, 8:20:03 AM8/14/22
to
Hello,

this weekend I did some tests with an USB stick - I'm a little
bit confused, now ;-)

Goal: Build a USB stick which also persists the user data.

I have one ISO image which looks likes this

--------------------------
boot
'[BOOT]'
EFI
efi.img
isolinux
live
sha256sum.README
sha256sum.txt
--------------------------

I _think_ I was able to just copy the files and I was able to cp
the iso-file to /dev/sda. Both where working. \o/

When I create a ISO, now (I don't know what I did) the ISO looks
like:

--------------------------
* lot of .mod files
* mkisofs
* grub* files
* info
* fs.lst
* EFI
* ...
--------------------------

Is the first ISO a Hybrid and the second a 'normal' iso? Can
somebody tell me what I did / missed?

To create the partition I did the following steps
- it is not working ;-)

I copied debian-junior-live-system/live-image-amd64.hybrid.iso to
sda (my USB Stick).

fdisk -l /dev/sda
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 64 4746719 4746656 2,3G 0 Empty
/dev/sda2 740 6051 5312 2,6M ef EFI (FAT-12/16/32)

I created a new partition.

cfdisk /dev/sda

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 64 4746719 4746656 2,3G 0 Empty
/dev/sda2 740 6051 5312 2,6M ef EFI (FAT-12/16/32)
/dev/sda3 4747264 120176639 115429376 55G 83 Linux

(I think this breaks something (mbr?) - I was not able to boot
the live system).

The sda3 should have the persistence.conf.

mkfs.ext4 /dev/sda3
tune2fs -L persistence /dev/sda3
mount /dev/sda3 /mnt/
echo "/home" >> /mnt/persistence.conf
umount /mnt

Can somebody help me to setup such a stick?

This is my config:
https://salsa.debian.org/debian-jr-team/debian-junior-live-system/-/blob/master/auto/config#L8-11

--
Stefan
Diese E-Mail wurde von einem Debian GNU/Linux System gesendet

Claude Heiland-Allen

unread,
Aug 14, 2022, 9:50:02 AM8/14/22
to
On 2022-08-14 13:12, Stefan Kropp wrote:
> Goal: Build a USB stick which also persists the user data.

I have an experiment that does this.

Boot option persistence:
https://code.mathr.co.uk/clive-usb/blob/af3b04438d094e6d6f30c247ccb6bc6b85304b6e:/auto/config#l12

then to cat hybrid iso to usb and create persistence partition:
https://code.mathr.co.uk/clive-usb/blob/af3b04438d094e6d6f30c247ccb6bc6b85304b6e:/create-usb.sh

I had a version that encrypted the persistence partition but it didn't
benefit my use case (a workshop on livecoding).


Claude
--
https://mathr.co.uk

andy pugh

unread,
Aug 14, 2022, 10:20:03 AM8/14/22
to
On Sun, 14 Aug 2022 at 13:13, Stefan Kropp <stefan...@posteo.de> wrote:

> I copied debian-junior-live-system/live-image-amd64.hybrid.iso to
> sda (my USB Stick).
>
> fdisk -l /dev/sda

It's likely that you know more than I do about this, but I thought
that "dd" was the way to copy the iso across, as it retains the file
layout as well as the contents.

--
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912

Thomas Schmitt

unread,
Aug 14, 2022, 1:50:03 PM8/14/22
to
Hi,

Stefan Kropp wrote:
> Is the first ISO a Hybrid and the second a 'normal' iso?

If you want to see the boot lures of an ISO do:

ISO=...path.to.ISO.image.or.USB.stick.with.ISO...

xorriso -indev "$ISO" -report_el_torito plain -report_system_area plain

With ISO=debian-live-11.1.0-amd64-xfce.iso it reports:

...
xorriso : NOTE : Detected El-Torito boot information which currently is set to be discarded

This xorriso run won't write, so this note is true but does not matter.

...
Boot record : El Torito , MBR isohybrid cyl-align-off GPT

This is a summary of detected boot lures. I.e.
- there is a boot catalog for booting from optical medium,
- an MBR with x86 code is present,
- which transfers execution to the El Torito boot image for BIOS,
- the MBR partition table is not aligned to any legacy address cylinder,
- there is a GPT header block and a partition array

Now come details about the El Torito boot catalog and the boot images
which it offers:

El Torito catalog : 367 1
El Torito cat path : /isolinux/boot.cat
El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA
El Torito boot img : 1 BIOS y none 0x0000 0x00 4 1675
El Torito boot img : 2 UEFI y none 0x0000 0x00 5226 368
El Torito img path : 1 /isolinux/isolinux.bin
El Torito img opts : 1 boot-info-table isohybrid-suitable
El Torito img path : 2 /boot/grub/efi.img

So there are images for legacy BIOS and EFI. The BIOS image is a program
from the SYSLINUX/ISOLINUX project. The EFI image is obviously from GRUB.

Like in one of your ISOs

> Device Boot Start End Sectors Size Id Type
> /dev/sda1 * 64 4746719 4746656 2,3G 0 Empty
> /dev/sda2 740 6051 5312 2,6M ef EFI (FAT-12/16/32)

there is:

MBR partition table: N Status Type Start Blocks
MBR partition : 1 0x80 0x00 0 4882432
MBR partition : 2 0x00 0xef 1472 5226
MBR partition path : 2 /boot/grub/efi.img

The MBR partition table does not announce the GPT (by a single partition
of type 0xEE) but rather has an EFI partition which marks the same file
inside the ISO which already serves as El Torito boot image for EFI.
Partition 1 encloses partition 2, which is forbidden by EFI. So the type
of partition 1 is set to 0x00 to let it appear unused to EFI.

The GPT in the ISO is only ornamental and not valid.
(It appeases some EFI implementations which won't boot from a USB stick
that does not smell like GPT.)

GPT : N Info
...
GPT partition path : 2 /boot/grub/efi.img


----------------------------------------------------------------------

> I have one ISO image which looks likes this
> --------------------------
> boot
> '[BOOT]'
> EFI
> efi.img
> isolinux
> live
> sha256sum.README
> sha256sum.txt
> --------------------------

This looks half like the root directory of debian-live-11.1.0-amd64-xfce.iso
and half like something different.
Missing are 'd-i' and 'pool'. Surplus are "'[BOOT]'", 'efi.img',
'sha256sum.README', 'sha256sum.txt'.
The name "'[BOOT]'" might be an artefact of the tool by which you inspect
the ISO. Some show the El Torito boot catalog as pseudo directory.


> When I create a ISO, now (I don't know what I did) the ISO looks
> like:
> * mkisofs

What is in this file ? A program ? Some text ?
It's long ago that the Debian world used mkisofs.

> * fs.lst

.lst was the suffix of old GRUB Legacy. Nowadays it is .cfg.

Maybe you reactivated some outdated code ?


----------------------------------------------------------------------

> I created a new partition.
> (I think this breaks something (mbr?) - I was not able to boot
> the live system).

Did it boot before you added the partition ?

Note that the MBR is only of interest if you boot via legacy BIOS.
EFI in its native mode will boot via the partition of type 0xEF ("EFI").

You could check the MBR for alterations by comparing the first 446 bytes of
unaltered ISO image and USB stick:

dd if="$ISO" bs=1 count=446 of=/tmp/iso_mbr
dd if=/dev/sda bs=1 count=446 of=/tmp/stick_mbr
diff /tmp/iso_mbr /tmp/stick_mbr


Have a nice day :)

Thomas

Thomas Schmitt

unread,
Aug 14, 2022, 4:00:02 PM8/14/22
to
Hi,

i wrote:
> ISO=...path.to.ISO.image.or.USB.stick.with.ISO...

This must rather be

ISO=...path.to.ISO.image...
or
ISO=stdio:/dev/...USB.stick.device.with.ISO...

(like: ISO=stdio:/dev/sda )
0 new messages