SOLVED zfs recv in jail: cannot receive new filesystem stream: invalid backup stream

Berend de Boer

Dabbler
Joined
Feb 13, 2018
Messages
10
I'm trying to use zfs_autobackup in a jail. I get this error when doing a backup:

Code:
ssh bonobo 'zfs send tank/home/berend@offsite1-20210930111614' | \
  zfs recv -u -v -s home/iocage/jails/autobackup-2021-09-30/data/tank/home/berend

cannot receive new filesystem stream: invalid backup stream


The same command outside the jail works.

Is "zfs recv" not allowed in a jail? Is it possible to make it work in a jail?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Might have something to do with security.jail.mount_zfs_allowed, perhaps try setting it to 1 to see if that changes the behaviour. Restart the jail.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Last edited:

Berend de Boer

Dabbler
Joined
Feb 13, 2018
Messages
10
The jail is created by iocage, and with the jail_zfs property, so the data dataset is jailed:

Code:
# zfs get all home/iocage/jails/autobackup-2021-09-30/data | grep jailed
home/iocage/jails/autobackup-2021-09-30/data  jailed                  on                      local
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
OK, looking at your original command, your problem is you're using the dataset path outside the jail inside the jail. Inside the jail, try using autobackup-2021-09-30/data/tank/home/berend, as the jail won't have visibility to the parent datasets which iocage created.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Alternatively, if you're outside the jail try to zfs recv into the jailed ZFS dataset, that also won't work, as ZFS will refuse to use a jailed dataset, as that's under the control of the jail, and not the parent system.
 

Berend de Boer

Dabbler
Joined
Feb 13, 2018
Messages
10
I don't think that's how it works. with zfs list I see the parent datasets clearly. Removing the parent datasets gives this error:

Code:
! Exception: Target path 'autobackup-2021-09-30/data' does not exist. Please create this dataset first.
 

Berend de Boer

Dabbler
Joined
Feb 13, 2018
Messages
10
Issue resolved: the problem is caused by jail FreeBSD 12 using zfs 1, while TrueNas host uses zfs 2. After copying the zfs binary and a few libraries from TrueNas host into jail, it worked. More details here.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Glad you figured it out.
 
Top