From nobody Sat May 06 07:33:58 2023 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QCznl5rx5z49D4C for ; Sat, 6 May 2023 07:34:03 +0000 (UTC) (envelope-from SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4QCznk5FMtz3QBM; Sat, 6 May 2023 07:34:02 +0000 (UTC) (envelope-from SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of "SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz" has no SPF policy when checking 94.124.105.4) smtp.mailfrom="SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz"; dmarc=none Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id AADA6D78DA; Sat, 6 May 2023 09:33:59 +0200 (CEST) Received: from [192.168.145.50] (ip-89-177-27-225.bb.vodafone.cz [89.177.27.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 96216D78B9; Sat, 6 May 2023 09:33:58 +0200 (CEST) Message-ID: <004e8a85-7bc1-6b33-8a42-70d7b43f9497@quip.cz> Date: Sat, 6 May 2023 09:33:58 +0200 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: etcupdate created empty files = system unbootable From: Miroslav Lachman <000.fbsd@quip.cz> To: Dimitry Andric Cc: Dave Cottlehuber , stable@freebsd.org References: <312ae63f-4fab-e194-c603-a85fd11f6edd@quip.cz> <0db3bbf1-9e98-d721-c734-fdfe2483cbf0@quip.cz> <95169DC0-5DB6-41D1-8B04-5A450094529F@FreeBSD.org> <19399711-4a71-7025-7ceb-8dd481ec0038@quip.cz> <7afb4128-3eef-f2d9-07c0-035a237cba45@quip.cz> Content-Language: cs-Cestina In-Reply-To: <7afb4128-3eef-f2d9-07c0-035a237cba45@quip.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-0.79 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-0.999]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(0.01)[0.009]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; R_SPF_NA(0.00)[no SPF record]; MLMMJ_DEST(0.00)[stable@freebsd.org]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=KDWp=A3=quip.cz=000.fbsd@elsa.codelab.cz]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[quip.cz]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4QCznk5FMtz3QBM X-Spamd-Bar: / X-ThisMailContainsUnwantedMimeParts: N On 04/05/2023 22:59, Miroslav Lachman wrote: [..] > I still don't know how to reproduce it / what is the root cause, but it > has happend again. This is the resulting list of empty files after a > "successful" run of etcupdate after upgrading from 12.3 to 13.2. > > # find /etc/ -type f -empty ! -mtime +15m -ls > 65994   0 -rw-r--r--   1 root  wheel   0 May  4 22:19 /etc/rc.firewall > 66060   0 -rw-r--r--   1 root  wheel   0 May  4 22:19 /etc/network.subr > 65814   0 -rw-r--r--   1 root  wheel   0 May  4 22:20 /etc/ssh/ssh_config OK, now I have all the details of why it failed, and why etcupdate continued even when the file copy failed. I found dozens of errors like this in /var/db/etcupdate/log after running "etcupdate". >>> cp -Rp /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zfskeys /etc/rc.d/zfskeys cp: /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zfskeys: Function not implemented >>> cp -Rp /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zpool /etc/rc.d/zpool cp: /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zpool: Function not implemented >>> cp -Rp /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zpoolreguid /etc/rc.d/zpoolreguid cp: /var/db/etcupdate/etcupdate-0PvaUI8/etc/rc.d/zpoolreguid: Function not implemented As you can see, cp failed, but etcupdate continued without any sign of error. cp failed because I did installkernel & installworld without rebooting. I have never run into a problem like this in the past, but I understand the reason - running the new 13.2 binary "cp" on an older 12.3 kernel is not supported. However, there is a bug in etcupdate which causes it to continue silently instead of stopping when the first copy fails. This function needs to check the return status of cp and not blindly return 0 even if the copy failed. In other words, the function install_new() does not do what the comment says. This needs to be fixed. # Install the "new" version of a file. Returns true if it succeeds # and false otherwise. # # $1 - pathname of the file to install (relative to DESTDIR) install_new() { if ! install_dirs $NEWTREE "$DESTDIR" $1; then return 1 fi log "cp -Rp ${NEWTREE}$1 ${DESTDIR}$1" if [ -z "$dryrun" ]; then cp -Rp ${NEWTREE}$1 ${DESTDIR}$1 >&3 2>&1 fi post_install_file $1 return 0 } I will open PR with all the details today. Kind regards Miroslav Lachman