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

Preinstalled Catalina not working #347

Open giaur500 opened 2 years ago

giaur500 commented 2 years ago

Downloaded everything, then started co copy disk between layers. When finished, it only floods with messages like this:

Repeating until able to copy SSH key into OSX... /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub" ssh: connect to host 127.0.0.1 port 10022: Connection refused

So, I stopped container and started it again. It again starts to copy disk between layers, eating even more disk space. Not able to run, no more disk space available.

sickcodes commented 2 years ago

Option 1:

yes | docker system prune -a

yes | docker image prune -a

Or delete ALL old Docker images.

You can delete ALL docker related containers by

sudo killall dockerd
sudo rm -rf /var/lib/docker/*`
giaur500 commented 2 years ago

I know how to clear data. However, that container actually does not work. I did not try to build container yet.

sickcodes commented 2 years ago

The auto container is 20GB + 20GB working image, plus every time you run auto without --rm it will use another 20G

marcotuna commented 2 years ago

I am having the same issue.

Here's a full log:

By using this Dockerfile, you hereby agree that you are a security reseacher or developer and agree to use this Dockerfile to make the world a safer place. Examples include: making your apps safer, finding your mobile phone, compiling security products, etc. You understand that Docker-OSX is an Open Source project, which is released to the public under the GNU Pulic License version 3 and above. You acknowledge that the Open Source project is absolutely unaffiliated with any third party, in any form whatsoever. Any trademarks or intelectual property which happen to be mentioned anywhere in or around the project are owned by their respective owners. By using this Dockerfile, you agree to agree to the EULA of each piece of upstream or downstream software. The following code is released for the sole purpose of security research, under the GNU Public License version 3. If you are concerned about the licensing, please note that this project is not AGPL. A copy of the license is available online: https://github.com/sickcodes/Docker-OSX/blob/master/LICENSE. In order to use the following Dockerfile you must read and understand the terms. Once you have read the terms, use the -e TERMS_OF_USE=i_agree or -e TERMS_OF_USE=i_disagree
Disk is being copied between layers... Please wait a minute...
  File: /home/arch/OSX-KVM/mac_hdd_ng.img
  Size: 19139461120 Blocks: 37381768   IO Block: 4096   regular file
Device: 34h/52d Inode: 25953698    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    arch)   Gid: ( 1000/    arch)
Access: 2021-10-27 08:57:37.558326956 +0000
Modify: 2021-10-27 08:57:37.558326956 +0000
Change: 2021-10-27 08:57:37.566326957 +0000
 Birth: 2021-10-27 08:36:02.849189195 +0000
Large image is being copied between layers, please wait a minute...
Booting Docker-OSX in the background. Please wait...
nohup: appending output to 'nohup.out'
++ id -u
++ id -g
+ sudo chown 1000:1000 /dev/kvm
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
++ 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
ssh: connect to host 127.0.0.1 port 10022: Connection refused
+ 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-nopicker.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -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
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
qemu-system-x86_64: warning: dbind: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-uJSaLqgTZ8: Connection refused
qemu-system-x86_64: -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2: Could not open '/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2': No such file or directory
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused
Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
...

It seems that /home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 is missing.

I went inside the container and performed a find to see if there was some qcow2 files and there was a file named /home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2

It seems that the -nopicker is missing from the file name?

I managed to fix by doing the following:

Starting the container

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -n docker-osx \
    sickcodes/docker-osx:auto

Entering inside the container

docker exec -it docker-osx bash

Creating a link with the correct filename pointing to existing file

ln -s /home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 /home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2
sickcodes commented 2 years ago

The pre-installed nopicker was removed upstream and I haven't got around to fixing a libguestfs issue. It seems to change frequently which is why I think upstream uses the prebuilt bin images.

You can generate one -e GENERATE_UNIQUE=true