Use of dd in qubes to burn a iso on usb

Like suggestions on how to make a bootable usb within a cube after downloading an iso file. In a non cubes environment it’s easy to:

dd bs=4d if:source file of= /dev/sdX/destination file

with the source file in download directory and the usb in dev. Of course in qubes non of that is present. Couldn’t find much in dom0 either.

Direction would be appreciated.

You could either attach the device to untrusted VM and copy the ISO to that VM to write to the device. Or you could copy the ISO to the USB VM and write to the USB-device “directly”. In both cases watch out for sufficient private storage. It’s “only” 2GB by default.

I would never attach “untrusted” devices to any private VM (or even worse dom0).

1 Like

I just went through the process yesterday.

It seemed that it was maybe necessary -with sys-usb- to attach the whole device, immediately after plugging it in, and not to attach any of its partitions.

I was using the widget to attach my usb key, and any previous checking or mounting of the partitions apparently led to errors during dd.

I’d be interested to know if anyone else sees the same. I did not do many repeated tests, so maybe I simply have a weird usb controller, or some other problem, or I was just unlucky.

Edit: I used a fedora-40-lxde based disposable, which didn’t do any automounting.

Yes, otherwise you’d be writing a partition map inside of an already existing partition map, which would make the host machine incredibly confused, and think the USB stick was corrupted.


Other than that, dd works exactly the same inside a qube as on bare metal. The /dev directory inside the qube behaves the same as on bare metal, but with one important difference.

Most block devices will show up as Xen Virtual Devices (xvd), so assuming you’ve never attached any USB devices to the qube, the first block device should show up as /dev/xvdi (because the internal storage drives inside the qube will likely have taken up xvd[a-h].

This is correct. After much testing, it seems the only way to get the failures I saw is maybe to try writing on a qube that doesn’t have the USB attached.

1 Like

@rebuilder : I notice that the qubes documentation is not very complete. You may not need so much detail, but maybe it can be helpful for others…

The main things to remember are:

  1. Use the ‘device’ widget, which looks a little like a USB key on Qubes 4.2. The online qubes docs show an older icon.
  2. Select your storage device from the bottom “Devices” section - not from the block devices further up the list. Connect it to your qube containing the iso file.
  3. Use journalctl in a terminal on “qube with the iso file”, to verify which device was created. It will probably look similar to “/dev/sda”. For example, you can simply type journalctl, and then look at the last lines.
  4. Use a suitable dd command to copy the iso.
  5. Take care not to copy to a partition by accident ( for example, /dev/sda1 is a partition on the /dev/sda device.)
1 Like