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

Restore of a whole directory #5975

Closed
filippocarletti opened this issue Dec 4, 2019 · 16 comments
Closed

Restore of a whole directory #5975

filippocarletti opened this issue Dec 4, 2019 · 16 comments
Labels
bug A defect of the software verified All test cases were verified successfully

Comments

@filippocarletti
Copy link
Member

Restoring (overwrite) a directory from a restic backup leads to wrong permissions for the directory.
See https://community.nethserver.org/t/cockpit-backup-and-restore-data-not-working-correctly/13850/28 for details.

Steps to reproduce

  • Delete a directory from an ibay
  • Restore it from a restic backup selecting overwrite

Expected behavior

Directory permissions set like before deletion.

Actual behavior

Dir perms are root:root

[filippo@neth.net@ns77-com ~]$ ls -la dir/
total 4
drwxr-xr-x 2 filippo@neth.net locals@neth.net  18 Dec  4 10:20 .
drwx------ 4 filippo@neth.net locals@neth.net 254 Dec  4 10:20 ..
-rw-r--r-- 1 filippo@neth.net locals@neth.net   5 Dec  4 10:20 file
[filippo@neth.net@ns77-com ~]$ rm -rf dir/
[filippo@neth.net@ns77-com ~]$ ls -la dir/
ls: cannot open directory dir/: Permission denied
[filippo@neth.net@ns77-com ~]$ logout
[root@ns77-com filippo]# ls -la dir/
total 4
drwx------ 2 root             root             18 Dec  4 10:30 .
drwx------ 4 filippo@neth.net locals@neth.net 254 Dec  4 10:30 ..
-rw-r--r-- 1 filippo@neth.net locals@neth.net   5 Dec  4 10:20 file

Components

restic-0.9.6-1.ns7.x86_64


Thanks to Mario (@trentatre) and Marc (@dnutan)

@filippocarletti filippocarletti added the bug A defect of the software label Dec 4, 2019
edospadoni added a commit to NethServer/nethserver-restore-data that referenced this issue Dec 4, 2019
* fixed duplicity bad time calculation
* added move action instead of rename in api to support file system
boundaries

NethServer/dev#5975
edospadoni added a commit to NethServer/nethserver-backup-data that referenced this issue Dec 4, 2019
* avoid different timestamp from backup starts and ends

NethServer/dev#5975
edospadoni added a commit to NethServer/nethserver-restore-data that referenced this issue Dec 4, 2019
* fixed duplicity bad time calculation
* added move action instead of rename in api to support file system
boundaries

NethServer/dev#5975
@DavidePrincipi DavidePrincipi added this to ✋ Needs review in NethServer 7 via automation Dec 4, 2019
@DavidePrincipi DavidePrincipi moved this from ✋ Needs review to ⚙ Developing in NethServer 7 Dec 4, 2019
edospadoni added a commit to NethServer/nethserver-backup-data that referenced this issue Dec 4, 2019
* avoid different timestamp from backup starts and ends

NethServer/dev#5975
edospadoni added a commit to NethServer/nethserver-restore-data that referenced this issue Dec 4, 2019
* fixed duplicity bad time calculation
* added move action instead of rename in api to support file system
boundaries

NethServer/dev#5975
@nethbot
Copy link
Member

nethbot commented Dec 4, 2019

in 7.7.1908/testing:

@nethbot
Copy link
Member

nethbot commented Dec 4, 2019

in 7.7.1908/testing:

@edospadoni
Copy link
Member

Test cases:

  1. check the bug is not reproducible
  2. check that restore works with and without overwrite option
  3. check that restore works for file or directory with all engines (duplicity, rsync, restic)
  4. check that restore works for file or directory with all engines (duplicity, rsync, restic) where backup is big enough to completes in minutes/hours

@edospadoni edospadoni added the testing Packages are available from testing repositories label Dec 4, 2019
@edospadoni edospadoni removed their assignment Dec 4, 2019
@dnutan
Copy link

dnutan commented Dec 4, 2019

Only tested with restic:

  • UI: checkboxes for sub-items are no longer visually selected
  • Nested folder restored with wrong ownership when parent folder does not exist
  • Nested files/folders (deep paths) are not restored if parent folders do not exist

@edospadoni
Copy link
Member

  • UI: checkboxes for sub-items are no longer visually selected

Yes, now only the selected node on the tree structure will be selected because it is possible to select both files and directories

  • Nested folder restored with wrong ownership when parent folder does not exist

In which restore mode? new file or overwrite?

  • Nested files/folders (deep paths) are not restored if parent folders do not exist

In which restore mode? new file or overwrite?

@filippocarletti
Copy link
Member Author

The same problem also affects duplicity.

@dnutan
Copy link

dnutan commented Dec 4, 2019

IIRC, first case with overwrite, second case with both modes.

@filippocarletti
Copy link
Member Author

@dnutan the issue is about restoring files contained in directories that have been removed.

Both duplicity and restic, when you ask to restore a file, create the directory that contains the file with default permissions (i.e. root user and 700 mode).

I bet that this scenario is uncommon: if you delete a directory, you restore a directory.

With the restore interface that automatically selects file name (as it is now, without the fix discussed in this issue), you can't restore a directory and always fall in the wrong permission scenario.

To correctly test this issue, you should select a directory if you want to restore a directory.
I tested these packages extensively, but I'd like to have your opinion. Thank you.

@dnutan
Copy link

dnutan commented Dec 4, 2019

packages:

  • nethserver-restore-data-2.0.3-1.1.gceb6ef5.ns7.noarch
  • nethserver-backup-data-1.7.0-1.1.g3ec2c2c.ns7.noarch

Original state:

[root@server share]# pwd
/var/lib/nethserver/ibay/share
[root@server share]# tree -Fugap
.
├── [drwxrws--- test@dom buero@do]  dir/
│   ├── [-rw-rw---- test@dom buero@do]  file\ in\ dir.log
│   └── [drwxrws--- test@dom buero@do]  subdir/
│       ├── [-rw-rw---- test@dom buero@do]  file\ in\ subdir.log
│       └── [drwxrws--- test@dom buero@do]  sub-subdir/
│           └── [-rw-rw---- test@dom buero@do]  file\ in\ sub-subdir.log
└── [-rw-rw---- test@dom buero@do]  file.png

3 directories, 4 files

Backup engine: restic; Restore method: cockpit UI.

[root@server share]# # delete dir/subdir/
[root@server share]# # restore dir/subdir/sub-subdir/ (overwrite)
[root@server share]# tree -Fugap
.
├── [drwxrws--- test@dom buero@do]  dir/
│   ├── [-rw-rw---- test@dom buero@do]  file\ in\ dir.log
│   └── [drwx--S--- root     buero@do]  subdir/
│       └── [drwxrws--- test@dom buero@do]  sub-subdir/
│           └── [-rw-rw---- test@dom buero@do]  file\ in\ sub-subdir.log
└── [-rw-rw---- test@dom buero@do]  file.png

3 directories, 3 files
[root@server share]# # denied access to dir/subdir/
[root@server share]# # delete dir/subdir/
[root@server share]# # restore dir/subdir/sub-subdir/file\ in\ sub-subdir.log (overwrite)
[root@server share]# tree -Fugap
.
├── [drwxrws--- test@dom buero@do]  dir/
│   ├── [-rw-rw---- test@dom buero@do]  file\ in\ dir.log
│   └── [drwx--S--- root     buero@do]  subdir/
│       └── [drwx--S--- root     buero@do]  sub-subdir/
│           └── [-rw-rw---- test@dom buero@do]  file\ in\ sub-subdir.log
└── [-rw-rw---- test@dom buero@do]  file.png

3 directories, 3 files
[root@server share]# # denied access to dir/subdir/
[root@server share]# # delete dir/subdir/
[root@server share]# # restore dir/subdir/sub-subdir/file\ in\ sub-subdir.log (new file)
[root@server share]# tree -Fugap
.
├── [drwxrws--- test@dom buero@do]  dir/
│   └── [-rw-rw---- test@dom buero@do]  file\ in\ dir.log
└── [-rw-rw---- test@dom buero@do]  file.png

1 directory, 2 files
[root@server share]# # (new) file not restored
[root@server share]# # delete dir/subdir/
[root@server share]# # restore dir/subdir/sub-subdir/ (new folder)
[root@server share]# tree -Fugap
.
├── [drwxrws--- test@dom buero@do]  dir/
│   └── [-rw-rw---- test@dom buero@do]  file\ in\ dir.log
└── [-rw-rw---- test@dom buero@do]  file.png

1 directory, 2 files
[root@server share]# # (new) directory not restored

@filippocarletti
Copy link
Member Author

Since you deleted "dir/subdir/" you are supposed to restore "dir/subdir/" and find no problems at all.

I think that we can't do much better than this (except having restic and duplicity behave differently).

@dnutan
Copy link

dnutan commented Dec 4, 2019

I see what you mean. Restoring directly with restic --include offers the same result. Same as reported in the link you gave us: restic/restic#1402

@nethbot
Copy link
Member

nethbot commented Dec 5, 2019

in 7.7.1908/testing:

@filippocarletti filippocarletti added verified All test cases were verified successfully and removed testing Packages are available from testing repositories labels Dec 5, 2019
@nethbot
Copy link
Member

nethbot commented Dec 5, 2019

in 7.7.1908/updates:

  • restic-0.9.6-1.ns7.x86_64.rpm x86_64

@nethbot
Copy link
Member

nethbot commented Dec 5, 2019

in 7.7.1908/updates:

@nethbot
Copy link
Member

nethbot commented Dec 5, 2019

in 7.7.1908/updates:

NethServer 7 automation moved this from ⚙ Developing to 🗑 Done Dec 5, 2019
@dnutan
Copy link

dnutan commented Dec 5, 2019

Besides the upstream permission/ownership issue dealt here, note the other inconsistency between what the UI reports (successful restore) and the file/directory not restored in new file mode (no overwrite).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect of the software verified All test cases were verified successfully
Projects
No open projects
NethServer 7
🗑 Done
Development

No branches or pull requests

5 participants