[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian images and USB sticks



Very interesting, Thomas. I'm writing this e-mail from the Debian system I've installed using the method you described in detail. The only difference is that I used cp instead of dd. My USB stick has now 3 partitions, two of them reserved for images and the other one for regular use. I included a README in the stick that describes in a very general way the steps taken to make it work, for future reference in the case I need it. I will include it here, for it might be useful to someone else:

Preparing a USB stick to boot Debian: *
 
1. lsblk to find out device number.
2. Unmount device.
3. Wipe filesystem signatures if there was an image written to the stick.
4. Partition USB stick with parted (don't forget the boot flag).
5. Create the filesystems.
6. Download .iso.
7. Copy .iso (to preserve the original one).
8. isohybrid --partok copied .iso.
9. As root, cp "partoked".iso /dev/sdXY && sync.
10. Reboot and select the USB stick to boot.

* Under BIOS at least

Thank you very much for the replies! 

PS - I'm curious about this: when I opened the images with an archive manager (more specifically with the one that comes with the MATE desktop), I saw a directory named "[BOOT]" that contained files with a name along the lines of "...no-emulation...". The date of creation was 1969. Pretty weird, haha. Do you have any idea about what it is?




On 4 May 2016 at 02:59, Thomas Schmitt <scdbackup@gmx.net> wrote:
Hi,

> Does the method described in the manual (copying to /dev/sdX) work under
> UEFI? Or it's basically the same thing as copying to a partition?

The main difference is that copying to /dev/sdX overwrites the MBR and
the partition tables, while copying to /dev/sdXn keeps the partitioning
(and the other partitions' content) unchanged.

BIOS booting from MBR does not necessarily need a partition table.
(It's the parted MBR code which looks for a partition marked as bootable,
 not the BIOS firmware which simply starts the MBR code as x86 program.)

But UEFI wants to see a EFI System Partition announced by MBR or GPT.
By copying the Debian ISO image to a partition you do not create a new
EFI System Partition. By copying it to the base device, you give it
the partition tables which are stored in the ISO.

So if you put the Debian ISO into a partition, then for UEFI you'd
need to extract the content of the EFI System Partition from the ISO
and put it into a separate MBR partition of type 0xef.

Debian i386 and amd64 netinst ISOs have their EFI System Partition content
in file  /boot/grub/efi.img . In general you can ask a partition editor
to print the table

  $ /sbin/fdisk -lu debian-8.2.0-i386-netinst.iso
  ...
  Device                         Boot Start    End Sectors  Size Id Type
  debian-8.2.0-i386-netinst.iso1 *        0 645119  645120  315M  0 Empty
  debian-8.2.0-i386-netinst.iso2       4020   4659     640  320K ef EFI (FAT-12/16

and use dd to cut out the content of the partition with id "ef":

  dd if=debian-8.2.0-i386-netinst.iso bs=512 skip=4020 count=640 of=my_esp.img


The next problem might be that the starting system software normally
expects to wake up on /dev/srY or /dev/sdX, not on /dev/sdX1.
That's the realm of the debian-cd project. My scope ends when the
boot loader has started.
(It is the most interesting part of your adventure that the system
 boots from /dev/sdX1 via BIOS. There is some hope it will do for
 UEFI, too.)


Have a nice day :)

Thomas




--
Renato Bispo

Reply to: