Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error for restore: lchown operation not permitted #655

Closed
atomi opened this issue Nov 1, 2016 · 5 comments
Closed

error for restore: lchown operation not permitted #655

atomi opened this issue Nov 1, 2016 · 5 comments

Comments

@atomi
Copy link

atomi commented Nov 1, 2016

Restore operation from a root user backup does execute and all files appear to be restored however this error occurs if you don't run the restore operation as a root user.

Output of restic version

[root@alarmpi ~]# restic version
restic 0.3.0 (v0.3.0-6-g6f72164)
compiled at 2016-10-05 09:06:15 with go1.7.1 on linux/arm

[atomi@workstation ~]# restic version
restic 0.3.0 (v0.3.0-19-g6b88d3b)
compiled at 2016-10-31 18:33:33 with go1.7.3 on linux/amd64

Expected behavior

restore should function without error stack trace

Actual behavior

[atomi@workstation ~]# restic -r test snapshots
ID        Date                 Host        Tags        Directory
----------------------------------------------------------------------
67d6c948  2016-11-01 15:33:13  alarmpi                 /root/backup

[atomi@workstation ~]# restic -r test restore 67d6c948 --target backup
restoring <Snapshot 67d6c948 of [/root/backup] at 2016-11-01 15:33:13.667132217 -0700 PDT by root@alarmpi> to backup
error for backup/backup: lchown backup/backup: operation not permitted
Lchown
restic.Node.restoreMetadata
        /tmp/restic-build-431614805/src/restic/node.go:147
restic.(*Node).CreateAt
        /tmp/restic-build-431614805/src/restic/node.go:134
restic.(*Restorer).restoreNodeTo
        /tmp/restic-build-431614805/src/restic/restorer.go:102
restic.(*Restorer).restoreTo
        /tmp/restic-build-431614805/src/restic/restorer.go:53
restic.(*Restorer).RestoreTo
        /tmp/restic-build-431614805/src/restic/restorer.go:122
main.runRestore
        /tmp/restic-build-431614805/src/cmds/restic/cmd_restore.go:135
main.glob..func13
        /tmp/restic-build-431614805/src/cmds/restic/cmd_restore.go:23
github.com/spf13/cobra.(*Command).execute
        /tmp/restic-build-431614805/src/github.com/spf13/cobra/command.go:599
github.com/spf13/cobra.(*Command).ExecuteC
        /tmp/restic-build-431614805/src/github.com/spf13/cobra/command.go:689
github.com/spf13/cobra.(*Command).Execute
        /tmp/restic-build-431614805/src/github.com/spf13/cobra/command.go:648
main.main
        /tmp/restic-build-431614805/src/cmds/restic/main.go:41
runtime.main
        /usr/local/go/src/runtime/proc.go:183
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:2086

Steps to reproduce the behavior

  1. restic backup path using root user and owned by root
  2. restore using non-root user

This may be related to #244

@fd0
Copy link
Member

fd0 commented Nov 5, 2016

Thanks for reporting this. Are the files restored and restic only complains about the error, or did it stop there?

@fd0 fd0 added type: bug state: need feedback waiting for feedback, e.g. from the submitter labels Nov 5, 2016
@atomi
Copy link
Author

atomi commented Nov 5, 2016

Are the files restored and restic only complains about the error

Yeah.

@fd0 fd0 added category: user interface and removed state: need feedback waiting for feedback, e.g. from the submitter labels Nov 6, 2016
@fd0
Copy link
Member

fd0 commented Nov 6, 2016

Thanks for the clarification, that's a user-interface issue then.

@middelink
Copy link
Member

Partially. Nothing says we have to restore backups as root, right? Tar allows me to unpack a tar file where file are owned by someone other than myself and the world understand this behavior. Well, excluding Windows folks :P

How about this output (no stacktraces)

$ restic -r rest:http://qnap.**.********.**:8000 restore -t /tmp f5a13c51 -i /usr/sbin/e2label -i /usr/sbin/tune2fs 
restoring f5a13c51 to /tmp
error for /tmp/usr/sbin/e2label: Lchown: lchown /tmp/usr/sbin/e2label: operation not permitted
error for /tmp/usr/sbin/tune2fs: Lchown: lchown /tmp/usr/sbin/tune2fs: operation not permitted
There were 2 errors

@fd0
Copy link
Member

fd0 commented Mar 11, 2017

Yes, that's what I have in mind, too. Warn the user that permissions could not be restored, but don't print a stacktrace and continue restoring.

@fd0 fd0 closed this as completed in #878 Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants