View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000967 | bareos-core | General | public | 2018-06-20 15:47 | 2019-01-31 10:13 |
Reporter | frank | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
OS | Windows Server | OS Version | 2012 build 9200 | ||
Product Version | 17.2.5 | ||||
Fixed in Version | 16.2.8 | ||||
Summary | 0000967: Symbolic links are not replaceable during restore on Win FD | ||||
Description | Symbolic links are not replaced during restore even if restore parameter is set to the value always. Tested restoring a full backup (mark *) while the backed up files were already and still in place on the client. 19-Jun 17:54 bareos-dir JobId 80: Start Restore Job RestoreFiles.2018-06-19_17.54.15_20 19-Jun 17:54 bareos-dir JobId 80: Using Device "file-device-0" to read. 19-Jun 17:54 bareos-sd JobId 80: Ready to read from volume "Incremental-0003" on device "file-device-0" (/var/lib/bareos/storage). 19-Jun 17:54 windows-fd JobId 80: Error: File C:/Users/Administrator/test/TMPL already exists and could not be replaced. ERR=Permission denied. 19-Jun 17:54 bareos-sd JobId 80: Forward spacing Volume "Incremental-0003" to file:block 0:125554. 19-Jun 17:54 windows-fd JobId 80: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=Permission denied 19-Jun 17:54 bareos-dir JobId 80: Error: Bareos bareos-dir 17.2.5 (14Feb18): Build OS: x86_64-redhat-linux-gnu redhat CentOS Linux release 7.5.1804 (Core) JobId: 80 Job: RestoreFiles.2018-06-19_17.54.15_20 Restore Client: windows-fd Start time: 19-Jun-2018 17:54:17 End time: 19-Jun-2018 17:54:17 Elapsed time: 0 secs Files Expected: 6 Files Restored: 5 Bytes Restored: 726 Rate: 0.0 KB/s FD Errors: 2 FD termination status: Error SD termination status: OK Termination: *** Restore Error *** The restore job had the following parameters set. Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.15.bsr Where: Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-19 17:54:03 Catalog: MyCatalog Priority: 10 Plugin Options: *None* It looks like if symbolic links are already in place they can not be replaced, even if the replace parameter is set to always in the restore job. However, testing further, a single file restore (just the symbolic link, mark C:/Users/Administrator/test/TMPL) results in the following. 20-Jun 13:16 bareos-dir JobId 92: shell command: run AfterJob "/usr/lib/bareos/scripts/delete_catalog_backup" 20-Jun 14:58 bareos-dir JobId 93: Start Restore Job RestoreFiles.2018-06-20_14.58.39_18 20-Jun 14:58 bareos-dir JobId 93: Using Device "file-device-0" to read. 20-Jun 14:58 bareos-sd JobId 93: Ready to read from volume "Incremental-0003" on device "file-device-0" (/var/lib/bareos/storage). 20-Jun 14:58 bareos-sd JobId 93: Forward spacing Volume "Incremental-0003" to file:block 0:128247. 20-Jun 14:58 windows-fd JobId 93: Error: File C:/Users/Administrator/test/TMPL already exists and could not be replaced. ERR=Permission denied. 20-Jun 14:58 windows-fd JobId 93: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=No error 20-Jun 14:58 bareos-dir JobId 93: Bareos bareos-dir 17.2.5 (14Feb18): Build OS: x86_64-redhat-linux-gnu redhat CentOS Linux release 7.5.1804 (Core) JobId: 93 Job: RestoreFiles.2018-06-20_14.58.39_18 Restore Client: windows-fd Start time: 20-Jun-2018 14:58:41 End time: 20-Jun-2018 14:58:42 Elapsed time: 1 sec Files Expected: 1 Files Restored: 0 Bytes Restored: 0 Rate: 0.0 KB/s FD Errors: 0 FD termination status: OK SD termination status: OK Termination: Restore OK -- warning file count mismatch The restore job had the following parameters set. Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.1.bsr Where: Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-20 14:58:31 Catalog: MyCatalog Priority: 10 Plugin Options: *None* Something is not working as expected here and it looks like a bug. On the one hand you would expect the same result of the restore job in both cases, but you get a different one. a) Full restore 19-Jun 17:54 windows-fd JobId 80: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=Permission denied b) Single file restore 20-Jun 14:58 windows-fd JobId 93: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=No error On the other hand why is the restore job parameter "replace: always" behaving in that way on a windows client in case of symbolic links. | ||||
Steps To Reproduce | CASE 1 ====== *restore Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" First you select one or more JobIds that contain files to be restored. You will be presented several methods of specifying the JobIds. Then you will be allowed to select which files from those JobIds are to be restored. To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time 9: Find the JobIds of the most recent backup for a client 10: Find the JobIds for a backup for a client before a specified time 11: Enter a list of directories to restore for found JobIds 12: Select full restore to a specified Job date 13: Cancel Select item: (1-13): 5 Defined Clients: 1: bareos-fd 2: kvm-1-fd 3: kvm-3-fd 4: kvm-4-fd 5: kvm-5-fd 6: kvm-6-fd 7: windows-fd Select the Client (1-7): 7 Automatically selected FileSet: fileset-windows-fd +-------+-------+----------+----------+---------------------+------------------+ | jobid | level | jobfiles | jobbytes | starttime | volumename | +-------+-------+----------+----------+---------------------+------------------+ | 64 | F | 5 | 638 | 2018-06-19 16:05:19 | Full-0001 | | 74 | I | 7 | 726 | 2018-06-19 17:29:20 | Incremental-0003 | | 85 | I | 7 | 726 | 2018-06-20 13:00:00 | Incremental-0003 | +-------+-------+----------+----------+---------------------+------------------+ You have selected the following JobIds: 64,74,85 Building directory tree for JobId(s) 64,74,85 ... 5 files inserted into the tree. You are now entering file selection mode where you add (mark) and remove (unmark) files to be restored. No files are initially added, unless you used the "all" keyword on the command line. Enter "done" to leave this mode. cwd is: / $ mark * 7 files marked. $ done Bootstrap records written to /var/lib/bareos/bareos-dir.restore.2.bsr The job will require the following Volume(s) Storage(s) SD Device(s) =========================================================================== Incremental-0003 File file-device-0 Volumes marked with "*" are online. 6 files selected to be restored. Using Catalog "MyCatalog" Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.2.bsr Where: /tmp/bareos-restores Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-20 15:43:39 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): mod Parameters to modify: 1: Level 2: Storage 3: Job 4: FileSet 5: Restore Client 6: Backup Format 7: When 8: Priority 9: Bootstrap 10: Where 11: File Relocation 12: Replace 13: JobId 14: Plugin Options Select parameter to modify (1-14): 10 Please enter the full path prefix for restore (/ for none): / Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.2.bsr Where: Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-20 15:43:39 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): yes Job queued. JobId=94 *mess 20-Jun 15:43 bareos-dir JobId 94: Start Restore Job RestoreFiles.2018-06-20_15.43.50_20 20-Jun 15:43 bareos-dir JobId 94: Using Device "file-device-0" to read. 20-Jun 15:43 bareos-sd JobId 94: Ready to read from volume "Incremental-0003" on device "file-device-0" (/var/lib/bareos/storage). 20-Jun 15:43 windows-fd JobId 94: Error: File C:/Users/Administrator/test/TMPL already exists and could not be replaced. ERR=Permission denied. 20-Jun 15:43 bareos-sd JobId 94: Forward spacing Volume "Incremental-0003" to file:block 0:128247. 20-Jun 15:43 windows-fd JobId 94: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=Permission denied 20-Jun 15:43 bareos-dir JobId 94: Error: Bareos bareos-dir 17.2.5 (14Feb18): Build OS: x86_64-redhat-linux-gnu redhat CentOS Linux release 7.5.1804 (Core) JobId: 94 Job: RestoreFiles.2018-06-20_15.43.50_20 Restore Client: windows-fd Start time: 20-Jun-2018 15:43:52 End time: 20-Jun-2018 15:43:52 Elapsed time: 0 secs Files Expected: 6 Files Restored: 5 Bytes Restored: 726 Rate: 0.0 KB/s FD Errors: 2 FD termination status: Error SD termination status: OK Termination: *** Restore Error *** * CASE 2 ====== *restore First you select one or more JobIds that contain files to be restored. You will be presented several methods of specifying the JobIds. Then you will be allowed to select which files from those JobIds are to be restored. To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time 9: Find the JobIds of the most recent backup for a client 10: Find the JobIds for a backup for a client before a specified time 11: Enter a list of directories to restore for found JobIds 12: Select full restore to a specified Job date 13: Cancel Select item: (1-13): 5 Defined Clients: 1: bareos-fd 2: kvm-1-fd 3: kvm-3-fd 4: kvm-4-fd 5: kvm-5-fd 6: kvm-6-fd 7: windows-fd Select the Client (1-7): 7 Automatically selected FileSet: fileset-windows-fd +-------+-------+----------+----------+---------------------+------------------+ | jobid | level | jobfiles | jobbytes | starttime | volumename | +-------+-------+----------+----------+---------------------+------------------+ | 64 | F | 5 | 638 | 2018-06-19 16:05:19 | Full-0001 | | 74 | I | 7 | 726 | 2018-06-19 17:29:20 | Incremental-0003 | | 85 | I | 7 | 726 | 2018-06-20 13:00:00 | Incremental-0003 | +-------+-------+----------+----------+---------------------+------------------+ You have selected the following JobIds: 64,74,85 Building directory tree for JobId(s) 64,74,85 ... 5 files inserted into the tree. You are now entering file selection mode where you add (mark) and remove (unmark) files to be restored. No files are initially added, unless you used the "all" keyword on the command line. Enter "done" to leave this mode. cwd is: / $ mark C:/Users/Administrator/test/TMPL 1 file marked. $ done Bootstrap records written to /var/lib/bareos/bareos-dir.restore.3.bsr The job will require the following Volume(s) Storage(s) SD Device(s) =========================================================================== Incremental-0003 File file-device-0 Volumes marked with "*" are online. 1 file selected to be restored. Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.3.bsr Where: /tmp/bareos-restores Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-20 15:46:30 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): mod Parameters to modify: 1: Level 2: Storage 3: Job 4: FileSet 5: Restore Client 6: Backup Format 7: When 8: Priority 9: Bootstrap 10: Where 11: File Relocation 12: Replace 13: JobId 14: Plugin Options Select parameter to modify (1-14): 10 Please enter the full path prefix for restore (/ for none): / Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bareos/bareos-dir.restore.3.bsr Where: Replace: Always FileSet: LinuxAll Backup Client: windows-fd Restore Client: windows-fd Format: Native Storage: File When: 2018-06-20 15:46:30 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): yes Job queued. JobId=95 *mess 20-Jun 15:46 bareos-dir JobId 95: Start Restore Job RestoreFiles.2018-06-20_15.46.37_22 20-Jun 15:46 bareos-dir JobId 95: Using Device "file-device-0" to read. 20-Jun 15:46 bareos-sd JobId 95: Ready to read from volume "Incremental-0003" on device "file-device-0" (/var/lib/bareos/storage). 20-Jun 15:46 bareos-sd JobId 95: Forward spacing Volume "Incremental-0003" to file:block 0:128247. 20-Jun 15:46 windows-fd JobId 95: Error: File C:/Users/Administrator/test/TMPL already exists and could not be replaced. ERR=Permission denied. 20-Jun 15:46 windows-fd JobId 95: Error: findlib/create_file.c:391 Could not symlink C:/Users/Administrator/test/TMPL -> templates: ERR=No error 20-Jun 15:46 bareos-dir JobId 95: Bareos bareos-dir 17.2.5 (14Feb18): Build OS: x86_64-redhat-linux-gnu redhat CentOS Linux release 7.5.1804 (Core) JobId: 95 Job: RestoreFiles.2018-06-20_15.46.37_22 Restore Client: windows-fd Start time: 20-Jun-2018 15:46:39 End time: 20-Jun-2018 15:46:39 Elapsed time: 0 secs Files Expected: 1 Files Restored: 0 Bytes Restored: 0 Rate: 0.0 KB/s FD Errors: 0 FD termination status: OK SD termination status: OK Termination: Restore OK -- warning file count mismatch * | ||||
Additional Information | BACKUP JOB =========== *list joblog jobid=74 2018-06-19 17:29:19 bareos-dir JobId 74: Start Backup JobId 74, Job=backup-windows-fd.2018-06-19_17.29.17_14 2018-06-19 17:29:19 bareos-dir JobId 74: Using Device "file-device-0" to write. 2018-06-19 17:29:15 windows-fd JobId 74: DIR and FD clocks differ by -4 seconds, FD automatically compensating. 2018-06-19 17:29:20 bareos-sd JobId 74: Volume "Incremental-0003" previously written, moving to end of data. 2018-06-19 17:29:20 bareos-sd JobId 74: Ready to append to end of Volume "Incremental-0003" size=125554 2018-06-19 17:29:15 windows-fd JobId 74: Created 24 wildcard excludes from FilesNotToBackup Registry key 2018-06-19 17:29:17 windows-fd JobId 74: Generate VSS snapshots. Driver="Win64 VSS", Drive(s)="C" 2018-06-19 17:29:17 windows-fd JobId 74: VolumeMountpoints are not processed as onefs = yes. 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "Task Scheduler Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "VSS Metadata Store Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "Performance Counters Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "ASR Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "COM+ REGDB Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "Registry Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "System Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "BITS Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "Shadow Copy Optimization Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:31 windows-fd JobId 74: VSS Writer (BackupComplete): "WMI Writer", State: 0x1 (VSS_WS_STABLE) 2018-06-19 17:30:37 bareos-sd JobId 74: Elapsed time=00:01:17, Transfer rate=27 Bytes/second 2018-06-19 17:30:38 bareos-dir JobId 74: Insert of attributes batch table with 6 entries start 2018-06-19 17:30:38 bareos-dir JobId 74: Insert of attributes batch table done 2018-06-19 17:30:38 bareos-dir JobId 74: Bareos bareos-dir 17.2.5 (14Feb18): Build OS: x86_64-redhat-linux-gnu redhat CentOS Linux release 7.5.1804 (Core) JobId: 74 Job: backup-windows-fd.2018-06-19_17.29.17_14 Backup Level: Incremental, since=2018-06-19 16:05:19 Client: "windows-fd" 17.2.4 (21Sep17) Microsoft Windows Server 2012 Standard Edition (build 9200), 64-bit,Cross-compile,Win64 FileSet: "fileset-windows-fd" 2018-06-19 15:44:19 Pool: "Incremental" (From Job IncPool override) Catalog: "MyCatalog" (From Client resource) Storage: "File" (From Job resource) Scheduled time: 19-Jun-2018 17:29:16 Start time: 19-Jun-2018 17:29:20 End time: 19-Jun-2018 17:30:38 Elapsed time: 1 min 18 secs Priority: 10 FD Files Written: 7 SD Files Written: 7 FD Bytes Written: 726 (726 B) SD Bytes Written: 2,085 (2.085 KB) Rate: 0.0 KB/s Software Compression: None VSS: yes Encryption: no Accurate: no Volume name(s): Incremental-0003 Volume Session Id: 12 Volume Session Time: 1529415594 Last Volume Bytes: 128,247 (128.2 KB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK *list files jobid=74 C:/Users/Administrator/test/readme.txt~ C:/Users/Administrator/test/readme.txt C:/Users/Administrator/test/l2r C:/Users/Administrator/test/TMPL C:/Users/Administrator/test/ C:/Users/Administrator/test/templates/ Note: l2r is a symlink to readme.txt and TMPL is a symlink to templates. | ||||
Tags | No tags attached. | ||||
bareos: dev eea46a87 2018-06-21 19:18 Ported: N/A Details Diff |
windows: call DeleteFileW and RemoveDirectoryW to be able to remove symlinks before restore Windows symlinks could not be replaced during restore because win32_unlink() only used _wunlink() to remove existing files before recovery. _wunlink() cannot remove symlinks so that the overwrite of existing symlinks did not work. We first try with _unlink(); on failure DeleteFileW() and as last option we do RemoveDirectoryW() win32_unlink now is able to remove: * direcories * files * file symlinks and * directory symlinks Fixes 0000967: Symbolic links are not replaceable during restore on Win FD |
Affected Issues 0000967 |
|
mod - src/win32/compat/compat.c | Diff File | ||
bareos: bareos-16.2 7995c82a 2018-06-21 19:18 Ported: N/A Details Diff |
windows: call DeleteFileW and RemoveDirectoryW to be able to remove symlinks before restore Windows symlinks could not be replaced during restore because win32_unlink() only used _wunlink() to remove existing files before recovery. _wunlink() cannot remove symlinks so that the overwrite of existing symlinks did not work. We first try with _unlink(); on failure DeleteFileW() and as last option we do RemoveDirectoryW() win32_unlink now is able to remove: * direcories * files * file symlinks and * directory symlinks Fixes 0000967: Symbolic links are not replaceable during restore on Win FD |
Affected Issues 0000967 |
|
mod - src/win32/compat/compat.c | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-06-20 15:47 | frank | New Issue | |
2018-06-20 15:49 | frank | Assigned To | => frank |
2018-06-20 15:49 | frank | Status | new => confirmed |
2018-06-20 15:50 | frank | Assigned To | frank => |
2018-06-22 09:43 | pstorz | Changeset attached | => bareos dev eea46a87 |
2018-06-22 09:43 | pstorz | Note Added: 0003049 | |
2018-06-22 09:43 | pstorz | Status | confirmed => resolved |
2018-06-22 09:43 | pstorz | Resolution | open => fixed |
2018-06-25 10:37 | pstorz | Changeset attached | => bareos bareos-16.2 7995c82a |
2018-06-25 10:37 | pstorz | Note Added: 0003051 | |
2018-06-28 16:34 | stephand | Relationship added | child of 0000863 |
2018-07-09 15:24 | joergs | Relationship added | child of 0000966 |
2018-07-16 19:10 | joergs | Status | resolved => closed |
2018-07-16 19:10 | joergs | Fixed in Version | => 16.2.8 |
2019-01-31 10:11 | arogge_adm | Relationship added | child of 0001040 |
2019-01-31 10:13 | arogge_adm | Relationship deleted | child of 0001040 |