[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Best way of restoring /etc from backups after fresh install?

Hi, Laurentiu:

On Friday 05 June 2009 19:57:26 Laurentiu Pancescu wrote:
> Hello everyone,
> After a fresh (re)install of Lenny, I installed all cca. 800 previously
> installed packages (from a list file, via "xargs aptitude install") and
> then restored /etc from my rdiff-backup archive (containing just /etc,
> /home and lists of installed packages). It worked fine, but I ended up with
> some directories having the wrong owners (e.g. logcheck files being owned
> by hal, ntp lock directory owned by gdm), which broke some things. I guess
> the automatically generated uids during the new installation were different
> from the ones in my backed up passwd/group files.
> What would be the best way to restore the full system in such a case? 
> Here's a list of possibilities I thought of, but I'm open to new ones: -
> restore /etc before installing the packages (but then I'll get asked a lot
> during installation about what to do with the existing configuration files)
> - first install etckeeper, then install all packages, then restore /etc
> from backups and then try to analyze and fix what might be broken using
> source control diffs - install packages, restore everything in /etc except
> passwd, shadow and group

You properly diagnosed where your problems are comming from: packages needing 
a user for themselves will create it at install time ...if needed.  Say you 
are installing bind, which needs the user bind; it will create it at install 
time... if need.  If there's already a bind user, it will happily use it.

Now, your restore process created some users which turned out with different 
UIDs because it needed.  Don't give it the chance to need creating those 
users and you'll be OK.  How can you acomplish that? Easy: just 
restore /etc/[passwd,group,shadow,gshadow] *BEFORE* the "xargs aptitude 
install" step.  This way, by the time a package needs certain user it will 
find it already there with the proper UID/GID.

You could restore the whole /etc tree before the aptitude step too.  It 
certainly will ask what to do with conflicting files but it's just a matter 
to always choose the option "retain edited version" (or something to that 
meaning) which is the default option, so it's a matter of 

Reply to: