Re: make installworld -DNO_ROOT

From: Brooks Davis <brooks_at_freebsd.org>
Date: Wed, 12 Apr 2023 18:36:13 UTC
On Tue, Apr 11, 2023 at 08:51:53PM -0700, Christopher Bowman wrote:
> 
> > On Apr 11, 2023, at 7:10 AM, Brooks Davis <brooks@freebsd.org> wrote:
> > 
> > These warnings are annoying, but mostly harmless.  A stalled
> > and seemingly not quite right review to address the issue is at
> > https://reviews.freebsd.org/D30990
> > 
> > -- Brooks
> > 
> > On Mon, Apr 10, 2023 at 12:00:45AM -0700, Christopher Bowman wrote:
> >> Id like to build some images and I???d like do that as an ordinary user NOT as root
> >> 
> >> I???m experimenting with ???make installworld -DNO_ROOT TARGET_ARCH=armv7???
> >> 
> >> When I do that or  ???make distribution -DNO_ROOT TARGET_ARCH=armv7???
> >> 
> >> I get the following error messages during the make run:
> >> 
> >> make[4] warning: /etc: Permission denied.
> >> make[4] warning: /lib: Permission denied.
> >> make[5] warning: /lib/geom: Permission denied.
> >> make[4] warning: /libexec: Permission denied.
> >> make[4] warning: /bin: Permission denied.
> >> make[4] warning: /rescue: Permission denied.
> >> make[4] warning: /sbin: Permission denied.
> >> make[4] warning: /etc: Permission denied.
> >> make[2] warning: /etc: Permission denied.
> >> make[3] warning: /etc/gss: Permission denied.
> >> make[3] warning: /etc/mtree: Permission denied.
> >> make[3] warning: /lib: Permission denied.
> >> make[4] warning: /lib/geom: Permission denied.
> >> make[3] warning: /libexec: Permission denied.
> >> make[3] warning: /bin: Permission denied.
> >> make[3] warning: /rescue: Permission denied.
> >> make[3] warning: /sbin: Permission denied.
> >> make[3] warning: /etc: Permission denied.
> >> 
> >> I think as a results either the recursive makes are failing or not doing all they are supposed to.
> >> 
> >> It???s possible I???m using -DNO_ROOT wrong but if anyone has some suggestions about what???s happening that would be very helpful.
> >> 
> >> In the alternative I???m open to suggestions as to how to debug the hugs set of make invocations.  I find reading and debug make files hard enough but on huge treee like this with all the invocations and arguments I???m kind lost as to even which command within the make files are causing this.
> >> 
> >> Thanks
> >> Christopher
> 
> It???s possible but I???m not so sure.
> I???m trying to build images and I???m using -DNO_ROOT to create a file system image without root privileges.  Then later I use makefs to build the filesystems images passing the METALOG file from the installworld/installkernel/distribution so that the files get the correct permission in the built filesystem.
> My METLOG file doesn???t have an entry for /etc/fstab so even though I had build such a file and place it in my image, it doesn???t get copied into my filesystem by makefs because there is no METLOG entry.  So I???m of two minds.  On the one hand, this is probably ok for /boot/loader.conf which I add to my image, after all it???s not strictly necessary that /boot/loader.conf exist in all systems, but I???m not getting an /etc/fstab even though I hand create the proper fstab because I have no METALOG entry for it, and this is absolutely an essential file.  What I???m not sure of is how this is supposed to work and I???d appreciate anyones feedback.
> 
> 1. I suppose it???s possible that fstab indeed isn???t created by make distribution and so I should hand create a METALOG entry for it, but this leaves me wondering what other files are important but also don???t get copied because they don???t have a METALOG entry.  Perhaps there is a switch to makefs that would warn me of files in the image without METALOG entries?

/etc/fstab is normally created by the installer.  If you want to add one
you need to add a METALOG entry (METALOG use is all or nothing).  Note
that you can choose to store it outside DESTDIR and use contents=
keyword to specify an absolute path to it if you prefer.

I'm not sure if there's an easy way to check for stray files in DESTDIR,
probably mtree can do it.

-- Brooks

> 
> 2. The /etc/fstab should have a METALOG entry and I???m doing something wrong, perhaps I???m missing a switch or options somewhere.
> 
> In any even I welcome any feedback and thank you for the response you???ve already sent.
> Regards,
> Christopher	
>