On Tuesday 12 December 2006 17:02, Georg Altmann wrote:
> 
> --On Dienstag, 12. Dezember 2006 06:26 +0100 Oliver Lehmann 
> <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> >
> > I've noticed that when I'm backing up files with the "schg" flag set, and
> > also files which are a hardlink to such a file with a "schg" flag the
> > restore does not work.
> > It looks like bacula first restores the file with the "schg" flag, and
> > then tries to recreate the hardlink which failes because of the "schg"
> > flag.
> >
> > [EMAIL PROTECTED] bacula> ls -lo /mnt/files/.bacula/restores/gurke/usr/bin
> > [...]
> > -r-xr-xr-x   1 root  wheel   -       9516 May 12  2006 chkey*
> > -r-sr-xr-x   1 root  wheel   schg   18140 May 12  2006 chpass*
> > -r-xr-xr-x   1 root  wheel   -      72220 May 12  2006 ci*
> > [...]
> > -r-xr-xr-x   1 root  wheel   -       2006 May 12  2006 pagesize*
> > -r-sr-xr-x   1 root  wheel   schg    5920 May 12  2006 passwd*
> > -r-xr-xr-x   1 root  wheel   -       5792 May 12  2006 paste*
> > [...]
> >
> >            schg, schange, simmutable
> >                    set the system immutable flag (super-user only)
> >
> >
> > The error messages are:
> >
> > 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58 Error:
> > create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/yppasswd ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/passwd: ERR=Operation not
> > permitted 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58
> > Error: create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/ypchsh ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/chpass: ERR=Operation not
> > permitted 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58
> > Error: create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/ypchfn ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/chpass: ERR=Operation not
> > permitted 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58
> > Error: create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/ypchpass ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/chpass: ERR=Operation not
> > permitted 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58
> > Error: create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/chsh ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/chpass: ERR=Operation not
> > permitted 10-Dec 20:31 nudel-fd: client-nudel-files-r.2006-12-10_20.28.58
> > Error: create_file.c:308 Could not hard link
> > /mnt/files/.bacula/restores/gurke/usr/bin/chfn ->
> > /mnt/files/.bacula/restores/gurke/usr/bin/chpass: ERR=Operation not
> > permitted
> >
> > I'm running bacula 1.38.11 on FreeBSD 6.1-STABLE.
> > Do you have any Idea how to fix this? If you need the configuration
> > please tell me, but I don't think so since it looks to me like an
> > config-independent, general, problem.
> 
> Same error using bacula-1.38.2 on FreeBSD 4.11 here.
> 
> Just to clarify the problem - looking at the bacula code it seems to me 
> like the follwing happens:
> - fd extracts file A
> - d sets the attributes/flags for A
> - d restores file B which is a hardlink to A
> The last operation fals because A has the SF_IMMUTABLE (system 
> immutable/schg) flag set.
> 
> I'm speculating this will occur on all UNIX/linux/BSD platforms which have 
> an IMMUTABLE attribute/flag for files. Can somebody confirm this?
> 
> Looks like bsdtar had this problem too:
> <http://lists.freebsd.org/pipermail/freebsd-current/2004-May/027884.html>
> 
> And even (Net?)BSDs restore:
> <http://mail-index.netbsd.org/current-users/2004/10/11/0005.html>
> 
> The solution proposed is to keep file flags in a list and set them after 
> all files have been restored, so that all hardlinks can be created. Though 
> it is probably enough to do this for hardlinked files. Looks like this 
> would make the restore code even more complicated.

Not only is it more complicated, but it can be very expensive.  Suppose you 
are restoring a  million hard linked files.  That could mean that you need 
you will need to keep a list that could amount to hundreds of millions of 
bytes (you need to keep at least forward links, the full path and the file, 
as well as certain of the file attributes).   If you are restoring 5 or 10 
million files, it could even be worse.  In addition, if you have multiple 
files linked together (i.e. more than 2), it would add more complication 
because when hitting the second linked file in the list, the real file would 
already be marked immutable.  You can solve that by having a doubly linked 
list in binary order, but then the computation costs go way up.

> 
> But what is the solution if you restore a file from an incremental backup 
> which is a hardlink to an IMMUTABLE file?
> bacula could clear the IMMUTABLE flag for creating the hardlink and re-set 
> it afterwards. But this is not possible if kern.securelevel > 0. I guess it 
> would be wrong to do so anyway, because it undermines the security of the 
> system. After all files are set IMMUTABLE for a reason. Consider the fd 
> crashes for some reason after it cleared the flag... is there an atomic way 
> to do this?
> 
> My solution for restoring a freebsd system right now is to reinstall the 
> base system after the restore (make buildworld installworld).

Off hand, I would say that the FreeBSD guys have worked themselves into a big 
hole.   They have violated the rule that says that root can do anything.

> 
> Regards,
> Georg
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to