You are not logged in.
Pages: 1
I want to be able to use macvtap in Qemu as a user. Preferably I would like to be able to create it as a user as well.
Description:
https://virt.kernelnewbies.org/MacVTap
My story here in the forum:
https://bbs.archlinux.org/viewtopic.php?id=277623
The following script (vmscript.sh) is here:
cat vmscript.sh
# VMimage
hdf="/home/username/arch.qcow2"
# I create a MacVtap1 with:
#ip link add link eth1 name macvtap1 type macvtap
#ip link set macvtap1 address 1a:46:0b:ca:bc:7b up
#ip link show macvtap1
# Alternatively with mode:
link add link eth1 name macvtap1 type macvtap mode bridge
ip link set macvtap1 up
ip link show macvtap1
# I start Qemu with:
qemu-system-x86_64 -drive file=$hdf,format=qcow2 -enable-kvm -machine q35 -device intel-iommu -cpu host -m 4G -net nic,model=virtio,macaddr="$(cat /sys/class/net/macvtap1/address)" -net tap,fd=3 3<>/dev/tap"$(cat /sys/class/net/macvtap1/ifindex)"
I start the script with:
/usr/bin/sudo vmscript.sh
This works fine so far. But I would like to start Qemu as user.
If I now only want to start the Qemu line in the script as user, the following message comes up:
vmscript.sh: line XX: /dev/tap8: Permission denied
Unfortunately I don't know how to change the permissions accordingly. Can someone point me to the right way?
Offline
Can't any of you nice people help me?
Offline
Try running a libvirt VM with a macvtap device attached and post the output of ls -l /dev/ | grep tap .
Maybe that will help to figure out how libvirt does it.
I also think that you should edit the title to reflect you want to run qemu from cli .
I may have given bad advise by recommending kernel & hardware, in hindsight networking seems a better fit
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Online
@treeh0rse: Unfortunately no help from my side, but in case you have found a way to finally accomplish this without libvirt, please post back. I have asked this same question twice on the qemu mailing list, without any reply so far. That was sometime before corona. I just have come so far, that the file descriptor way does not work any more.
I assume, you have used the same link (I have found only one), and that is horribly outdated.
Again, no help here, sorry, but in case you go down the libvirt route, any feedback would be highly appreciated.
Offline
@Lone_Wolf
ls -l /dev/ | grep tap
crw------- 1 root root 509, 1 Aug 15 06:26 tap8
Qemu started from Libvirt runs as user. I will try to find out how Qemu is started from libvirt.
I'll wait a bit and then ask the question again in the other section if necessary, if I can't solve the problem myself.
@EdeWolf
Thanks for your reply. Yes, I will report here. Nice to know I'm not alone in my concern. It's really strange, I find it a basic functionality from a VM "system" to be able to use a defined network card. VMware and VBox... Simple and no problem.
Qemu from virt-manager works fine and can do everything I want. But Qemu-cli is a very little bit faster.
Offline
@Lone_Wolf
Qemu from virt-manager works fine and can do everything I want. But Qemu-cli is a very little bit faster.
And it safes some bloat and I am not sure, it can do everything the command line can. A while back I have (unsuccessfully though, as with macvtap) playing around with scsi passthrough, so far I am not sure, libvirt (or one of it's guis) are offering this. May be wrong here, of course. Due to it's dependency galore I have so far refused to install it.
Offline
Have you tried executing the script as none root but with the CAP_NET_ADMIN capability or with a custom net namspace https://github.com/rootless-containers/slirp4netns
Offline
Pages: 1