sickcodes / Docker-OSX

Run macOS VM in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X Security Research! Docker mac Containers.
https://hub.docker.com/r/sickcodes/docker-osx
GNU General Public License v3.0
47.98k stars 2.65k forks source link

Fail to run Docker-OSX on Digital Ocean Ubuntu18.04&20.04&CentOS #349

Open guoguoguilai opened 3 years ago

guoguoguilai commented 3 years ago

After doing the inital step and reboot, the output remains still the same.

root@ubuntu-s-2vcpu-4gb-fra1-01:~# echo $DISPLAY
localhost:10.0
root@ubuntu-s-2vcpu-4gb-fra1-01:~# xhost +
access control disabled, clients can connect from any host
root@ubuntu-s-2vcpu-4gb-fra1-01:~# docker run -it     --device /dev/kvm     -p 50922:10022     -v /tmp/.X11-unix:/tmp/.X11-unix     -e "DISPLAY=10.0"     sickcodes/docker-osx:latest
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
nohup: appending output to 'nohup.out'
++ id -u
++ id -g
+ sudo chown 1000:1000 /dev/kvm
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ [[ 3 = max ]]
+ [[ 3 = half ]]
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ exec qemu-system-x86_64 -m 3000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check, -machine q35,accel=kvm:tcg -smp 4,cores=4 -usb -device usb-kbd -device usb-tablet -device 'isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' -drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd -drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd -smbios type=2 -audiodev alsa,id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -device ide-hd,bus=sata.3,drive=InstallMedia -drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 -drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD -netdev user,id=net0,hostfwd=tcp::10022-:22,hostfwd=tcp::5900-:5900, -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17 -monitor stdio -boot menu=on -vga vmware
Unable to init server: Could not connect: Connection refused
QEMU 6.1.0 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `dac'
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
gtk initialization failed

I also tried other image, and got no luck.

OS related issued, please help us identify the issue by posting the output of this

Linux ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
localhost:10.0
1
NAME="Ubuntu"
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        78G   17G   62G  21% /
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
libvirtd (libvirt) 6.0.0
              total        used        free      shared  buff/cache   available
Mem:          3.8Gi       217Mi       871Mi       1.0Mi       2.8Gi       3.4Gi
Swap:            0B          0B          0B
2
2
crw-rw---- 1 root kvm 10, 232 Sep 28 01:22 /dev/kvm
total 8.0K
drwxrwxrwt  2 root root 4.0K Sep 28 01:14 .
drwxrwxrwt 11 root root 4.0K Sep 28 01:22 ..
root         820  2.6  2.2 1900412 91136 ?       Ssl  01:14   0:14 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root        2283  0.0  0.0   8160   724 pts/0    S+   01:23   0:00 grep --color=auto dockerd
kvm:x:108:
docker:x:998:
libvirt:x:120:
libvirt-qemu:x:64055:libvirt-qemu
libvirt-dnsmasq:x:121:
sickcodes commented 3 years ago

Are you root? Do you have a desktop running?

I believe you're missing from the Docker group

guoguoguilai commented 3 years ago

Are you root? Do you have a desktop running?

I believe you're missing from the Docker group

Yes, I am root. But I don't have a desktop running. Should I install gnome in my DO?

guoguoguilai commented 3 years ago

After installing gnome, I still got no luck. I am running on a clean Digital Ocean Droplet. Is there any tutorial on How to Run Docker-OSX On Digital Ocean? Or could anyone share a Custom Images of Droplets?

sickcodes commented 3 years ago

This script is for Digital Ocean, CPU Optimized servers: https://github.com/sickcodes/Docker-OSX/blob/master/tests/test.sh

guoguoguilai commented 3 years ago

This script is for Digital Ocean, CPU Optimized servers: https://github.com/sickcodes/Docker-OSX/blob/master/tests/test.sh

Thank you. I will try it out. Can I use SHARED CPU server to run this script?

sickcodes commented 3 years ago

I don't think it works, but I know the CPU optimized servers do :)

sickcodes commented 3 years ago

I also got this error today, will figure out if I did anything wrong

MaxPowerReforged commented 3 years ago

I am getting this error as well running locally on my machine, Manjaro with KDE desktop.

MaxPowerReforged commented 3 years ago

In my case I was doing a silly mistake, I wasn't running the command as root, so just sudo su fixed it. Just writing it in case somebody has the same problem.

corwin-of-amber commented 3 years ago

I am running with sudo su, but still I get gtk initialization failed.

Using Debian 10 with OpenBox desktop.

corwin-of-amber commented 3 years ago

It seems like it was the xhost + problem after all. I have set it but apparently only after having fiddled too much with the DISPLAY setting. My X11 was running on display :1; so xhost + then running the command with -e "DISPLAY=:1" just works. What threw me off was that omitting the -e "DISPLAY=..." silences the error Client cannot connect, and does not issue an error about an unset DISPLAY variable. But it does fail if it is not set.

sickcodes commented 3 years ago

Yeah I have it set so it will select :0 by default, if DISPLAY is unset.

corwin-of-amber commented 3 years ago

Yeah I have it set so it will select :0 by default, if DISPLAY is unset.

Oh that does explain why there was no error for DISPLAY being missing. Dunno why there was no error about it trying to connect to a nonexistent display.