NetBSD Problem Report #56132

From root@whooppee.com  Mon Apr 26 21:39:12 2021
Return-Path: <root@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C7BE31A9275
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Apr 2021 21:39:12 +0000 (UTC)
Message-Id: <20210426213909.31ADA30F2C4@speedy.whooppee.com>
Date: Mon, 26 Apr 2021 14:39:09 -0700 (PDT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: build.sh target install-image fails in update-mode
X-Send-Pr-Version: 3.95

>Number:         56132
>Category:       install
>Synopsis:       build.sh in update mode fails for target install-image
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 26 21:40:00 +0000 2021
>Closed-Date:    Wed Jun 09 01:37:36 +0000 2021
>Last-Modified:  Wed Jun 09 01:40:01 +0000 2021
>Originator:     Paul Goyette
>Release:        NetBSD 9.99.81
>Organization:
+--------------------+--------------------------+-----------------------+
| Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
| (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul@whooppee.com     |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette@netbsd.org   |
+--------------------+--------------------------+-----------------------+
>Environment:


System: NetBSD speedy.whooppee.com 9.99.81 NetBSD 9.99.81 (SPEEDY 2021-04-16 18:08:17 UTC) #1: Fri Apr 16 19:24:03 UTC 2021 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
(Note: PR category set to "install" - please advise if there is a
better category to use.)

If you run ``build.sh ... install-image'' but the build fails because
the INSTIMAGEMB value is too small, even if you update the variable's
value sufficiently, a subsequent ``build.sh ... -u install-image'' will
still fail.  It appears to still be using incorrect MBR and/or GPT data
from the original build.sh invocation.

>How-To-Repeat:
See above.

For example, after craeting a complete release you can try

./build.sh	-T /build/netbsd-local/tools/x86_64/amd64 \
		-D /build/netbsd-local/dest/amd64 \
		-O /build/netbsd-local/obj/amd64 \
		-R /build/netbsd-local/release \
		-V RELEASEMACHINEDIR=amd64 -V MKDEBUG=yes \
		-V MKKDEBUG=yes -V MKDEBUGLIB=yes \
		-V KERNEL_DIR=no -V MKPAM=no -U -x -N2 -m amd64 \
		-j1 -V INSTIMAGEMB=1600 install-image

This will fail due to the too-small value for INSTIMAGEMB:

nbmakefs: `work' size of 1611005952 is larger than the maxsize of 1541406720.

Then retry an update with

./build.sh	-T /build/netbsd-local/tools/x86_64/amd64 \
		-D /build/netbsd-local/dest/amd64 \
		-O /build/netbsd-local/obj/amd64 \
		-R /build/netbsd-local/release \
		-V RELEASEMACHINEDIR=amd64 -V MKDEBUG=yes \
		-V MKKDEBUG=yes -V MKDEBUGLIB=yes \
		-V KERNEL_DIR=no -V MKPAM=no -U -x -N2 -m amd64 \
		-j1 -V INSTIMAGEMB=1700 -u install-image

This will result in a failure which appears to be gpt-related:

nbgpt: work.img: No secondary GPT header; run recover


>Fix:
Please


>Release-Note:

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Wed, 28 Apr 2021 02:29:57 +0900

 > For example, after craeting a complete release you can try
 > 
 > ./build.sh	-T /build/netbsd-local/tools/x86_64/amd64 \
 > 		-D /build/netbsd-local/dest/amd64 \
 > 		-O /build/netbsd-local/obj/amd64 \
 > 		-R /build/netbsd-local/release \
 > 		-V RELEASEMACHINEDIR=amd64 -V MKDEBUG=yes \
 > 		-V MKKDEBUG=yes -V MKDEBUGLIB=yes \
 > 		-V KERNEL_DIR=no -V MKPAM=no -U -x -N2 -m amd64 \
 > 		-j1 -V INSTIMAGEMB=1600 install-image
 > 
 > This will fail due to the too-small value for INSTIMAGEMB:
 > 
 > nbmakefs: `work' size of 1611005952 is larger than the maxsize of 1541406720.

 Could you show output of 'ls -l' in your $OBJDIR of
 src/distrib/amd64/uefi-installimage?

 Maybe this is amd64 specific (i.e. gpt/uefi version specific) and
 I guess some work.* file (especially work.gpt?) should be removed
 on makefs failure (or created after the makefs is complete, or
 recreated if its size is not match).

 ---
 Izumi Tsutsui

From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org, tsutsui@netbsd.org
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Tue, 27 Apr 2021 20:59:16 -0700 (PDT)

 On Tue, 27 Apr 2021, Izumi Tsutsui wrote:

 > Could you show output of 'ls -l' in your $OBJDIR of
 > src/distrib/amd64/uefi-installimage?

 There is no uefi-installimage (only install-image)...

 Here's what we get when building with too-small size...

 $ rm -rf /build/netbsd-local/obj/amd64/distrib/amd64/installimage/
 $ ./build.sh	-T /build/netbsd-local/tools/x86_64/amd64 \
  		-D /build/netbsd-local/dest/amd64 \
  		-O /build/netbsd-local/obj/amd64 \
  		-R /build/netbsd-local/release \
  		-V RELEASEMACHINEDIR=amd64 -V MKDEBUG=yes \
  		-V MKKDEBUG=yes -V MKDEBUGLIB=yes \
  		-V KERNEL_DIR=no -V MKPAM=no \
  	-U -x -N2 -m amd64 -j1 -V INSTIMAGEMB=1600 install-image
 ...
 Creating rootfs...
 chmod +r work/var/spool/ftp/hidden
 /build/netbsd-local/tools/x86_64/amd64/bin/nbmakefs -M 1541406720 -m 1541406720                  -B 1234                                         -F work.spec -N work/etc                                                                                -o bsize=16384,fsize=2048,density=8192                                          work.rootfs work
 nbmakefs: `work' size of 1611087872 is larger than the maxsize of 1541406720.
 ...
 ERROR: Failed to make install-image
 *** BUILD ABORTED ***
 $ ls -l /build/netbsd-local/src/distrib/amd64/total 36
 drwxrwxr-x  2 paul  staff  512 Apr 27 16:16 CVS
 -rw-r--r--  1 paul  staff  485 May 27  2020 Makefile
 drwxrwxr-x  6 paul  staff  512 Mar  6 20:04 cdroms
 drwxrwxr-x  4 paul  staff  512 Apr 27 20:45 installimage
 drwxrwxr-x  3 paul  staff  512 Jan 28  2019 instkernel
 drwxrwxr-x  3 paul  staff  512 Jan 28  2019 kmod
 drwxrwxr-x  3 paul  staff  512 Jan 28  2019 kmod-cgdroot
 drwxrwxr-x  4 paul  staff  512 Apr 27 16:16 liveimage
 drwxrwxr-x  7 paul  staff  512 Feb 22  2020 ramdisks
 $ ls -l /build/netbsd-local/src/distrib/amd64/installimage/
 total 2444
 drwxrwxr-x   2 paul  staff         512 Apr 27 16:12 CVS
 -rw-r--r--   1 paul  staff        1340 Apr 26 07:08 Makefile
 -rw-rw-r--   1 paul  staff         337 Apr 27 20:45 boot.cfg
 -rw-r--r--   1 paul  staff         347 Apr 24  2019 boot.cfg.in
 -rw-r--r--   1 paul  staff        2225 Feb 26  2020 etc.rc
 -rw-r--r--   1 paul  staff         208 Jan 28  2019 etc.ttys
 -rw-r--r--   1 paul  staff        3082 Jan 28  2019 install.sh
 -rw-r--r--   1 paul  staff         684 Jan 28  2019 spec.inst
 drwxr-xr-x  18 paul  staff         512 Apr 27 20:45 work
 -rw-rw-r--   1 paul  staff          87 Apr 27 20:45 work.fstab
 -rw-rw-r--   1 paul  staff  1677721600 Apr 27 20:45 work.mbr
 -rw-rw-r--   1 paul  staff     1048576 Apr 27 20:45 work.mbr.truncated
 -rw-rw-r--   1 paul  staff         545 Apr 27 20:45 work.rc.conf
 -rw-rw-r--   1 paul  staff     1188141 Apr 27 20:45 work.spec
 $

 And here is where we retry with a big-enough value for INSTIMAGEMB
 (_and_ adding -u to the build.sh command line)...

 $ ./build.sh	-T /build/netbsd-local/tools/x86_64/amd64 \
  		-D /build/netbsd-local/dest/amd64 \
  		-O /build/netbsd-local/obj/amd64 \
  		-R /build/netbsd-local/release \
  		-V RELEASEMACHINEDIR=amd64 -V MKDEBUG=yes \
  		-V MKKDEBUG=yes -V MKDEBUGLIB=yes \
  		-V KERNEL_DIR=no -V MKPAM=no \
  	-U -x -N2 -m amd64 -j1 -u -V INSTIMAGEMB=1700 install-image
 ...
 Creating rootfs...
 chmod +r work/var/spool/ftp/hidden
 /build/netbsd-local/tools/x86_64/amd64/bin/nbmakefs -M 1646264320 -m 1646264320                  -B 1234                                         -F work.spec -N work/etc                                                                                -o bsize=16384,fsize=2048,density=8192                                          work.rootfs work
 Calculated size of `work.rootfs': 1646264320 bytes, 10504 inodes
 Extent size set to 16384
 work.rootfs: 1570.0MB (3215360 sectors) block size 16384, fragment size 2048
          using 9 cylinder groups of 183.86MB, 11767 blks, 23552 inodes.
 super-block backups (for fsck -b #) at:
        32,  376576,  753120, 1129664, 1506208, 1882752, 2259296, 2635840, 3012384,
 Populating `work.rootfs'
 ...
 create GPT image...
 dd if=work.mbr of=work.gpt skip=$((3481600 - 2048))  count=2048
 0+0 records in
 0+0 records out
 0 bytes transferred in 0.001 secs (0 bytes/sec)
 cat  work.mbr.truncated work.efi imgroot.fs work.gpt > work.img
 /build/netbsd-local/tools/x86_64/amd64/bin/nbgpt  work.img biosboot -i 2                 -c /build/netbsd-local/src/distrib/amd64/installimage/work/usr/mdec/gptmbr.bin
 nbgpt: work.img: No secondary GPT header; run recover
 *** Failed target:  NetBSD-9.99.82-amd64-install.img
 *** Failed command: /build/netbsd-local/tools/x86_64/amd64/bin/nbgpt work.img biosboot -i 2 -c /build/netbsd-local/src/distrib/amd64/installimage/work/usr/mdec/gptmbr.bin
 *** Error code 1
 ...
 ERROR: Failed to make install-image
 *** BUILD ABORTED ***
 $ ls -l /build/netbsd-local/src/distrib/amd64/installimage/
 total 3353136
 drwxrwxr-x   2 paul  staff         512 Apr 27 16:12 CVS
 -rw-r--r--   1 paul  staff        1340 Apr 26 07:08 Makefile
 -rw-rw-r--   1 paul  staff         337 Apr 27 20:52 boot.cfg
 -rw-r--r--   1 paul  staff         347 Apr 24  2019 boot.cfg.in
 -rw-r--r--   1 paul  staff        2225 Feb 26  2020 etc.rc
 -rw-r--r--   1 paul  staff         208 Jan 28  2019 etc.ttys
 -rw-rw-r--   1 paul  staff  1646264320 Apr 27 20:52 imgroot.fs
 -rw-r--r--   1 paul  staff        3082 Jan 28  2019 install.sh
 -rw-r--r--   1 paul  staff         684 Jan 28  2019 spec.inst
 drwxr-xr-x  18 paul  staff         512 Apr 27 20:52 work
 -rw-r--r--   1 paul  staff   134217728 Apr 27 20:52 work.efi
 drwxrwxr-x   3 paul  staff         512 Apr 27 20:52 work.efidir
 -rw-rw-r--   1 paul  staff          87 Apr 27 20:45 work.fstab
 -rw-rw-r--   1 paul  staff           0 Apr 27 20:52 work.gpt
 -rw-rw-r--   1 paul  staff  1781530624 Apr 27 20:52 work.img
 -rw-rw-r--   1 paul  staff  1677721600 Apr 27 20:45 work.mbr
 -rw-rw-r--   1 paul  staff     1048576 Apr 27 20:45 work.mbr.truncated
 -rw-rw-r--   1 paul  staff         545 Apr 27 20:52 work.rc.conf
 -rw-rw-r--   1 paul  staff     1188141 Apr 27 20:52 work.spec
 $ ls -l /build/netbsd-local/src/distrib/amd64/installimage/work/
 total 25248
 -r--r--r--   2 paul  staff      1186 Apr 27 18:02 .cshrc
 -r--r--r--   2 paul  staff       702 Apr 27 18:02 .profile
 drwxr-xr-x   2 paul  staff       512 Apr 27 16:41 altroot
 drwxr-xr-x   4 paul  staff       512 Apr 27 18:11 amd64
 drwxr-xr-x   2 paul  staff      1024 Apr 27 18:01 bin
 -r--r--r--   1 paul  staff     85208 Apr 27 20:52 boot
 -rw-r--r--   1 paul  staff       337 Apr 27 20:52 boot.cfg
 drwxr-xr-x   5 paul  staff       512 Apr 27 20:52 dev
 drwxrwxr-x  30 paul  staff      2048 Apr 27 20:52 etc
 -rw-r--r--   1 paul  staff      3082 Apr 27 20:52 install.sh
 drwxr-xr-x   4 paul  staff      2560 Apr 27 18:02 lib
 drwxr-xr-x   3 paul  staff       512 Apr 27 16:41 libdata
 drwxr-xr-x   5 paul  staff       512 Apr 27 18:02 libexec
 drwxr-xr-x   2 paul  staff       512 Apr 27 16:41 mnt
 -rwxr-xr-x   1 paul  staff  29081816 Apr 27 18:10 netbsd
 drwxr-xr-x   2 paul  staff       512 Apr 27 18:02 rescue
 drwxr-xr-x   2 paul  staff       512 Apr 27 20:52 root
 drwxr-xr-x   2 paul  staff      3072 Apr 27 18:02 sbin
 drwxrwxr-x   3 paul  staff       512 Apr 27 18:01 stand
 -rw-r--r--   1 paul  staff    447888 Apr 27 20:52 sysinst
 -rw-r--r--   1 paul  staff     38714 Apr 27 20:52 sysinstmsgs.de
 -rw-r--r--   1 paul  staff     37488 Apr 27 20:52 sysinstmsgs.es
 -rw-r--r--   1 paul  staff     38285 Apr 27 20:52 sysinstmsgs.fr
 -rw-r--r--   1 paul  staff     34327 Apr 27 20:52 sysinstmsgs.pl
 drwxrwxr-x   2 paul  staff       512 Apr 27 16:41 tmp
 drwxr-xr-x  11 paul  staff       512 Apr 27 16:41 usr
 drwxr-xr-x  24 paul  staff       512 Apr 27 16:41 var
 $




 +--------------------+--------------------------+-----------------------+
 | Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
 | (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul@whooppee.com     |
 | Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette@netbsd.org   |
 +--------------------+--------------------------+-----------------------+

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: paul@whooppee.com
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Thu, 29 Apr 2021 04:28:06 +0900

 > > Could you show output of 'ls -l' in your $OBJDIR of
 > > src/distrib/amd64/uefi-installimage?
 > 
 > There is no uefi-installimage (only install-image)...

 Ah, I looked at netbsd-9 src tree..

 > Here's what we get when building with too-small size...

  :

 > $ ls -l /build/netbsd-local/src/distrib/amd64/installimage/
 > total 2444
 > drwxrwxr-x   2 paul  staff         512 Apr 27 16:12 CVS
 > -rw-r--r--   1 paul  staff        1340 Apr 26 07:08 Makefile
 > -rw-rw-r--   1 paul  staff         337 Apr 27 20:45 boot.cfg
 > -rw-r--r--   1 paul  staff         347 Apr 24  2019 boot.cfg.in
 > -rw-r--r--   1 paul  staff        2225 Feb 26  2020 etc.rc
 > -rw-r--r--   1 paul  staff         208 Jan 28  2019 etc.ttys
 > -rw-r--r--   1 paul  staff        3082 Jan 28  2019 install.sh
 > -rw-r--r--   1 paul  staff         684 Jan 28  2019 spec.inst
 > drwxr-xr-x  18 paul  staff         512 Apr 27 20:45 work
 > -rw-rw-r--   1 paul  staff          87 Apr 27 20:45 work.fstab
 > -rw-rw-r--   1 paul  staff  1677721600 Apr 27 20:45 work.mbr
 > -rw-rw-r--   1 paul  staff     1048576 Apr 27 20:45 work.mbr.truncated
 > -rw-rw-r--   1 paul  staff         545 Apr 27 20:45 work.rc.conf
 > -rw-rw-r--   1 paul  staff     1188141 Apr 27 20:45 work.spec
 > $
 > 
 > And here is where we retry with a big-enough value for INSTIMAGEMB
 > (_and_ adding -u to the build.sh command line)...

  :

 > /build/netbsd-local/tools/x86_64/amd64/bin/nbgpt  work.img biosboot -i 2                 -c /build/netbsd-local/src/distrib/amd64/installimage/work/usr/mdec/gptmbr.bin
 > nbgpt: work.img: No secondary GPT header; run recover
 > *** Failed target:  NetBSD-9.99.82-amd64-install.img
 > *** Failed command: /build/netbsd-local/tools/x86_64/amd64/bin/nbgpt work.img biosboot -i 2 -c /build/netbsd-local/src/distrib/amd64/installimage/work/usr/mdec/gptmbr.bin
 > *** Error code 1
 > ...
 > ERROR: Failed to make install-image
 > *** BUILD ABORTED ***
 > $ ls -l /build/netbsd-local/src/distrib/amd64/installimage/
 > total 3353136
 > drwxrwxr-x   2 paul  staff         512 Apr 27 16:12 CVS
 > -rw-r--r--   1 paul  staff        1340 Apr 26 07:08 Makefile
 > -rw-rw-r--   1 paul  staff         337 Apr 27 20:52 boot.cfg
 > -rw-r--r--   1 paul  staff         347 Apr 24  2019 boot.cfg.in
 > -rw-r--r--   1 paul  staff        2225 Feb 26  2020 etc.rc
 > -rw-r--r--   1 paul  staff         208 Jan 28  2019 etc.ttys
 > -rw-rw-r--   1 paul  staff  1646264320 Apr 27 20:52 imgroot.fs
 > -rw-r--r--   1 paul  staff        3082 Jan 28  2019 install.sh
 > -rw-r--r--   1 paul  staff         684 Jan 28  2019 spec.inst
 > drwxr-xr-x  18 paul  staff         512 Apr 27 20:52 work
 > -rw-r--r--   1 paul  staff   134217728 Apr 27 20:52 work.efi
 > drwxrwxr-x   3 paul  staff         512 Apr 27 20:52 work.efidir
 > -rw-rw-r--   1 paul  staff          87 Apr 27 20:45 work.fstab
 > -rw-rw-r--   1 paul  staff           0 Apr 27 20:52 work.gpt
 > -rw-rw-r--   1 paul  staff  1781530624 Apr 27 20:52 work.img
 > -rw-rw-r--   1 paul  staff  1677721600 Apr 27 20:45 work.mbr
 > -rw-rw-r--   1 paul  staff     1048576 Apr 27 20:45 work.mbr.truncated
 > -rw-rw-r--   1 paul  staff         545 Apr 27 20:52 work.rc.conf
 > -rw-rw-r--   1 paul  staff     1188141 Apr 27 20:52 work.spec

 Ok, I see.  ${WORKMBR} depends on ${IMAGESECTORS} and also includes
 GPT info that depends on the image size (the secondary GPT "header"
 is located at the end of the disk), so ${WORKMBR} should be recreated
 if ${IMAGEMB} is changed, but there is no explicit dependecy
 lines for it in src/distrib/common/bootimage/Makefile.bootimage.

 For workaround, it would work to make ${WORKMBR} depend on ${TARGETFS}
 (i.e. create ${WORKMBR} after ${TARGETFS} by ${TOOL_MAKEFS} is complete).

 How about this change? (untested)

 Index: distrib/common/bootimage/Makefile.bootimage
 ===================================================================
 RCS file: /cvsroot/src/distrib/common/bootimage/Makefile.bootimage,v
 retrieving revision 1.26
 diff -u -p -d -r1.26 Makefile.bootimage
 --- distrib/common/bootimage/Makefile.bootimage	5 Aug 2020 01:35:18 -0000	1.26
 +++ distrib/common/bootimage/Makefile.bootimage	28 Apr 2021 19:16:04 -0000
 @@ -499,7 +499,7 @@ ${WORKFAT}: ${TARGETFS} ${FATFILES}
  	    ${FATMAKEFSOPTIONS}						\
  	    ${WORKFAT} ${WORKFATDIR}

 -${WORKMBR}:
 +${WORKMBR}: ${TARGETFS}
  .if ${USE_GPT} != "no"
  	@echo creating GPT header and partition entries...
  	${RM} -f ${WORKMBR}

 ---
 Izumi Tsutsui

From: Paul Goyette <paul@whooppee.com>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Wed, 28 Apr 2021 15:10:03 -0700 (PDT)

 On Thu, 29 Apr 2021, Izumi Tsutsui wrote:

 > <snip>
 >
 > Ok, I see.  ${WORKMBR} depends on ${IMAGESECTORS} and also includes
 > GPT info that depends on the image size (the secondary GPT "header"
 > is located at the end of the disk), so ${WORKMBR} should be recreated
 > if ${IMAGEMB} is changed, but there is no explicit dependecy
 > lines for it in src/distrib/common/bootimage/Makefile.bootimage.
 >
 > For workaround, it would work to make ${WORKMBR} depend on ${TARGETFS}
 > (i.e. create ${WORKMBR} after ${TARGETFS} by ${TOOL_MAKEFS} is complete).
 >
 > How about this change? (untested)
 >
 > Index: distrib/common/bootimage/Makefile.bootimage
 > ===================================================================
 > RCS file: /cvsroot/src/distrib/common/bootimage/Makefile.bootimage,v
 > retrieving revision 1.26
 > diff -u -p -d -r1.26 Makefile.bootimage
 > --- distrib/common/bootimage/Makefile.bootimage	5 Aug 2020 01:35:18 -0000	1.26
 > +++ distrib/common/bootimage/Makefile.bootimage	28 Apr 2021 19:16:04 -0000
 > @@ -499,7 +499,7 @@ ${WORKFAT}: ${TARGETFS} ${FATFILES}
 > 	    ${FATMAKEFSOPTIONS}						\
 > 	    ${WORKFAT} ${WORKFATDIR}
 >
 > -${WORKMBR}:
 > +${WORKMBR}: ${TARGETFS}
 > .if ${USE_GPT} != "no"
 > 	@echo creating GPT header and partition entries...
 > 	${RM} -f ${WORKMBR}

 That doesn't seem to work.  Looks like the new depedency causes a loop.

 ...
 /build/netbsd-local/tools/x86_64/amd64/bin/nbsed                                                         -e "s/@@MACHINE@@/amd64/"                               -e "s/@@VERSION@@/9.99.82/"                             < /build/netbsd-local/src/distrib/amd64/installimage/boot.cfg.in > boot.cfg
 nbmake[4]: Graph cycles through work.mbr   <<<<<<<<<<<<<<<<<
 create EFI system partition...
 /build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-install -c -m 0644 work/usr/mdec/bootx64.efi work.efidir/EFI/boot/`basename work/usr/mdec/bootx64.efi`
 x86_64--netbsd-install: work/usr/mdec/bootx64.efi: stat: No such file or directory
 *** Failed target:  work.efi
 *** Failed command: 
 /build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-install -c -m 0644 work/usr/mdec/bootx64.efi work.efidir/EFI/boot/`basename work/usr/mdec/bootx64.efi`
 *** Error code 1
 Stop.



 +--------------------+--------------------------+-----------------------+
 | Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
 | (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul@whooppee.com     |
 | Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette@netbsd.org   |
 +--------------------+--------------------------+-----------------------+

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: paul@whooppee.com
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Thu, 29 Apr 2021 07:41:30 +0900

 > > @@ -499,7 +499,7 @@ ${WORKFAT}: ${TARGETFS} ${FATFILES}
 > > 	    ${FATMAKEFSOPTIONS}						\
 > > 	    ${WORKFAT} ${WORKFATDIR}
 > >
 > > -${WORKMBR}:
 > > +${WORKMBR}: ${TARGETFS}
 > > .if ${USE_GPT} != "no"
 > > 	@echo creating GPT header and partition entries...
 > > 	${RM} -f ${WORKMBR}
 > 
 > That doesn't seem to work.  Looks like the new depedency causes a loop.
 > 
 > ...
 > /build/netbsd-local/tools/x86_64/amd64/bin/nbsed                                                         -e "s/@@MACHINE@@/amd64/"                               -e "s/@@VERSION@@/9.99.82/"                             < /build/netbsd-local/src/distrib/amd64/installimage/boot.cfg.in > boot.cfg
 > nbmake[4]: Graph cycles through work.mbr   <<<<<<<<<<<<<<<<<
 > create EFI system partition...
 > /build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-install -c -m 0644 work/usr/mdec/bootx64.efi work.efidir/EFI/boot/`basename work/usr/mdec/bootx64.efi`
 > x86_64--netbsd-install: work/usr/mdec/bootx64.efi: stat: No such file or directory

 Hmm. This seems caused by:

 > .if ${USE_GPT} != "no"
 > BOOTDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 2 | ${TOOL_AWK} '/^GUID/ {print $$2}'`
 > SWAPDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 3 | ${TOOL_AWK} '/^GUID/ {print $$2}'`
 > .endif

 and

 > .if ${USE_GPT} != "no"
 > ${WORKFSTAB}: ${WORKMBR}
 > .endif

 and

 > ${TARGETFS}: prepare_md_post ${WORKFSTAB}

 ${WORKFSTAB} needs to depend on ${WORKMBR} image file to get
 a UUID created by ${TOOL_GPT} with ${GPT_TIMESTAMP}?  Umm.
 (note GPT/UEFI part was not implemented by me)

 I wonder if we can calculate the UUID from ${GPT_TIMESTAMP}
 without an actual image, but anyway we need some dummy targets
 that checks and removes ${WORKMBR} if its size is different
 from ${IMAGESECTORS}?

 Needs make(1) guru..
 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: paul@whooppee.com
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Fri, 30 Apr 2021 01:20:14 +0900

 I wrote:

 > ${WORKFSTAB} needs to depend on ${WORKMBR} image file to get
 > a UUID created by ${TOOL_GPT} with ${GPT_TIMESTAMP}?  Umm.
 > (note GPT/UEFI part was not implemented by me)
 > 
 > I wonder if we can calculate the UUID from ${GPT_TIMESTAMP}
 > without an actual image, but anyway we need some dummy targets
 > that checks and removes ${WORKMBR} if its size is different
 > from ${IMAGESECTORS}?

 There are two options:

 1) always build ${WORKMBR} by .PHONY

 Rebuilding ${WORKMBR} seems fast enough (unlike ${TARGETFS} by makefs(8)).

 ---
 Index: distrib/common/bootimage/Makefile.bootimage
 ===================================================================
 RCS file: /cvsroot/src/distrib/common/bootimage/Makefile.bootimage,v
 retrieving revision 1.26
 diff -u -p -d -r1.26 Makefile.bootimage
 --- distrib/common/bootimage/Makefile.bootimage	5 Aug 2020 01:35:18 -0000	1.26
 +++ distrib/common/bootimage/Makefile.bootimage	29 Apr 2021 16:09:08 -0000
 @@ -499,7 +499,7 @@ ${WORKFAT}: ${TARGETFS} ${FATFILES}
  	    ${FATMAKEFSOPTIONS}						\
  	    ${WORKFAT} ${WORKFATDIR}

 -${WORKMBR}:
 +${WORKMBR}: .PHONY
  .if ${USE_GPT} != "no"
  	@echo creating GPT header and partition entries...
  	${RM} -f ${WORKMBR}
 ---

 2) check a size of ${WORKMBR} before building targets

 Not sure if .BEGIN is correct here..

 ---
 Index: distrib/common/bootimage/Makefile.bootimage
 ===================================================================
 RCS file: /cvsroot/src/distrib/common/bootimage/Makefile.bootimage,v
 retrieving revision 1.26
 diff -u -p -d -r1.26 Makefile.bootimage
 --- distrib/common/bootimage/Makefile.bootimage	5 Aug 2020 01:35:18 -0000	1.26
 +++ distrib/common/bootimage/Makefile.bootimage	29 Apr 2021 16:09:58 -0000
 @@ -294,6 +294,15 @@ WORKFATDIR?=	work.fatdir

  .if ${USE_GPT} != "no"
  ${WORKFSTAB}: ${WORKMBR}
 +
 +.BEGIN:
 +	@if [ -f ${WORKMBR} ]; then			 		\
 +		st_size=`${TOOL_STAT} -f %z ${WORKMBR}`;		\
 +		if [ "$$st_size" -ne "$$((${IMAGESECTORS} * 512))" ]; then \
 +			echo Removing stale ${WORKMBR} ...;		\
 +			rm -f ${WORKMBR};				\
 +		fi							\
 +	fi
  .endif

  ${WORKFSTAB}:
 ---

 > Needs make(1) guru..

 Anyway we need proper reviews..

 ---
 Izumi Tsutsui

From: Paul Goyette <paul@whooppee.com>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Sat, 1 May 2021 12:40:17 -0700 (PDT)

 On Fri, 30 Apr 2021, Izumi Tsutsui wrote:

 > There are two options:
 >
 > 1) always build ${WORKMBR} by .PHONY
 >
 > Rebuilding ${WORKMBR} seems fast enough (unlike ${TARGETFS} by makefs(8)).

 <patch snipped>

 > 2) check a size of ${WORKMBR} before building targets
 >
 > Not sure if .BEGIN is correct here..

 <another patch snipped>

 Both of these suggested changes appear to work correctly for me.


 > Anyway we need proper reviews..

 Yes!


 +--------------------+--------------------------+-----------------------+
 | Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
 | (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul@whooppee.com     |
 | Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette@netbsd.org   |
 +--------------------+--------------------------+-----------------------+

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: install/56132: build.sh target install-image fails in update-mode
Date: Tue, 1 Jun 2021 01:22:11 +0900

 I wrote:

 > Date: Fri, 30 Apr 2021 01:20:14 +0900
 > 
 >  I wrote:
 >  
 >  > ${WORKFSTAB} needs to depend on ${WORKMBR} image file to get
 >  > a UUID created by ${TOOL_GPT} with ${GPT_TIMESTAMP}?  Umm.
 >  > (note GPT/UEFI part was not implemented by me)
 >  > 
 >  > I wonder if we can calculate the UUID from ${GPT_TIMESTAMP}
 >  > without an actual image, but anyway we need some dummy targets
 >  > that checks and removes ${WORKMBR} if its size is different
 >  > from ${IMAGESECTORS}?
 >  
 >  There are two options:
 >  
 >  1) always build ${WORKMBR} by .PHONY

  [snip]

 >  2) check a size of ${WORKMBR} before building targets
 >  
 >  Not sure if .BEGIN is correct here..
 >  
 >  ---
 >  Index: distrib/common/bootimage/Makefile.bootimage
 >  ===================================================================
 >  RCS file: /cvsroot/src/distrib/common/bootimage/Makefile.bootimage,v
 >  retrieving revision 1.26
 >  diff -u -p -d -r1.26 Makefile.bootimage
 >  --- distrib/common/bootimage/Makefile.bootimage	5 Aug 2020 01:35:18 -0000	1.26
 >  +++ distrib/common/bootimage/Makefile.bootimage	29 Apr 2021 16:09:58 -0000
 >  @@ -294,6 +294,15 @@ WORKFATDIR?=	work.fatdir
 >   
 >   .if ${USE_GPT} != "no"
 >   ${WORKFSTAB}: ${WORKMBR}
 >  +
 >  +.BEGIN:
 >  +	@if [ -f ${WORKMBR} ]; then			 		\
 >  +		st_size=`${TOOL_STAT} -f %z ${WORKMBR}`;		\
 >  +		if [ "$$st_size" -ne "$$((${IMAGESECTORS} * 512))" ]; then \
 >  +			echo Removing stale ${WORKMBR} ...;		\
 >  +			rm -f ${WORKMBR};				\
 >  +		fi							\
 >  +	fi
 >   .endif
 >   
 >   ${WORKFSTAB}:
 >  ---
 >  
 >  > Needs make(1) guru..
 >  
 >  Anyway we need proper reviews..

 If there is no further comment, I'll commit the above 2) soon.

 Thanks,
 ---
 Izumi Tsutsui

From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56132 CVS commit: src/distrib/common/bootimage
Date: Fri, 4 Jun 2021 17:09:36 +0000

 Module Name:	src
 Committed By:	tsutsui
 Date:		Fri Jun  4 17:09:36 UTC 2021

 Modified Files:
 	src/distrib/common/bootimage: Makefile.bootimage

 Log Message:
 Check and remove a stale work file for UEFI images with incorrect size.

 Fixes PR/56132 (build.sh target install-image fails in update-mode).


 To generate a diff of this commit:
 cvs rdiff -u -r1.26 -r1.27 src/distrib/common/bootimage/Makefile.bootimage

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 09 Jun 2021 01:05:54 +0000
State-Changed-Why:
fixed?


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 09 Jun 2021 01:37:36 +0000
State-Changed-Why:
fixed


From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, 
    dholland@NetBSD.org
Subject: Re: install/56132 (build.sh in update mode fails for target
 install-image)
Date: Tue, 8 Jun 2021 18:36:59 -0700 (PDT)

 On Wed, 9 Jun 2021, dholland@NetBSD.org wrote:

 > State-Changed-From-To: open->feedback
 > State-Changed-By: dholland@NetBSD.org
 > State-Changed-When: Wed, 09 Jun 2021 01:05:54 +0000
 > State-Changed-Why:
 > fixed?

 Yes - feel free to close

 +--------------------+--------------------------+---------------------+
 | Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:   |
 | (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul@whooppee.com   |
 | Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette@netbsd.org |
 +--------------------+--------------------------+---------------------+

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.