I'm working on a custom OS, and the make
recipe I wrote for creating a new disk image requires sudo
for connecting/disconnecting the virtual HDD image to a /dev/nbdN
device. Because I don't want sudo
in the recipe, I've just been using sudo make disk
.
I thought I could just add myself to the disk
group (as stat /dev/nbd0
shows the UID of the file is root
, and GID is disk
) so I could attach and detach the /dev/nbdN
devices without sudo
, but it still doesn't work (yes, I've logged out and logged back in, and id
shows me in group disk
).
Do I still have to be root
for ioctl
calls to succeed (this is where it seems to fail if I'm not root
)? Or is there something else specific to qemu-nbd
that I need to do to avoid having use root
?
Edit: my command is this (I have R/W permissions for hda.qcow2
):
$ qemu-nbd -c /dev/nbd0 hda.qcow2
And the output is this:
/build/buildd/qemu-2.0.0+dfsg/nbd.c:nbd_init():L504: Failed to set NBD socket
/build/buildd/qemu-2.0.0+dfsg/nbd.c:nbd_receive_request():L638: read failed
Running the same command with sudo
executes successfully with no output.
OS is Ubuntu 14.04 x64.