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
36.1k stars 1.78k forks source link

failed to start on Ubuntu 20.04 due to pulseaudio #429

Open j75 opened 2 years ago

j75 commented 2 years ago

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

uname -a \ ; echo "${DISPLAY}" \ ; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs \ ; grep NAME /etc/os-release \ ; df -h . \ ; qemu-system-x86_64 --version \ ; libvirtd --version \ ; free -mh \ ; nproc \ ; egrep -c '(svm|vmx)' /proc/cpuinfo \ ; ls -lha /dev/kvm \ ; ls -lha /tmp/.X11-unix/ \ ; ps aux | grep dockerd \ ; docker ps | grep osx \ ; grep "docker|kvm|virt" /etc/group

Linux 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux :0 1 NAME="Ubuntu" PRETTY_NAME="Ubuntu 20.04.3 LTS" VERSION_CODENAME=focal UBUNTU_CODENAME=focal Filesystem Size Used Avail Use% Mounted on /dev/sda5 283G 196G 73G 73% /home QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.19) Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers libvirtd (libvirt) 6.0.0 total used free shared buff/cache available Mem: 31Gi 4,1Gi 19Gi 315Mi 7,1Gi 26Gi Swap: 32Gi 0B 32Gi 4 8 crw-rw-rw-+ 1 root kvm 10, 232 janv. 21 23:30 /dev/kvm total 0 drwxrwxrwt 2 root root 60 janv. 21 20:46 ./ drwxrwxrwt 21 root root 520 janv. 21 23:39 ../ srwxrwxrwx 1 root root 0 janv. 21 20:46 X0= root 2466 0.0 0.2 1094880 97396 ? Ssl 20:47 0:05 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock marian 44384 0.0 0.0 15408 2716 pts/0 S+ 23:39 0:00 grep --color dockerd kvm:x:108:marian libvirt:x:150:marian,nina libvirt-qemu:x:64055:libvirt-qemu libvirt-dnsmasq:x:151: docker:x:152:marian

My username is marian.

When starting the application:

% docker run --rm --device /dev/kvm -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket  -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
sudo: effective uid is not 0, is /usr/sbin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
sudo: effective uid is not 0, is /usr/sbin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
++ id -u
++ id -g
+ sudo chown 1000:1000 /dev/kvm
+ true
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ true
+ [[ 4 = max ]]
+ [[ 4 = half ]]
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ true
+ exec qemu-system-x86_64 -m 4000 -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 pa,server=unix:/tmp/pulseaudio.socket,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/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
No protocol specified
pulseaudio: Wrong context state
pulseaudio: Reason: Access denied
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
audio: warning: Using timer based audio emulation
QEMU 6.2.0 monitor - type 'help' for more information
(qemu) gtk initialization failed
sickcodes commented 2 years ago

This looks like gtk initialization failed issue instead, xhost + and check the test folder script for anything missing

j75 commented 2 years ago

Yes, it is better after doing that - however, some messages persist:

qemu-system-x86_64: warning: dbind: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-zGkyTiPzBJ: Connection refused
pulseaudio: Wrong context state
pulseaudio: Reason: Access denied
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver

Are they important?