freebsd / poudriere

Port/Package build and test system
https://github.com/freebsd/poudriere/wiki
BSD 2-Clause "Simplified" License
379 stars 161 forks source link

poudriere image -t usb+zmfs fails with mkimg: partition 1: No such file or directory #958

Open opsec opened 2 years ago

opsec commented 2 years ago

Prerequisites

Describe the bug

poudriere image -t usb+zmfs fails with mkimg: partition 1: No such file or directory

How to reproduce

Steps to reproduce the behavior:

  1. Create a jail with a kernel: poudriere jail -c -j 13 -v 13.0-RELEASE -K -a amd64
  2. mkdir /tmp/img
  3. poudriere image -j 13 -o /tmp/img -t usb+zmfs
  4. See error, full log at https://people.freebsd.org/~pi/logs/poudriere-image.txt

Expected behavior

It should have build some valid .img file

Screenshots

See above

Environment

Additional context

davidchisnall commented 2 years ago

This is caused by the gptboot parameter not having the correct value. I have this fix locally:

-                       gptboot="-p freebsd-boot:=${mnt}/boot/gptzfsboot:512k"
+                       gptboot="-p freebsd-boot::512K=${mnt}/boot/gptzfsboot"
bdrewery commented 2 years ago

Is there any sane documentation about mkimg -p?

@davidchisnall

This is caused by the gptboot parameter not having the correct value. I have this fix locally:

-                       gptboot="-p freebsd-boot:=${mnt}/boot/gptzfsboot:512k"
+                       gptboot="-p freebsd-boot::512K=${mnt}/boot/gptzfsboot"

The linked code isn't used for usb+zmfs and this bug is from Poudriere 3.3 which doesn't have the :512k. If there is another bug here please open a separate issue.

bdrewery commented 2 years ago
+ mkimg -s gpt -b /poudriere/jails/13amd64_kern/boot/pmbr -p 'efi:=/poudriere/jails/13amd64_kern/boot/boot1.efifat' -p 'freebsd-boot:=/poudriere/jails/13amd64_kern/boot/gptboot' -p 'freebsd-ufs:=/poudrier
e/data/images/poudriereimage-KdLy/img.part' -o /tmp/img/poudriereimage.img
mkimg: partition 1: No such file or directory
ls: /poudriere/jails/13amd64_kern/boot/boot1.efifat: No such file or directory

I'm thinking this is the problem and that commit b392a79b7079024ea4fad466558b0bcb1380f339 will fix.

bdrewery commented 2 years ago

Yeah that and a few other commits fixes it.

Populating `/poudriere/data/images/poudriereimage-kyh6/img.part'
Image `/poudriere/data/images/poudriereimage-kyh6/img.part' complete
[00:08:34] Image available at: /tmp/img/poudriereimage.img

I will push it out to the release branch tomorrow but I don't plan to do a release very quickly.

Needed b835314c1c83d069eb9edd8b1485c989107e1a13 b392a79b7079024ea4fad466558b0bcb1380f339 de9abd5885f5256fd20b01db4b3a1f5a5829e846 665dfe7dff528419abb7ecb24f21e25a81ac6fab 44c2fcb7548c1764776929d6ed3ac4e61ddf8b57 (<-probably isn't needed but does not hurt) f3af93529a19aa0b105c96570c6593a594171a57

davidchisnall commented 2 years ago

Sorry, I saw the same error making ZFS images. #962 fixes this error - it was confusing because mkimg reports very unhelpful error messages (it doesn't document anywhere, for example, that it counts from 1, not 0, so I spent a while looking at the wrong partition). The -p flag is documented only in the examples bit of the manual, so I have no idea what the syntax actually means, I just tweaked it to look more like the example until it worked.

jlduran commented 2 years ago

The -p flag is documented only in the examples bit of the manual, so I have no idea what the syntax actually means, I just tweaked it to look more like the example until it worked.

Take a look at mkimg's help:

    partition specification:
        <t>[/<l>]::<size>[:[+]<offset>] -  empty partition of given size and
                                           optional relative or absolute offset
        <t>[/<l>]:=<file>[:[+]offset]   -  partition content and size are
                                           determined by the named file and
                                           optional relative or absolute offset
        <t>[/<l>]:-<cmd>                -  partition content and size are taken
                                           from the output of the command to run
        -                               -  unused partition entry
            where:
                <t>     -  scheme neutral partition type
                <l>     -  optional scheme-dependent partition label
davidchisnall commented 2 years ago

Ah, silly me, I was looking in the man page for documentation.