dhyve icon indicating copy to clipboard operation
dhyve copied to clipboard

com.apple.vmnet is missing

Open evanmcc opened this issue 9 years ago • 59 comments

the file /Library/Preferences/SystemConfiguration/com.apple.vmnet doesn't exist.

This leads to errors of the flavor:

The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Mask) does not exist
/usr/local/bin/dhyve: line 82: ( << 24) | ( << 16) | ( << 8) |  : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) |  ")
/usr/local/bin/dhyve: line 82: ( << 24) | ( << 16) | ( << 8) |  : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) |  ")
/usr/local/bin/dhyve: line 91: &  : syntax error: operand expected (error token is "&  ")

evanmcc avatar Sep 03 '15 18:09 evanmcc

it doesn't exist at all? what version of OSX are you on?

nlf avatar Sep 03 '15 18:09 nlf

totally not there. Yosemite upgraded recently from Mavericks

evanmcc avatar Sep 03 '15 18:09 evanmcc

can you run the command sudo find / -name com.apple.vmnet.plist and tell me what it finds? it can take a while for that command to finish, but it should find the file somewhere.

nlf avatar Sep 03 '15 18:09 nlf

no results, sadly.

evanmcc avatar Sep 03 '15 18:09 evanmcc

very interesting. i'll have to look into this deeper. @ailispaw ever seen this happen?

nlf avatar Sep 03 '15 18:09 nlf

Just had the same issue. no results for the find as well. Yosemite 10.10.5 (14F27), full install, not an upgrade

jgeiger avatar Sep 03 '15 20:09 jgeiger

@nlf I've never seen that before. @evanmcc @jgeiger Have you ever run xhyve successfully? Could you try https://github.com/ailispaw/boot2docker-xhyve? I guess that plist will be created when xhyve runs with vmnet at the first time.

ailispaw avatar Sep 03 '15 21:09 ailispaw

@ailispaw that worked, thanks!

@nlf I had to recreate the vm afterwards (dhyve stop; dhyve destroy; dhyve init; dhyve up) to make this work, but it does seem to be working now.

evanmcc avatar Sep 03 '15 21:09 evanmcc

ok, great, thanks for letting me know. i bet we can work out a solution to this in the script.

nlf avatar Sep 03 '15 21:09 nlf

@evanmcc You're welcome. I'm glad that worked for you.

ailispaw avatar Sep 03 '15 21:09 ailispaw

running the b2d version fixed this issue for me. once started, the running instance hung after 3 commands so I had to kill it via kill -9

jgeiger avatar Sep 04 '15 02:09 jgeiger

Have the exact same problem but boot2docker-xhyve doesn't work for me because clang (tried different versions) persistently crashes while compiling uuid2mac.

therealprof avatar Sep 12 '15 15:09 therealprof

@therealprof can you pull from master and try again with the latest version of the script and tell me if that works for you?

nlf avatar Sep 12 '15 16:09 nlf

Works fine, thanks.

therealprof avatar Sep 12 '15 16:09 therealprof

did you get the warning about restarting the vm to setup nfs exports?

nlf avatar Sep 12 '15 16:09 nlf

Maybe the reply was too early... How long is it supposed to be starting up?

[dhyve] this command requires root, restarting with sudo.. Password: [dhyve] starting.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

therealprof avatar Sep 12 '15 16:09 therealprof

hmm, it should've started fairly quickly. can you check the output of ps aux | grep xhyve and see if the vm shows up?

nlf avatar Sep 12 '15 16:09 nlf

Still starting up but xhyve is not in the process list.

therealprof avatar Sep 12 '15 16:09 therealprof

go ahead and hit control-c to stop the startup and try again, if it's not in the list something failed along the way.

nlf avatar Sep 12 '15 16:09 nlf

Tried to start it manually using the information from dhyve status and get the error:

virtio_net: Could not create vmnet interface, permission denied or no entitlement?

Seems like two things are foul: The vmnet stuff is not correct and dhyve does not detect that xhyve exited early due to problems.

therealprof avatar Sep 12 '15 16:09 therealprof

the permission denied sounds like you didn't use sudo when trying to start it manually.

we do need to figure out how to detect a crash in xhyve though

nlf avatar Sep 12 '15 16:09 nlf

I did. ;)

sudo xhyve -A -m 2G -c 1 -s 0:0,hostbridge -l com1,stdio -s 31,lpc -s 2:0,virtio-net -s 4,virtio-blk,/Users/foo/.dhyve/disk.img -U 2996454B-06DE-43B0-9FC6-9E9F38D1DCAE -f kexec,/Users/foo/.dhyve/bzImage,/Users/foo/.dhyve/rootfs.cpio.xz,console=ttyS0 hostname=dhyve uuid=2996454B-06DE-43B0-9FC6-9E9F38D1DCAE virtio_net: Could not create vmnet interface, permission denied or no entitlement?

therealprof avatar Sep 12 '15 16:09 therealprof

try it like this with the quotes around the kernel command line

sudo xhyve -A -m 2G -c 1 -s 0:0,hostbridge -l com1,stdio -s 31,lpc -s 2:0,virtio-net -s 4,virtio-blk,/Users/foo/.dhyve/disk.img -U 2996454B-06DE-43B0-9FC6-9E9F38D1DCAE -f kexec,/Users/foo/.dhyve/bzImage,/Users/foo/.dhyve/rootfs.cpio.xz,"console=ttyS0 hostname=dhyve uuid=2996454B-06DE-43B0-9FC6-9E9F38D1DCAE"

nlf avatar Sep 12 '15 16:09 nlf

Same problem. But since the commandline was assembled by dhyve anyway I would expect it to work as is when called from dhyve, no? ;)

therealprof avatar Sep 12 '15 16:09 therealprof

very strange. ok i'll continue debugging on my end, thanks for the info!

nlf avatar Sep 12 '15 16:09 nlf

Hi @therealprof , Thank you for trying boot2docker-xhyve.

because clang (tried different versions) persistently crashes while compiling uuid2mac.

Did you see any error messages on compiling uuid2mac? If so, could you provide it for me?

And I would like to know the version of your Yosemite 10.10.x and vmnet.framework.

# for vmnet.framework
$ cat /System/Library/Frameworks/vmnet.framework/Resources/version.plist

ailispaw avatar Sep 12 '15 20:09 ailispaw

Did you see any error messages on compiling uuid2mac?

No, it just segfaults, same message with the standard Xcode clang:

tar zxvf boot2docker-data.tar.gz x boot2docker-data.img /Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip ld uuid2mac.sym clang-3.6: error: unable to execute command: Segmentation fault: 11 clang-3.6: error: linker command failed due to signal (use -v to see invocation) make[1]: *** [build/uuid2mac.sym] Error 254 make: *** [uuid2ip/build/uuid2mac] Error 2

And I would like to know the version of your Yosemite 10.10.x and vmnet.framework. cat /System/Library/Frameworks/vmnet.framework/Resources/version.plist

Yosemite is 10.10.5 (14F27)

BuildVersion : 23 SourceVersion : 122001001000000

therealprof avatar Sep 12 '15 20:09 therealprof

@therealprof Thank you so much for the prompt reply. Your versions are same as mine.

How about xhyve itself? Did you compile xhyve without any problems?

ailispaw avatar Sep 12 '15 21:09 ailispaw

I'm using the bottled homebrew xhyve version.

therealprof avatar Sep 12 '15 21:09 therealprof

Oh, I see. xhyve v0.2.0?

ailispaw avatar Sep 12 '15 21:09 ailispaw

Yes, that's v0.2.0. Just reinstalled the --HEAD version, same thing for both dhyve not starting and boot2docker-xhyve failing to compile.

therealprof avatar Sep 12 '15 21:09 therealprof

Hmm.. How about sudo ./xhyverun.sh at boot2docker-xhyve? It is supposed to boot boot2docker-xhyve without uuid2mac.

ailispaw avatar Sep 12 '15 21:09 ailispaw

sudo ./xhyverun.sh Password: 2015-09-12 23:20:39.863 defaults[85576:1924026] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Address) does not exist 2015-09-12 23:20:39.882 defaults[85577:1924033] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Mask) does not exist ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 19: & : syntax error: operand expected (error token is "& ") 2015-09-12 23:20:39.939 defaults[85581:1924041] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Address) does not exist 2015-09-12 23:20:39.957 defaults[85582:1924046] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Mask) does not exist ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 19: & : syntax error: operand expected (error token is "& ") sudo nfsd restart virtio_net: Could not create vmnet interface, permission denied or no entitlement? 2015-09-12 23:20:40.498 defaults[85616:1924119] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Address) does not exist 2015-09-12 23:20:40.516 defaults[85617:1924125] The domain/default pair of (/Library/Preferences/SystemConfiguration/com.apple.vmnet, Shared_Net_Mask) does not exist ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 10: ( << 24) | ( << 16) | ( << 8) | : syntax error: operand expected (error token is "<< 24) | ( << 16) | ( << 8) | ") ./vmnet_export.sh: line 19: & : syntax error: operand expected (error token is "& ") sudo sed -E -e '/^$/d' -i.bak /etc/exports sudo nfsd restart

therealprof avatar Sep 12 '15 21:09 therealprof

I see. Please comment out make exports line in the xhyverun.sh.

ailispaw avatar Sep 12 '15 21:09 ailispaw

Maybe the same thing as dhyve, I guess.

ailispaw avatar Sep 12 '15 21:09 ailispaw

dhyve is not working either... It all boils down to:

$ sudo ./xhyverun.sh virtio_net: Could not create vmnet interface, permission denied or no entitlement?

therealprof avatar Sep 12 '15 21:09 therealprof

It seems something wrong with libraries or framworks in your system, which xhyve uses. I guess that you may not be able to compile xhyve from its source in your Mac and it's not related to dhyve but xhyve.

ailispaw avatar Sep 12 '15 21:09 ailispaw

Or do you have any zombie processes of xhyve? If so, please kill all of them.

ailispaw avatar Sep 12 '15 21:09 ailispaw

brew install xhyve --HEAD is compiling directly from the git sources. As mentioned I've tried that but still no change.

The least thing that boot2docker-xhyve should do IMHO is to check whether /Library/Preferences/SystemConfiguration/com.apple.vmnet exists and bail out with a meaningful error message before causing lots of random error messages. ;)

No, there're no xhyve processes running.

therealprof avatar Sep 12 '15 21:09 therealprof

I see. Yes, boot2docker-xhyve should do it.

Hmm. It seems I can not help you for now. I will investigate it. Thank you for your time.

ailispaw avatar Sep 12 '15 21:09 ailispaw

It looks similar to this. https://llvm.org/bugs/show_bug.cgi?id=24732

Sorry for bothering you with boot2docker-xhyve things here. I will open an issue at boot2docker-xhyve.

ailispaw avatar Sep 12 '15 22:09 ailispaw

I'm seeing a similar issue, with a failure of virtio_net: Could not create vmnet interface, permission denied or no entitlement? (status = 1001) when trying to run any xhyve variant using vmnet.framework

I also see in Console.app when this happens the messages

9/15/15 3:23:19.926 AM com.apple.framework.netrb[78097]: error: Connection invalid
9/15/15 3:23:19.927 AM com.apple.framework.vmnet[78097]: interface 0x7f9f02003800, netrb client create failed

apage43 avatar Sep 15 '15 10:09 apage43

At least on my end, the issue I and @therealprof are having seems to have been caused by NAT/Network Sharing having been disabled on my mac. com.apple.NetworkSharing must be running for vmnet to work.

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.NetworkSharing.plist

Also NAT has to be enabled for NetworkSharing to run:

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict Enabled -int 1

EDIT: After this I can run xhyve with working network, ping back and forth from the host and guest, but still am not seeing /Library/Preferences/SystemConfiguration/com.apple.vmnet get created.

apage43 avatar Sep 16 '15 01:09 apage43

Hm, does not work for me:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.NetworkSharing.plist /System/Library/LaunchDaemons/com.apple.NetworkSharing.plist: Operation already in progress

And NAT was already enabled.

xhyve is still complaining.

therealprof avatar Sep 16 '15 06:09 therealprof

Wow this is a long thread.

I think I have the same issue

% ls /Library/Preferences/SystemConfiguration/com.apple.vmnet
ls: /Library/Preferences/SystemConfiguration/com.apple.vmnet: No such file or directory

however it's being masked by #653b8e8c3 so I just see [dhyve] your vm has started, however since this is your first start we were unable to configure nfs shares. please run 'dhyve down' and then 'dhyve up' to restart the vm and enable the nfs share on every start.

Is this file meant to be created by the Yosemite installer?

edrex avatar Sep 23 '15 19:09 edrex

The current theory is that file is created when the network sharing has been used the first time. Note though, that the filename is /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist

nlf avatar Sep 23 '15 20:09 nlf

Oh I have that file.

edrex avatar Sep 24 '15 00:09 edrex

It turns out the script was giving a false negative because 653b8e8 left out the .plist suffix. @evanmcc, in the original report you are also missing the suffix. What does

ls /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist

output?

edrex avatar Sep 24 '15 00:09 edrex

good eye, added in the .plist extension

nlf avatar Sep 24 '15 00:09 nlf

the other part of that commit is needed too, to avoid an error when the file exists. I swear I created a PR for that commit, but I can't find it now.

edrex avatar Sep 24 '15 14:09 edrex

i'm not sure i follow, i left the commit intact and only added the .plist extension to the test. what else am i missing?

nlf avatar Sep 24 '15 16:09 nlf

I had to change the test on L313 to avoid an error when the file exists (since the test expects an integer) , see the commit message and body of 9acf6f88.

edrex avatar Sep 24 '15 16:09 edrex

just pushed an update, should take care of that

nlf avatar Sep 24 '15 16:09 nlf

I am facing a similar problem

~/vm $ sudo ./up
virtio_net: Could not create vmnet interface, permission denied or no entitlement?

~/vm $ cat up
#!/bin/sh
KERNEL="boot/vmlinuz-4.4.0-21-generic"
INITRD="boot/initrd.img-4.4.0-21-generic"
CMDLINE="earlyprintk=serial console=ttyS0 acpi=off root=/dev/vda1 ro"

UUID="-U c4670d36-43fe-41d0-8748-2700fa951c5f"
MEM="-m 1G"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3,ahci-cd,ubuntu-16.04.iso"
IMG_HDD="-s 30,virtio-blk,hdd.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
ACPI="-A"
xhyve $ACPI $MEM $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,"$CMDLINE"

~/vm $ xhyve -v
xhyve: 1300b4

xhyve is a port of FreeBSD's bhyve hypervisor to OS X that
works entirely in userspace and has no other dependencies.

Homepage: https://github.com/mist64/xhyve
License: BSD

~/vm $ ls /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist
/Library/Preferences/SystemConfiguration/com.apple.vmnet.plist

~/vm $ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.5
BuildVersion:   14F1713

NOTE: If I run xhyve without $UUID OS boots up just fine, but I wish a same ip for every boot.

pr4th4m avatar May 06 '16 06:05 pr4th4m

Actually all of my problem just vanished this morning. Yesterday night I was looking through various log files again to find the reason for sporadic erratic behaviour of some applications (like the clipboard not working in the latest Chromium version) and in due course I discovered that there were some old files in /var/run and /var/db which were not supposed there and couldn't be removed. So I booted into Recovery and did a little spring cleaning, including disabling rootless mode and removing those bogus files and plenty of others which haven't been touched since 2011; sure enough after a reboot dhyve, xhyve, Veertu and the Docker for Mac Beta didn't have any problems wrt to networking anymore.

Not exactly sure what exactly was the culprit here but something most certainly was.

NB: This system has been updated all the way from Leopard so if you have a senior system, you might want to check for any leftovers...

therealprof avatar May 06 '16 07:05 therealprof

Found it !! In my case culprit was UUID (I have no idea why)

May  6 15:03:26 MacBook-Air.local sudo[17863]: prathamesh.nevagi : TTY=ttys005 ; PWD=/Users/prathamesh.nevagi/vm ; USER=root ; COMMAND=./up
May  6 15:03:26 MacBook-Air com.apple.xpc.launchd[1] (com.apple.ftp-proxy): Unknown key for Boolean: ForceEnableHack
May  6 15:03:26 MacBook-Air.local InternetSharing[17866]: mac address conflict with given uuid
May  6 15:03:26 MacBook-Air.local InternetSharing[17866]: unable to get MAC address

By changing the UUID I get same IP across reboots. Weird part is, I had picked the UUID randomly the firs time as well.

pr4th4m avatar May 06 '16 09:05 pr4th4m

@therealprof I'm having all of the same issues that you're having.

What exactly did you remove in /var/db and /var/run?

nhooey avatar Jan 26 '17 18:01 nhooey

I posted a Stack Overflow question since it's a better forum to answer these sorts of things.

nhooey avatar Jan 26 '17 20:01 nhooey

@nhooey I'm sorry but I have really no idea what exactly did the trick. It was simply some severe pruning and suddenly things worked again.

therealprof avatar Jan 26 '17 20:01 therealprof