Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 2023 11:05:01 +0900
From:      Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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    <junchoon@dec.sakura.ne.jp>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20230429110501.36caefa3ba65b7e75bec1c2a>