[SOLVED] ZFS commands not found

inxsible

Active Member
Feb 6, 2020
139
8
38
Hello,

I installed Proxmox 7.1-7 using ZFS as the root file system. I have now setup ssh from my linux box to proxmox. However when i run the zpool command as root it says
Bash:
[proxmox: ~]── - zpool status
zsh: correct 'zpool' to '_zpool' [nyae]? n
zsh: command not found: zpool

Basically all ZFS related commands are not available. I found this thread which indicates that it can be fixed by installing the zfsutils package. But I tried the zpool command in the proxmox node's browser shell, and the command works just fine.

1644766526329.png

However, when I search for zfsutils (from within the ssh connection) it seems that it is already installed :
Bash:
[proxmox: ~]── - apt search zfsutils
Sorting... Done
Full Text Search... Done
zfsutils-linux/now 2.1.1-pve3 amd64 [installed,local]
  command-line tools to manage OpenZFS filesystems

I'd like to understand why it works in the browser shell, but not via the ssh connection. What am I missing here? Does the browser shell use a different sub-system? How would I get it to work from within the ssh connection as well as the browser shell?

Thanks,
 
Last edited:
Ok ..... Chalk this up to not being in the right home directory.

I ssh into the proxmox box using a different ssh username. Then I usually su to get root privs. I have disabled root ssh access and password authentication and use only ssh keys.

When I
Bash:
su
, I am still in the ssh user's home dir and the ZFS commands are not found. But if I
Bash:
su -
, then I move to the root's homedir and tthen the ZFS commands work as expected. I am still not sure exactly why that is, so please chime in if you know the details.

The browser shell is always using the root user so it works in the browser each time.
 

I have created a regular user on my TrueNAS system and my proxmox system. -- inxsible

These regular users do not have any permissions on their respective systems. They are only there so I can use them to ssh into the machine because I have disabled PermitRootLogin in the SSH configs. I have also disabled PasswordAuthentication and use only SSH keys. Once in, I su - to get root access and then do whatever I need to do. This works on both systems just fine when I login from my desktop via SSH.

Now I am trying to set up ZFS replication from TrueNAS to the new RAIDZ2 pool that I created in Proxmox. For this I created a SSH keypair in TrueNAS and then created a SSH Connection. But when I try to create a Replication task in TrueNAS and use the SSH Connection and try to expand the directory structure I get an error: zfs: not found
Code:
Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 138, in call_method
    result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1213, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.9/site-packages/middlewared/schema.py", line 975, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/replication.py", line 642, in list_datasets
    return await self.middleware.call("zettarepl.list_datasets", transport, ssh_credentials)
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1256, in call
    return await self._call(
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1213, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/zettarepl.py", line 409, in list_datasets
    datasets = await self.middleware.run_in_thread(list_datasets, shell)
  File "/usr/local/lib/python3.9/site-packages/middlewared/utils/run_in_thread.py", line 10, in run_in_thread
    return await self.loop.run_in_executor(self.run_in_thread_executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/zettarepl/dataset/list.py", line 13, in list_datasets
    return [dataset["name"] for dataset in list_datasets_with_properties(shell, dataset, recursive)]
  File "/usr/local/lib/python3.9/site-packages/zettarepl/dataset/list.py", line 30, in list_datasets_with_properties
    output = shell.exec(args)
  File "/usr/local/lib/python3.9/site-packages/zettarepl/transport/interface.py", line 89, in exec
    return self.exec_async(args, encoding, stdout).wait(timeout)
  File "/usr/local/lib/python3.9/site-packages/zettarepl/transport/base_ssh.py", line 54, in wait
    raise ExecException(exitcode, stdout)
zettarepl.transport.interface.ExecException: sh: 1: zfs: not found
Is this because I am trying the ssh connection with the regular user and not the root user -- or am I doing something wrong? Do I have to set up ZFS replication using the root accounts on both ends?

Is there any way to allow the regular user run the zfs/zpool etc commands?
 
Last edited:
Is there any way to allow the regular user run the zfs/zpool etc commands?
If you install sudo you can edit the /etc/sudoers file and add new rules to allow a user to run specific commands. That way you could allow your inxsible user to be able to use the zfs and zpool commands even if that normally would require root rights.
 
hmm... I didn't want to install too many extraneous packages on Proxmox -- so I am going to try with the root user to make sure there isn't something else that is an issue first.
 
Just an update.

Created a key in TrueNAS and pasted it in the root's authorized_keys file and was able to set up the connection via the root account?

Ideal? No, as I would have liked to disable root logins on the SSH. But at the same time, I didn't want to veer too much away from standard Proxmox install by installing a bunch of packages like sudo etc because after some time, I tend to forget these details and then during an upgrade or a migration, things stop working and that's just a hassle.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!