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

ZXFER Failed to retrieve datasets from the destination #60

Open
xflou opened this issue Jun 20, 2023 · 4 comments
Open

ZXFER Failed to retrieve datasets from the destination #60

xflou opened this issue Jun 20, 2023 · 4 comments

Comments

@xflou
Copy link

xflou commented Jun 20, 2023

Hello,

Looking for some suggestions or ideas on a problem I've encountered using zxfer.

I have an existing system with an existing zfs pool that I'm trying to copy over to another system.

For some reason, I am able to run the zxfer command interactively with no issues; however, when I attempt to run the same command from a bash script, it fails.

Below is the actual output and messages:

when running the following command from within a shell script, it returns the following error messages:

/usr/local/sbin/zxfer -F -k -P -R remotepool -O root@remotesystem localpool
/usr/local/sbin/zxfer: 681: list: not found
Failed to retrieve datasets from the destination

when starting the same command interactively a shell terminal window at the command line, it seems to work:

In fact, the command starts, it pulls the snapshots across from the remotesystem ; which I can see on the local system using "zfs list -t snap" command.

/usr/local/sbin/zxfer -F -k -P -R remotepool -O root@remotesystem localpool

Has anyone seen or experienced this issue before that can share how they fixed it and or anyone have any suggestions.

I would appreciate it.

Thanks!

@allanjude
Copy link
Owner

This most likely means that zxfer is failing to find the zfs binary on your system
It does LZFS=$( which zfs ) so if that returns blank, it might try to just run $LZFS list and generate that error.

It should catch that and fail, but maybe it is not.

@xflou
Copy link
Author

xflou commented Jun 22, 2023

Thank you Allan, I will double check that. I appreciate the response.

@xflou
Copy link
Author

xflou commented Jun 22, 2023

Hi Allen,

I just tested a few additional things based on what you suggested.

  1. I ran a “which zfs” on the remote system via ssh and on the local system:

output: logged into the remote system at the command line:
which zfs
/usr/sbin/zfs

output: same command run on the local system to the remote via ssh
ssh remote system which zfs
/usr/sbin/zfs

output: same command run on the local system
which zfs
/usr/sbin/zfs

Basically, I made sure the zfs program was found in the correct place so zxfer would find it.

  1. based on what I found, I turned on debug in the “/usr/local/sbin/zxfer” script.

    What I found is the following:

a. When running the command string from the shell command-line(interactively) as seen below, ZXFER is able to
return a value for “which zfs” which is attached to the LZFS variable.
command: “/usr/local/sbin/zxfer -F -k -P -R remotepool -O root@remotesystem localpool”

Variable information found: 
  • backup_file_extension=.zxfer_backup_info
  • backup_file_contents=
  • source_os=
  • dest_os=
  • uname
  • home_os=Linux
  • trailing_slash=0
  • which zfs ##<——
  • LZFS=/usr/sbin/zfs ##<——
  • RZFS=/usr/sbin/zfs
  • LCAT=
  • which awk
  • AWK=/usr/bin/awk
  • date +%s
  • current_date=1687455044
  • snapshot_name=zxfertempsnap
  • dont_write_backup=0
  • ensure_writable=0

At the end of the run it begins to pull the snapshots as it normally should.

B. When running the same command string from a shell script and launched via cron(batch), the results
that I am finding are that the LZFS variable is “empty” as you suspected it would be:

Variable information NOT found:

  • backup_file_extension=.zxfer_backup_info
  • backup_file_contents=
  • source_os=
  • dest_os=
  • uname
  • home_os=Linux
  • trailing_slash=0
  • which zfs ##<--
  • LZFS= ##<--
  • RZFS=
  • LCAT=
  • which awk
  • AWK=/usr/bin/awk
  • date +%s
  • current_date=1687454341
  • snapshot_name=zxfertempsnap
  • dont_write_backup=0
  • ensure_writable=0

Then the script continues and ends with the same message listed below:

  • list -t filesystem,volume -Ho name -s creation
    /usr/local/sbin/zxfer: 681: list: not found
  • rzfs_list_ho_s=
  • echo Failed to retrieve datasets from the destination
    Failed to retrieve datasets from the destination
  • exit 3

Note: I thought about hard coding the value in the ZXFER script:

LZFS=/usr/sbin/zfs

However, there must be a better option as I’m concerned about breaking something else.

Thanks again for your help!

@xflou
Copy link
Author

xflou commented Jun 22, 2023

Hi Allan,

Just a quick update. I went ahead and hard coded the path for "zfs" in the zxfer script, and it is now
running fine from cron.

#LZFS=$( which zfs )
LZFS="/usr/sbin/zfs"

Additionally tried to use back tics but that failed as well.
Using
LZFS=$( which zfs)
And
LZFS=which zfs

both failed.

So looks like only hardcoding the path seems to work.

Additional info:

Local system: Ubuntu 20.04
remote system: Ubuntu 18.04.5

Thanks

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

No branches or pull requests

2 participants