On 09/01/2017 05:13 PM, Unman wrote:
On Tue, Aug 29, 2017 at 04:08:38PM -0700, nicholas roveda wrote:
I'm using R4.0 rc1.

I wanted to install a Linux distro inside a disk image located in dom0 home, 
using QEMU in an AppVM.

I've created a new disk image in dom0, set it up (dos partition label and a 
primary ext4 partition) and attached it with `kpartx` to loopX, but `qvm-block` 
doesn't list it in the exposed block devices.

So, in order to understand better how Qubes handles this, I've tried to do the 
same in a VM and see if the dom0 would catch the event, but nothing.
Strangely, when I detached the disk image, both the 'AppVM:loopX - IMG_PATH is 
available' and 'AppVM:loopX - IMG_PATH is removed' notifications appeared on 
the screen.

I've read a lot about it, but I think what I found was all related to a < R4.0 
version, so I don't know if this issue is related to a intended design or a bug.



Procedure:
[user@dom0 ~]$ dd if=/dev/zero of=/home/user/table.raw bs=2048 count=1
[user@dom0 ~]$ dd if=/dev/zero of=/home/user/root.raw  bs=3GB  count=1
[user@dom0 ~]$ mkfs.ext4 /home/user/root.raw
[user@dom0 ~]$ cat /home/user/{table,root}.raw > /home/user/root.img
[user@dom0 ~]$ rm /home/user/{table,root}.raw
[user@dom0 ~]$ truncate -s 3GB /home/user/root.img
[user@dom0 ~]$ fdisk /home/user/root.img
                    o      new DOS partition table
                    n      new partition
                    p      primary
                    1      first
                    2048   first sector
                    \n     to the end
[user@dom0 ~] fdisk -l /home/user/root.img
Disk /home/user/root.img: 2.8 GiB, 3000000000 bytes, 5859375 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xda159b44

Device     Boot Start     End Sectors  Size Id Type
root.img1        2048 5859374 5857327  2.8G 83 Linux

[user@dom0 ~] sudo kpartx -a /home/user/root.img
[user@dom0 ~] losetup -l
NAME        SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                           
DIO
/dev/loop40         0      0         0  0 /home/user/root.img
   0
[user@dom0 ~] ls /dev/mapper
control loop40p1 ...


I'm not surprised at this.
Can you use qvm-block -A to attach a file? Wouldnt that be
easier for you?

-A is 3.2 notation and the file support was removed in 4.0rc1 I believe (it was less reliable than loop devices in 3.2 already anyway).

I don't know what the problem is though: qvm-block l lists everything in 4.0rc1 that is attached to some VM (recently tested exactly that by chance) - including loop devices.

Just do this in dom0:
losetup --show -f [file]
qvm-block a [VM] dom0:loop[i]
qvm-block l

Maybe you're also running at an older version than me though; I did one testing-repo-upgrade in dom0 & fedora template VM recently.

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/05249217-7491-c6ee-4450-2e623bf7b230%40hackingthe.net.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to