Getting text and files into dom0

Okay, so I understand that moving data and files from less trusted domains (which is all of them) into dom0 is a bad idea.

But sometimes there’s good reason to do so. Actually good reason, not “I want a wallpaper”.

For example, trying to setup qubes-builderv2 - see this instruction:

In dom0 , copy rpc/policy/50-qubesbuilder.policy to /etc/qubes/policy.d

Pray tell, how is one supposed to do that, other than manually retyping every character of that file? Ctrl-Shift-V won’t paste into the dom0 clipboard, and qvm-copy doesn’t present dom0 as a copy option, nor does it allow the user to manually type in dom0.

The existing advice seem to be to use qvm-run --pass-io [origin cube] 'cat [origin path]' > [destination path] but this doesn’t work either! It always yields cat: [origin path]: No such file or directory

Gate it behind a magic keystroke, pop up a big flashing WARNING THIS IS REALLY DUMB message, I don’t care, but give me a way to get stuff into dom0!

1 Like

Did you used full path from root in [origin path]?
Eg. /home/user/Downloads/rpc/policy or short psth provided in the guide as rpc/policy.
Short path from current directory wont work.

1 Like

Yes, I used the full path. I think the qvm-run is being jailed or something. When I did qvm-run --pass-io work-qubesos -- /bin/sh` I got this weird kinda nothing.

It looks like a normal-looking prompt, but ls shows no files, I can do any kind of cd *whatever*, and just nothing responds or does anything. It’s weird.

But if I type random garbage, I do get a 'sh: qwer: command not found`, so it is doing something. It’s just useless and incomprehensible.

I think qvm-run is only getting standard-error, and is omitting standard-output, in addition to the fact that for whatever reason cat apparently can’t find files that I know exist.

1 Like

Dunno why you have such problems.
I don’t have it.
Iv’e had it only when tried to substitute path with bash environment variables like ~/Downloads/file.txt.

I’m not in home but last time iv’e used it in Friday in a routine that run curl in disposable.

Did you edited some accessing policies in dom0 latelly?

1 Like

This is a brand-new, completely unaltered install of 4.2.4-rc1

Unless this is an rc bug, but I don’t think it is.

1 Like

It’s because this interactive shell notices that it isn’t running in any sort of terminal, so it behaves in a very bare-bones way. A trick to make it slightly more normal is to use the script tool inside the VM to fake a (so-called) dumb terminal for the shell:

$ qvm-run --pass-io work-qubesos -- script --quiet --return /dev/null

You might be running into shell quoting issues. What’s the unedited command and output?

2 Likes
[user@work-qubesos policy]$ cat /home/user/qubes-builderv2/rpc/policy/50-qubesbuilder.policy 
admin.vm.CreateDisposable * work-qubesos dom0 allow target=dom0
admin.vm.CreateDisposable * work-qubesos qubes-builder-dvm allow target=dom0

admin.vm.List * work-qubesos @tag:disp-created-by-work-qubesos allow target=dom0
admin.vm.Start * work-qubesos @tag:disp-created-by-work-qubesos allow target=dom0
admin.vm.Kill * work-qubesos @tag:disp-created-by-work-qubesos allow target=dom0

qubesbuilder.FileCopyIn * work-qubesos @tag:disp-created-by-work-qubesos allow
qubesbuilder.FileCopyOut * work-qubesos @tag:disp-created-by-work-qubesos allow

qubes.Filecopy * work-qubesos @tag:disp-created-by-work-qubesos allow
qubes.WaitForSession * work-qubesos @tag:disp-created-by-work-qubesos allow
qubes.VMShell * work-qubesos @tag:disp-created-by-work-qubesos allow
[skyhawk@dom0 ~]$ qvm-run --pass-io work-qubesos -- `cat /home/user/qubes-builderv2/rpc/policy/50-qubesbuilder.policy`
cat: /home/user/qubes-builderv2/rpc/policy/50-qubesbuilder.policy: No such file or directory
1 Like

Well, remove the quotes around the cat command as, if I’m correct, it’s trying to run the cat command inside dom0 before passing the output to work-qubesos. As cat fails in dom0, no command is provided to work-qubesos.

I personally retype every character of anything I need in dom0 as a way to check the file content.

1 Like

exactly

1 Like

</headdesk>
</headdesk>
</headdesk>

quotes. Not backticks.
I’m a freaking moron.

Thanks for the help.

1 Like

be kind with yourself :wink:

2 Likes

Don’t worry, I can’t count how much time I’ve lost doing that kind of mistake :slight_smile: In fact, we could have spotted the problem with this weird markup here:

Next time, follow @rustybird advice (just after the solution!), providing the unedited command as a code block.

1 Like