[user@user-desktop ~]$ sudo zpool trim rustpPermission denied the ZFS utilities must be run as root.
The pool is named ‘rustpool.’ No clue when tab completion quit working for my zfs utilities. No clue if this is a sudo problem, a bash problem, or a zfs problem. Teh Googles are failing me. My sudo “passthru” tabs for other commands seems fine.
Any ideas/thoughts/advice for this sad and lazy camper?
I’m not sure if this is your problem, but have you tried logging in as root and doing this? IIRC, it won’t tab complete super user task commands from a regular user, but that could be my memory failing me.
sudo -i and sudo -s provide slightly different environments. Nevertheless, tab completion is AFAIK handled by the shell. At the time you’re typing the command, the ZFS command is not actually running.
I can’t rule out that there may be an API that allows the shell to query a command to help with tab completion, but it may just be a Good Idea™ rather than something that’s actually done. (Good idea IMNSHO - I haven’t thought through the implications.)
I’m used to bash with fairly simple tab completion. I’m aware that there are shells that offer more (fish?) but haven’t tried them.
if i remember correctly the ‘correct way’ / ‘acceptable way’ to get this working is to make a special entry for sudoers.
you add a special entry for zfs that makes zpool trim work for a special group without password.
if you only add ‘zpool’ that group can do anything as sudo on zpool but if you add ‘zpool trim’ only trim command of zpool works without password. so its a security issue if making it to broad.
I’m trying this on a VM with a fresh copy of EndeavourOS. In the process of getting zfs installed, running, and creating a pool, my completions went from working with zfs/zpool commands to not working. That is, I could type ‘sudo zpool’ and see a list of the zpool commands. Now I can’t. This is even more broken than my main system.
I’m going to back off my previous answer. Apparently there is a sort pf API for the shell to identify possible completions. It seems like that’s done by the file you listed. /usr/share/bash-completion/completions/zfs I have it on Debian Bookworm and completions are not working in my user shell or with sudo -i or sudo -s. It seems like either changes to that file or changes to bash have caused this.