--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.

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).

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

Reply via email to