Date: Sun, 5 May 2013 10:42:02 +0430 From: takCoder <tak.official@gmail.com> To: Polytropon <freebsd@edvax.de> Cc: freebsd-questions@freebsd.org Subject: Re: pwd.db/spwd.db file corupption when having unsafe system poweroff Message-ID: <CAPkyVLwJK2sNLof4MWahX30GK1aGskkMFWMhvBys4ND%2BabQSnw@mail.gmail.com> In-Reply-To: <20130501110147.c69f408b.freebsd@edvax.de> References: <CAHHq%2BVwcazbVXDDsZqH1AXxVOu0mfGjT_5Tcj3OoHJroe8Kgdg@mail.gmail.com> <kkkda5$vm9$1@ger.gmane.org> <20130417173544.25266cd6.freebsd@edvax.de> <CAPkyVLwPg6xPy6rHZ6kqTLcum77vg-QnLhHmFEmPvXhG40QSsQ@mail.gmail.com> <CAPkyVLzaHkL5FFVhdFw60HnhYZ3GUn696z5NbTCoPVxfFCGrmA@mail.gmail.com> <20130501110147.c69f408b.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
First, thank you for your quick and complete reply :) then: > Furthermore, file system corruption due to an abrupt > cut of power should be avoided. Whenever the system comes > up in a non-clean state, fsck should be run first, _then_ > the boot process should continue. Still it's possible that > this process leaves truncated files behind (e. g. the > binary database files with a length of zero, which implies > they will have to be rebuilt by pwd_mkdb). > > i added fsck_background=no to rc.conf but i still see the error.. and i don't see any differance in system startup output! how should i know it's working?? > Alternatively to pw, you could try adduser, which is more > an interactive program, but can perform the same tasks. > Again, it would take care of updating all required files. > This is the situation one would expect after the program > ended, or at least some seconds after one got back to the > root prompt. > when i tried using adduser, when a error occurs(like multiple definition of a username), it's pw who reports the errors! it means that adduser also uses pw.. is this functionality of "taking care of updating all required files", an add-on appeared in add-user?? > During the 2 minutes, you could use programs like lsof > (it's in ports) to check if a program has a file open, > so you could capture the "power off while writing to > file" incident. > i tried using lsof as well , but there was no differance.. yes! when i use pw -h 0 parameter, 10 extra files are added to the lsof list.. but exactly after i enter the password, all of them are closed(none of these files are of those main 5 files of users..lib files and alike..).. and in later monitoring with lsof, i could not catch the time when these files are in use!.. i'll write a shell to monitor it more detailed though.. After you could not login again, did you check the > files involved in the login process? > yes, file sizes are ok but pwd.db and swpd.db are out of use..(also once i opened passwd with nano and it had irrational characters..). always if i use pwd_mkdb or just replace these two files, in next startup system will come up fine! now there is something special about my own servers, which i'm suspicious of.. i've add an executable file to my /usr/local/etc/rc.d dir, which tries to initiate some parts of myserver.. this includes usernames as well.. i mean, i may have template users during system uptime, which i won't need in next startup.. this initiliazer will remove those unwanted users and redifine main usernames, using pw.. it works fine while having safe shutdowns but when i have the bug-generator scenario, it won't work.. may it be the conflict of running my initializer and fsck ? or is it true that rc.d files are executed in shutdown process as well? is shutdown process started when i start pressing power button for 4 seconds?? i don't know what else to think of...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPkyVLwJK2sNLof4MWahX30GK1aGskkMFWMhvBys4ND%2BabQSnw>