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
48.03k stars 2.66k forks source link

No user inputs while running image in NAKED container. #765

Open imartemy1524 opened 6 months ago

imartemy1524 commented 6 months ago

The problem

I'm trying to run mac on my arch linux. First of all, I tried installing it from scratch, and everything worked fine, and I've got pretty well working system. Command, that I used:

sudo docker run --device /dev/kvm \
             --privileged \
             -p 50922:10022 \
             -e XDG_RUNTIME_DIR=/tmp \
             -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
             -e QT_QPA_PLATFORM=wayland \
             -e GDK_BACKEND=wayland \
             -e CLUTTER_BACKEND=wayland \
             -e DISPLAY=:0 \
             -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
             -v /tmp/.X11-unix:/tmp/.X11-unix \
              sickcodes/docker-osx

(I'm using docker with sudo, because without sudo it uses docker-desktop runtime, which isn't working.

Then I moved mac_hdd_ng.img from /var/lib/docker/overlay2/blablabla/diff/home/arch/OSX-KVM to my work /shared/Images folder, and tried running naked images from there, using next command:

sudo docker run --device /dev/kvm \
             --privileged \
             -p 50922:10022 \
             -e XDG_RUNTIME_DIR=/tmp \
             -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
             -e QT_QPA_PLATFORM=wayland \
             -e GDK_BACKEND=wayland \
             -e RAM=8 \
             -e CLUTTER_BACKEND=wayland \
             -e DISPLAY=:0 \
             -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
             -v "/shared/Images/mac_hdd_ng.img:/image" \
             -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e GENERATE_UNIQUE=true \
    -e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist \
              sickcodes/docker-osx:naked

I also tried running it without GENERATE_UNIQUE, MASTER_PLIST_URL, -e RAM=8, on X11 (without wayland backends) but it all gave me next result: the cursor in login screen is flashing, but neither mouse (touchpad) nor keyboard are working (I also tried connecting USB keyboard/mouse, but got the same result).

Then I tried using your official image mac_hdd_ng_auto.img from https://images2.sick.codes/mac_hdd_ng_auto.img, but it gave me the same result: the system starts, some dialogs shows, but I'm not able to control it anyhow (neither on SSH).

Sometimes (with your official image) the system reboots with next error message:

(qemu) qemu: Slirp: Failed to send packet, ret: -1
qemu: Slirp: Failed to send packet, ret: -1

image Screenshot

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 IMArch 6.8.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:28 +0000 x86_64 GNU/Linux
:1
1
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            32G  192M   32G   1% /tmp
QEMU emulator version 8.2.2
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers
libvirtd (libvirt) 10.2.0
               total        used        free      shared  buff/cache   available
Mem:            62Gi        10Gi        34Gi       4,9Gi        22Gi        52Gi
Swap:           31Gi        19Mi        31Gi
12
egrep: warning: egrep is obsolescent; using grep -E
24
crw-rw-rw- 1 root kvm 10, 232 мая  3 15:08 /dev/kvm
total 0
drwxrwxrwt  2 root root  80 мая  3 14:18 .
drwxrwxrwt 21 root root 500 мая  3 14:25 ..
srwxrwxrwx  1 root root   0 мая  3 14:18 X0
srwxr-xr-x  1 im   im     0 мая  3 14:18 X1
root         822  0.0  0.1 8548568 110544 ?      Ssl  14:18   0:02 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
im         13249  0.0  0.0   7632  4284 pts/3    S+   15:09   0:00 grep --color=auto dockerd
kvm:x:992:libvirt-qemu,qemu,im,root
docker:x:963:im
libvirt:x:962:im,root
libvirt-qemu:x:960:

Seems similar to #666, but the solution there didn't worked.

sickcodes commented 6 months ago

Thanks for that, I updated the naked container with the new usb changes made here: https://github.com/sickcodes/Docker-OSX/commit/756a1c03b928989f7841f1276ce7bd70e8772834#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557L200