Problems with qvm-run --pass-io

63 views
Skip to first unread message

Robert Walz

unread,
Mar 2, 2018, 2:39:00 AM3/2/18
to qubes...@googlegroups.com
Hi,

I tried to copy a raw image for a metasploitable vm to dom0, but it doesn't work.

I followed the instructions on https://www.qubes-os.org/doc/hvm/#converting-virtualbox-vm-to-hvm to create the raw image, then I tried to copy it to dom0:

[robert@dom0 ~]$ qvm-run --pass-io tempDebian 'cat "/home/user/meta.raw"' > /var/lib/qubes/appvms/metasploitable/root.img

I stopped the command with Ctrl+C, because the root.img became bigger than the original file's size.
Then I got the following error messages.


CTraceback (most recent call last):
  File "/usr/bin/qvm-run", line 222, in <module>
    main()
  File "/usr/bin/qvm-run", line 217, in main
    r = vm_run_cmd(vm, cmdstr, options)
  File "/usr/bin/qvm-run", line 66, in vm_run_cmd
    gui = options.gui, filter_esc = options.filter_esc)
  File "/usr/lib64/python2.7/site-packages/qubes/modules/000QubesVm.py", line 1689, in run
    retcode = subprocess.call(args, **call_kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 1384, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib64/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
[robert@dom0 ~]$

Does anybody know what this means, or what went wrong?

Thank you in advance.

Robert

donoban

unread,
Mar 2, 2018, 4:05:09 AM3/2/18
to qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/02/2018 08:38 AM, Robert Walz wrote:
> [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'cat
> "/home/user/meta.raw"' >
> /var/lib/qubes/appvms/metasploitable/root.img I stopped the command
> with Ctrl+C, because the root.img became bigger than the original
> file's size. Then I got the following error messages.

Could you post:

[robert@dom0 ~]$ qvm-run --pass-io tempDebian 'ls -lsh
"/home/user/meta.raw"'

Maybe your raw file is an sparse file. I'm not sure if cat would
handle it fine.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEznLCgPSfWTT+LPrmFBMQ2OPtCKUFAlqZE7MACgkQFBMQ2OPt
CKV38g/8CLzOQ1j/mA5SclMy8u4XiOiB8WFTN+SID7dJl2P3PvX8hUQ7gv9vHjS6
SyuBsKRBIOgG6G102oizvc/5qYTU0u97iJ6j0b1uJKDJhadJbhbuDt2rx+d5X3CI
AfFarelpiGjZHPIUZqYAmZeezvwV7wAvm3lwIBJm08Am3NYjIUhDQ/Tm1G2siN0B
PgLjh3+FZEJjJ58cb0x9r08Y+xOFF1pOXYxiGmvRu1hC/kK+s3QRq/jlm7tbdiXE
2EDjVVxX7eNScMfmjs4w9QGa9Ez+Bfp/F0Yt7p6Gqvs3ELhgIL6g/udraZijUQlO
X7NuON20bodrzfKtARYY6EMoi+zKp2Hv5x5v9gtnUgLUOtJkZVm+nuhGgyXbWDDq
UJAb23GGfMh+vXmtgl7zFxrgeX5gV90+C0WzwL6hyKMRMPyoA1prmkJM4DVfgIWX
NjdPCupxgspq9QIIIs9yTwzVZLeswm1CPu2XA4aFCUh5/l5gppahjkmaWO5PECj5
MHmTLh+pVBveMd6VDEa88zAY0qiIvfEyGhOS4y9dps8foYucQC3ojDJ/iXH4KWVq
uzibhzMOtLtgvet9xCifciERtghArITkNvdlYLTC5tisqtrHA0byqgo1sKUkDqrK
YbeSLyp8GTQ3mN+lcYXJ5HsEdJZtzxdYqve1IfopQsU7Z1LNurk=
=oLBE
-----END PGP SIGNATURE-----

Unman

unread,
Mar 2, 2018, 5:14:41 AM3/2/18
to donoban, qubes...@googlegroups.com
On Fri, Mar 02, 2018 at 10:04:53AM +0100, donoban wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 03/02/2018 08:38 AM, Robert Walz wrote:
> > [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'cat
> > "/home/user/meta.raw"' >
> > /var/lib/qubes/appvms/metasploitable/root.img I stopped the command
> > with Ctrl+C, because the root.img became bigger than the original
> > file's size. Then I got the following error messages.
>
> Could you post:
>
> [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'ls -lsh
> "/home/user/meta.raw"'
>
> Maybe your raw file is an sparse file. I'm not sure if cat would
> handle it fine.

I think you're right.
cat will churn the whole file, you need some alternative that is sparse
aware.
The best approach would be:
qvm-run --pass-io tempDebian 'tar -Scf - /home/user/meta.raw' > meta.tar
and then untar the resulting file
Almost anything else (dd, rsync etc) will have some overhead in my
experience.

Chris Laprise

unread,
Mar 2, 2018, 5:38:40 AM3/2/18
to donoban, qubes...@googlegroups.com
On 03/02/2018 04:04 AM, donoban wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 03/02/2018 08:38 AM, Robert Walz wrote:
>> [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'cat
>> "/home/user/meta.raw"' >
>> /var/lib/qubes/appvms/metasploitable/root.img I stopped the command
>> with Ctrl+C, because the root.img became bigger than the original
>> file's size. Then I got the following error messages.
>
> Could you post:
>
> [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'ls -lsh
> "/home/user/meta.raw"'
>
> Maybe your raw file is an sparse file. I'm not sure if cat would
> handle it fine.


If source is sparse, you can also save it as sparse by piping through dd:

qvm-run --pass-io tempDebian 'cat "/home/user/meta.raw"' | dd
conv=sparse of=/var/lib/qubes/appvms/metasploitable/root.img


--

Chris Laprise, tas...@posteo.net
https://github.com/tasket
https://twitter.com/ttaskett
PGP: BEE2 20C5 356E 764A 73EB 4AB3 1DC4 D106 F07F 1886

Unman

unread,
Mar 2, 2018, 5:56:45 AM3/2/18
to Chris Laprise, donoban, qubes...@googlegroups.com
On Fri, Mar 02, 2018 at 05:38:11AM -0500, Chris Laprise wrote:
> On 03/02/2018 04:04 AM, donoban wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > On 03/02/2018 08:38 AM, Robert Walz wrote:
> > > [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'cat
> > > "/home/user/meta.raw"' >
> > > /var/lib/qubes/appvms/metasploitable/root.img I stopped the command
> > > with Ctrl+C, because the root.img became bigger than the original
> > > file's size. Then I got the following error messages.
> >
> > Could you post:
> >
> > [robert@dom0 ~]$ qvm-run --pass-io tempDebian 'ls -lsh
> > "/home/user/meta.raw"'
> >
> > Maybe your raw file is an sparse file. I'm not sure if cat would
> > handle it fine.
>
>
> If source is sparse, you can also save it as sparse by piping through dd:
>
> qvm-run --pass-io tempDebian 'cat "/home/user/meta.raw"' | dd conv=sparse
> of=/var/lib/qubes/appvms/metasploitable/root.img
>
>

But that way you still cat the WHOLE file and then only resparse it after
the transfer. It will take significantly longer.

Chris Laprise

unread,
Mar 2, 2018, 3:33:22 PM3/2/18
to Unman, donoban, qubes...@googlegroups.com
Yes, but there's no risk to dom0 with dd, as there is with parsing a
guest-created tar file.
Reply all
Reply to author
Forward
0 new messages