qvm-run fails in Whonix VMs

qvm-run fails in Whonix VMs

In Fedora:

[user@fedora]$ qvm-run
Usage: /usr/bin/qvm-run vmname command arguments
Executes a command in another VM using the qubes.VMShell RPC service.  The
arguments are joined with spaces and passed to "bash -c".

Standard input and output are connected to the command.  Unlike qvm-run in Dom0,
this tool does not propagate standard error or exit codes, nor does it offer
protection against the remote VM messing with your terminal if standard output
is your terminal.

You can use $dispvm or --dispvm instead of vmname to start a new DisposableVM.

In any Whonix VM (template, proxy, app):

user@host:/usr/bin$ qvm-run
/usr/bin/qvm-run: 23: /usr/bin/qvm-run: Syntax error: "(" unexpected

Both /usr/bin/qvm-run scripts are identical.

Line 23:
function print_usage(){

Search says issue might be:
#!/bin/sh

Should it be?
#!/bin/bash

Sorry for multiple posts. Should have researched a bit more first.

sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

fixed it. Should that be the default?

Probably not. bash has a good sh compatibility but not a perfect one.
Might break the system in interesting ways.

Don’t mind about this at all. As long as it’s productive and in your case it certainly mostly is! :slight_smile:

I’ve proposed a patch that should be simple enough to manually emulate these changes.

https://github.com/marmarek/qubes-core-agent-linux/pull/70

1 Like

This is also happening in Debian based Qubes VMs. So not a Whonix specific bug but never mind. It may indeed be happening Fedora links /bin/sh to /bin/bash. Not so sure if that would work in Debian now or a bad idea but this minor question is left as an exercise for one interested to figure out. I guess we can consider this solved.