From nobody Sat Apr 29 02:05:01 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 4Q7XqY0lfFz48HGL for ; Sat, 29 Apr 2023 02:05:13 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Received: from www121.sakura.ne.jp (www121.sakura.ne.jp [153.125.133.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q7XqW4V8Dz44Ny for ; Sat, 29 Apr 2023 02:05:11 +0000 (UTC) (envelope-from junchoon@dec.sakura.ne.jp) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of junchoon@dec.sakura.ne.jp has no SPF policy when checking 153.125.133.21) smtp.mailfrom=junchoon@dec.sakura.ne.jp; dmarc=none Received: from kalamity.joker.local (123-1-88-210.area1b.commufa.jp [123.1.88.210]) (authenticated bits=0) by www121.sakura.ne.jp (8.16.1/8.16.1/[SAKURA-WEB]/20201212) with ESMTPA id 33T251Jt061242 for ; Sat, 29 Apr 2023 11:05:01 +0900 (JST) (envelope-from junchoon@dec.sakura.ne.jp) Date: Sat, 29 Apr 2023 11:05:01 +0900 From: Tomoaki AOKI To: stable@freebsd.org Subject: Re: etcupdate created empty files = system unbootable Message-Id: <20230429110501.36caefa3ba65b7e75bec1c2a@dec.sakura.ne.jp> In-Reply-To: <312ae63f-4fab-e194-c603-a85fd11f6edd@quip.cz> References: <312ae63f-4fab-e194-c603-a85fd11f6edd@quip.cz> Organization: Junchoon corps X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.2) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-0.62 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.996]; NEURAL_HAM_LONG(-0.89)[-0.892]; MV_CASE(0.50)[]; NEURAL_HAM_SHORT(-0.13)[-0.130]; MIME_GOOD(-0.10)[text/plain]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:7684, ipnet:153.125.128.0/18, country:JP]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_SPF_NA(0.00)[no SPF record]; MLMMJ_DEST(0.00)[stable@freebsd.org]; RCVD_TLS_LAST(0.00)[]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DMARC_NA(0.00)[sakura.ne.jp]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[stable@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Q7XqW4V8Dz44Ny X-Spamd-Bar: / X-ThisMailContainsUnwantedMimeParts: N On Thu, 27 Apr 2023 11:21:06 +0200 Miroslav Lachman <000.fbsd@quip.cz> wrote: > Yesterday I upgraded one machine from 12.3 to 13.2 with source upgrade > (installkernel & installworld). > Then I run "etcupdate" (about 100 changes listed, mainly U and A, only 2 > C), "etcupdate resolve" to solve conflicts in newsyslog.conf and > sshd_config, then "etcupdate status" to be sure everything is OK, it > just said: "Modified regular file remains: /etc/motd" > > After this I updated bootcode with gpart and rebooted the machine but it > does not come up, cannot login via ssh. Accessing this remote machine > with remote mamagement / IPMI was a nightmare. It took me almost 5 hours > because of java etc. but it's a different story. > > The machine in question is all ZFS based. I did similar kind of upgrade > many times but this time the etcupdate left more than 80 files in /etc/ > empty. Almost all files marked as U (updated) or A (added) by the first > run of etcupdate was empty. So there were non functional files in > /etc/rc.d/, empty /etc/login.conf and many more which means the system > cannot boot to multi user. I must boot into single user, restored files > from snapshot before upgrade and then it booted. > > Question number 1: How etcupdate can go so horribly wrong to put empty > files in /etc/ and make system unbootable? > > Question number 2: What's the right way to fix this with etcupdate now? > > # etcupdate > Failed to build new tree. > > I don't know if I am alone but I definitely have more problems with > etcupdate in a few years of usage instead on mergemaster. I don't > remember so many errors, unhandled automatic updates or syntax errors in > important files with mergmeaster in about 15 years. > > Kind regards > Miroslav Lachman Just a hint to Question number 2. /usr/sbin/etcupdate is a sh script, not a binary file. And error message "Failed to build new tree." is at line 255 (in function extract_tree()). This is emitted when function build_tree() failed. It could happen on some situation, but maybe likely happen when working directory of etcupdate (/var/db/etcupdate by default) is out of space, or missingly ran etcupdate with non-root user. Note that I've read /usr/sbin/etcupdate for stable/13 at commit 68a69739cb902d083aacdb0974b9b957e0e1353b, so the line number could be different on other branches/commits. -- Tomoaki AOKI