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

Syncoid 2.2.0 --preserve-properties does not work, patch included #982

Closed
tyuxar opened this issue Jan 24, 2025 · 2 comments · May be fixed by #983
Closed

Syncoid 2.2.0 --preserve-properties does not work, patch included #982

tyuxar opened this issue Jan 24, 2025 · 2 comments · May be fixed by #983

Comments

@tyuxar
Copy link

tyuxar commented Jan 24, 2025

Hello all,

First of all, many thanks to you Jim and the contributors for the Sanoid stack!

I ran into a bug on FreeBSD 14.2-RELEASE. I have a home NAS and am replicating regularly the not redundant zroot pool to a redundant one. When I did the initial replication like below, I got some error messages:

syncoid --debug --compress=none --recursive --preserve-properties --exclude=tmp zroot raidpool/backup/zroot

...snip...

DEBUG: getting locally set values of properties on zroot...                                                                                                                      
  zfs get all -s local -H 'zroot'                                                                                                                                                
WARNING: getlocalzfsvalues failed for zroot: cannot open '-s': dataset does not exist                                                                                            
cannot open 'local': dataset does not exist                                                                                                                                      
cannot open '-H': dataset does not exist                                                                                                                                         
DEBUG: getting estimated transfer size from source  using "  zfs send  -nvP 'zroot@syncoid_nas_2025-01-24:12:45:45-GMT01:00' 2>&1 |"...                                          
DEBUG: sendsize = 44144                                                                                                                                                          
INFO: Sending oldest full snapshot zroot@syncoid_nas_2025-01-24:12:45:45-GMT01:00 (~ 43 KB) to new target filesystem:                       

...snip...

The fix is easy, zfs get simply gets called with the parameters in wrong order:

--- syncoid.bak 2024-01-10 17:07:36.000000000 +0100
+++ syncoid     2025-01-24 13:08:18.360142000 +0100
@@ -1357,9 +1357,9 @@
        if ($debug) { print "DEBUG: getting locally set values of properties on $fs...\n"; }
        my $mysudocmd;
        if ($isroot) { $mysudocmd = ''; } else { $mysudocmd = $sudocmd; }
-       if ($debug) { print "$rhost $mysudocmd $zfscmd get all -s local -H $fsescaped\n"; }
+       if ($debug) { print "$rhost $mysudocmd $zfscmd get -s local -H all $fsescaped\n"; }
        my ($values, $error, $exit) = capture {
-               system("$rhost $mysudocmd $zfscmd get all -s local -H $fsescaped");
+               system("$rhost $mysudocmd $zfscmd get -s local -H all $fsescaped");
        };
 
        my %properties=();

Now the zroot pool gets replicated correctly.

However, the fix triggers a funny new false positive bug, but it's not syncoid specific.

...snip...

NFO: Updating new target filesystem with incremental zroot/ROOT/14.2-RELEASE_2024-12-01_151940@autosnap_2025-01-24_11:25:00_weekly ... syncoid_nas_2025-01-24:13:02:49-GMT01:00 (~ 4 KB):
DEBUG:  zfs send  -I 'zroot/ROOT/14.2-RELEASE_2024-12-01_151940'@'autosnap_2025-01-24_11:25:00_weekly' 'zroot/ROOT/14.2-RELEASE_2024-12-01_151940'@'syncoid_nas_2025-01-24:13:02:49-GMT01:00' | mbuffer  -q -s 128k -m 16M | pv -p -t -e -r -b -s 4096 |  zfs receive  -o encryption=off -s -F 'raidpool/backup/zroot/ROOT/14.2-RELEASE_2024-12-01_151940'
cannot receive incremental stream: encryption property 'encryption' cannot be set for incremental streams.
CRITICAL ERROR:  zfs send  -I 'zroot/ROOT/14.2-RELEASE_2024-12-01_151940'@'autosnap_2025-01-24_11:25:00_weekly' 'zroot/ROOT/14.2-RELEASE_2024-12-01_151940'@'syncoid_nas_2025-01-24:13:02:49-GMT01:00' | mbuffer  -q -s 128k -m 16M | pv -p -t -e -r -b -s 4096 |  zfs receive  -o encryption=off -s -F 'raidpool/backup/zroot/ROOT/14.2-RELEASE_2024-12-01_151940' failed: 256 at /usr/local/bin/syncoid line 585.

...snip...

For some reasone encryption=off has been set explicitly for the older boot environments. I assume freebsd-update did this, because I have not set it for the default BE.

# zfs get -r -s local all zroot
NAME                                                                                   PROPERTY              VALUE                                         SOURCE
zroot                                                                                  compression           zstd                                          local
zroot                                                                                  atime                 off                                           local
zroot/ROOT/14.1-RELEASE-p5_2024-11-01_210450                                           encryption            off                                           local
zroot/ROOT/14.1-RELEASE-p6_2024-12-01_151354                                           encryption            off                                           local
zroot/ROOT/14.2-RELEASE_2024-12-01_151940                                              encryption            off                                           local
zroot/var/mail                                                                         atime                 on                                            local
#

Edit: redacted some infos because of privacy.

@phreaker0
Copy link
Collaborator

The fix is already included in the master branch.

Regarding the encryption property, this should probably be blacklisted as it's not working for most of the cases.

@tyuxar
Copy link
Author

tyuxar commented Jan 24, 2025

Thanks for the quick feedback. I have 2 more FreeBSD boxes and did some investigation, the encryption property is not set on either. I have no idea RN where this came from. Anyways, it's not a syncoid bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants