poudriere icon indicating copy to clipboard operation
poudriere copied to clipboard

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

Open opsec opened this issue 3 years ago • 7 comments

Prerequisites

  • [X] Have you checked for an existing issue describing your problem?
  • [X] Are you running the latest version? 3.3.7_1
  • [X] Is your ports tree recent? mostly, yes
  • [X] Is your FreeBSD Host on a supported release? It's on 14.0 build on Tue Oct 19 13:10:59 CEST 2021

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

  • Host OS: 14.0 build on Tue Oct 19 13:10:59 CEST 2021
  • Jail OS: 13.0p5
  • Browser: n/a
  • Poudriere Version: 3.3.7_1
  • Ports branch and revision: edd81fcb64, packages mostly from the last few month

Additional context

opsec avatar Nov 28 '21 20:11 opsec

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"

davidchisnall avatar Nov 29 '21 14:11 davidchisnall

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 avatar Nov 30 '21 19:11 bdrewery

+ 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 avatar Dec 01 '21 00:12 bdrewery

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

bdrewery avatar Dec 01 '21 04:12 bdrewery

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.

davidchisnall avatar Dec 02 '21 15:12 davidchisnall

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

jlduran avatar Dec 02 '21 16:12 jlduran

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

davidchisnall avatar Dec 02 '21 16:12 davidchisnall