From owner-freebsd-stable@freebsd.org Thu Aug 22 10:43:24 2019 Return-Path: Delivered-To: freebsd-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A138C4B24 for ; Thu, 22 Aug 2019 10:43:24 +0000 (UTC) (envelope-from SRS0=Xyx3=WS=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 46Dh2g42KSz4K4V; Thu, 22 Aug 2019 10:43:23 +0000 (UTC) (envelope-from SRS0=Xyx3=WS=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id CBD5828417; Thu, 22 Aug 2019 12:43:20 +0200 (CEST) Received: from illbsd.quip.test (ip-62-24-92-232.net.upcbroadband.cz [62.24.92.232]) (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 DDF7028416; Thu, 22 Aug 2019 12:43:19 +0200 (CEST) Subject: Re: chsh corrupts /etc/pwd.db From: Miroslav Lachman <000.fbsd@quip.cz> To: Alan Somers , Tom Samplonius Cc: FreeBSD References: <208B5647-9D41-4F0E-9111-32CBFF8491D1@samplonius.org> <7f7ff711-342e-fc8a-d2c9-50dd1a90acd8@quip.cz> Message-ID: Date: Thu, 22 Aug 2019 12:43:19 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <7f7ff711-342e-fc8a-d2c9-50dd1a90acd8@quip.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46Dh2g42KSz4K4V X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of SRS0=Xyx3=WS=quip.cz=000.fbsd@elsa.codelab.cz has no SPF policy when checking 94.124.105.4) smtp.mailfrom=SRS0=Xyx3=WS=quip.cz=000.fbsd@elsa.codelab.cz X-Spamd-Result: default: False [5.04 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.94)[0.937,0]; IP_SCORE(0.92)[ip: (0.48), ipnet: 94.124.104.0/21(0.24), asn: 42000(3.80), country: CZ(0.08)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.998,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(0.99)[0.989,0]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=Xyx3=WS=quip.cz=000.fbsd@elsa.codelab.cz]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=Xyx3=WS=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 10:43:24 -0000 Miroslav Lachman wrote on 2019/08/22 11:21: > Alan Somers wrote on 2019/08/22 04:07: >>> Unless, of course your master.passwd file was damaged.  But the *.db >>> files are really just caches for faster access to user data.  The >>> real master file is master.passwd. >>> >>> >>> The ch* tools typically just change master.passwd, and then call >>> pwd_mkdb to rebuild the *.db files. >> >> The pwd.db file from before the snapshot only has three entries.  From >> after, it has four, and one of them has the wrong shell.  So it does >> seem that chsh is corrupting the file.  And fortunately the problem is >> repeatable.  Any ideas about how to debug it? >> >> -Alan >> >> P.S. I failed to mention earlier that this is happening on >> 12.0-RELEASE-p10 > > I run in to something similar from time to time from about 10.x or 8.x > (i skipped 9.x) > I do not remember exactly what command did the corruption, if it was > vipw or chsh or something else to manipulate user database. The fix was > easy - run it again or use pwd_mkdb I searched our archive of issues and found it. It was error with "pw" command which sometimes failed in very weird way: # pw useradd -n user1 -u 1003 -G wheel -s /bin/tcsh -m -M 0700 -c "User One" pw: user 'user1' disappeared during update It was on FreeBSD 8.x. So it is different error than yours. Miroslav Lachman