Bug 255639 - [nanobsd] "missing directory in specification" while building disk image
Summary: [nanobsd] "missing directory in specification" while building disk image
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-05 22:05 UTC by Paulo Roberto Candido dos Santos
Modified: 2024-01-23 22:40 UTC (History)
5 users (show)

See Also:
linimon: mfc-stable14?
linimon: mfc-stable13?


Attachments
Add missing files to metalog. (914 bytes, patch)
2021-05-05 22:05 UTC, Paulo Roberto Candido dos Santos
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Roberto Candido dos Santos 2021-05-05 22:05:13 UTC
Created attachment 224711 [details]
Add missing files to metalog.

Hello.

I've been trying to build a NanoBSD image using releng/13.0 and the process fails during the image creation step complaining about directories that are not included in the metalog. 

I'm using the provided tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg without any  modification.

Here is the relevant bit of the /usr/embedded/qemu-amd64-uefi/_.di log:

+ eval 'makefs -t ffs -B little' -F /usr/embedded/obj/_.metalog /usr/embedded/qemu-amd64-uefi/_.s3 /usr/embedded/qemu-amd64-uefi/_.w
+ makefs -t ffs -B little -F /usr/embedded/obj/_.metalog /usr/embedded/qemu-amd64-uefi/_.s3 /usr/embedded/qemu-amd64-uefi/_.w
makefs: ./etc/ssl/blacklisted: missing directory in specification

Apparently these directories are not added to /usr/embedded/obj/_.metalog during the nanobsd.sh process.

I was able to complete these step by adding ./etc/ssl/blacklisted and ./etc/ssl/certs into the fix_pkg function in tools/tools/nanobsd/embedded/common.
Comment 1 Max 2023-01-23 22:58:11 UTC
Hello,

Could you please let us know which branch the proposed patch will be merged to?

As for me the nanobsd image build succeeded when I added the lines 422-426 in tools/tools/nanobsd/embedded/common
```
        echo "./etc/ssl type=dir uname=root gname=wheel mode=0755"
        echo "./etc/ssl/blacklisted type=dir uname=root gname=wheel mode=0755"
        echo "./etc/ssl/certs type=dir uname=root gname=wheel mode=0755"
        echo "./usr/share/keys/ssl type=dir uname=root gname=wheel mode=0755"
        echo "./usr/share/keys/ssl/certs type=dir uname=root gname=wheel mode=0755"
```
Possibly for better visualization of diff I uploaded it on GitHub
https://github.com/ghostbsd/ghostbsd-src/compare/stable/13...maxsteciuk:ghostbsd:stable/13#diff-ec54d95a1ddfea75136ffd5b2f1a0bd25f300e3effb4b0e54fa89e8132493301

Thanks
Max
Comment 2 Warner Losh freebsd_committer freebsd_triage 2023-01-24 22:29:18 UTC
(In reply to Max from comment #1)
> Could you please let us know which branch the proposed patch will be merged to?

The changes look good generically, though I'd likely sort them differently.
Comment 3 OlivierW 2023-04-29 10:09:23 UTC
I just got the same problem, it would be awesome if it could be merged before the release of FreeBSD 14.0! :-)

Thanks!
Comment 4 Luc Hondareyte 2023-09-28 16:09:00 UTC
Yes, it would be nice if it was committed in 14.

Follow a sorted patch :-)

*** common.ori	2023-09-28 17:46:57.376441000 +0200
--- common	2023-09-28 18:00:35.465424000 +0200
*************** fix_pkg ( ) (
*** 410,415 ****
--- 410,420 ----
  	echo "./pkg/cache type=dir uname=root gname=wheel mode=0755"
  	echo "./pkg/db type=dir uname=root gname=wheel mode=0755"
  	echo "./pkg/tmp type=dir uname=root gname=wheel mode=0755"
+ 	echo "./usr/share/keys/ssl type=dir uname=root gname=wheel mode=0755"
+ 	echo "./usr/share/keys/ssl/certs type=dir uname=root gname=wheel mode=0755"
+ 	echo "./etc/ssl type=dir uname=root gname=wheel mode=0755"
+ 	echo "./etc/ssl/blacklisted type=dir uname=root gname=wheel mode=0755"
+ 	echo "./etc/ssl/certs type=dir uname=root gname=wheel mode=0755"
  	) >> ${NANO_METALOG}
  )
  customize_cmd fix_pkg
Comment 5 Jose Luis Duran 2023-11-29 16:04:12 UTC
I had something similar in a non-upstreamed branch:

--- a/tools/tools/nanobsd/embedded/common
+++ b/tools/tools/nanobsd/embedded/common
@@ -411,6 +411,20 @@ fix_pkg ( ) (
 )
 customize_cmd fix_pkg
 
+fix_certctl ( ) (
+	chdir ${NANO_WORLDDIR}
+	mkdir -p etc/ssl/blacklisted
+	mkdir -p etc/ssl/certs
+	mkdir -p etc/ssl/untrusted
+	[ -z ${NANO_NOPRIV_BUILD} ] || (
+	echo "./etc/ssl type=dir uname=root gname=wheel mode=0755"
+	echo "./etc/ssl/blacklisted type=dir uname=root gname=wheel mode=0755"
+	echo "./etc/ssl/certs type=dir uname=root gname=wheel mode=0755"
+	echo "./etc/ssl/untrusted type=dir uname=root gname=wheel mode=0755"
+	) >> ${NANO_METALOG}
+)
+customize_cmd fix_certctl
+
 save_build ( ) (
 	VERSION_FILE=${NANO_WORLDDIR}/etc/version
 	if [ "${SVNREVISION}" = "${REVISION}" ]; then

However, I think the real problem is that this information is missing from the mtree (in /etc/mtree/BSD.root.dist).  I have switched to building images with poudriere, but I may revisit this issue soon-ish, and confirm it.
Comment 6 Jose Luis Duran 2023-11-29 16:31:46 UTC
(In reply to Jose Luis Duran from comment #5)
Note to self: blacklisted -> untrusted (should not need the former).
Comment 7 Jose Luis Duran 2023-11-29 17:03:03 UTC
Suggested fix: https://github.com/freebsd/freebsd-src/pull/912
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-12-28 06:25:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5b7f73ce16cbd3704b21943ebe6b489b2bc2de1f

commit 5b7f73ce16cbd3704b21943ebe6b489b2bc2de1f
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2023-12-28 05:26:23 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-12-28 05:26:28 +0000

    mtree: Add missing directories generated by certctl

    PR: 255639
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/912

 etc/mtree/BSD.root.dist | 4 ++++
 1 file changed, 4 insertions(+)
Comment 9 Mark Linimon freebsd_committer freebsd_triage 2023-12-31 05:44:20 UTC
^Triage: assign to committer and set mfc flags.
Comment 10 Jose Luis Duran 2024-01-23 22:40:16 UTC
I think the issue is no longer present. At least, I was not able to reproduce it.