[Question] Automated ci/cd pipeline with no display? #68

Closed
opened 2025-12-28 23:22:58 +01:00 by adam · 15 comments
Owner

Originally created by @GrabbenD on GitHub (Sep 23, 2020).

Is there any way to build/perform a full installation of the container with no display to make it fully automated?

Thanks in advance for any help with this.

Originally created by @GrabbenD on GitHub (Sep 23, 2020). Is there any way to build/perform a full installation of the container with no display to make it fully automated? Thanks in advance for any help with this.
adam closed this issue 2025-12-28 23:22:58 +01:00
Author
Owner

@sickcodes commented on GitHub (Sep 23, 2020):

Yes, using the VNC version.

@jviotti knows how to setup the auto boot to correct disk, I'm not sure how.

You can write a an xdotool script to format the disk first too or can use hfsprogs to make the disks

@sickcodes commented on GitHub (Sep 23, 2020): Yes, using the VNC version. @jviotti knows how to setup the auto boot to correct disk, I'm not sure how. You can write a an xdotool script to format the disk first too or can use hfsprogs to make the disks
Author
Owner

@jviotti commented on GitHub (Sep 23, 2020):

@sickcodes @xRiot The trick is to create a custom OpenCore image (https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore.qcow2) that boots in the way you want it to boot. Docker-OSX loads this image here: https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile#L156-L157

&& tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \' \
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.2,drive=OpenCoreBoot \' \

You can tweak OpenCore's config.plist (https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/config.plist) and re-build it using this script: https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/opencore-image-ng.sh.

These are some of the settings you might be interested in: https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/config.plist#L520-L529

<key>PickerMode</key>
<string>External</string>
<key>PollAppleHotKeys</key>
<true/>
<key>ShowPicker</key>
<true/>
<key>TakeoffDelay</key>
<integer>0</integer>
<key>Timeout</key>
<integer>0</integer>

You can find the docs here: https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Configuration.pdf

@jviotti commented on GitHub (Sep 23, 2020): @sickcodes @xRiot The trick is to create a custom OpenCore image (https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore.qcow2) that boots in the way you want it to boot. Docker-OSX loads this image here: https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile#L156-L157 ``` && tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 \' \ && tee -a Launch.sh <<< '-device ide-hd,bus=sata.2,drive=OpenCoreBoot \' \ ``` You can tweak OpenCore's `config.plist` (https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/config.plist) and re-build it using this script: https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/opencore-image-ng.sh. These are some of the settings you might be interested in: https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/config.plist#L520-L529 ``` <key>PickerMode</key> <string>External</string> <key>PollAppleHotKeys</key> <true/> <key>ShowPicker</key> <true/> <key>TakeoffDelay</key> <integer>0</integer> <key>Timeout</key> <integer>0</integer> ``` You can find the docs here: https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Configuration.pdf
Author
Owner

@GrabbenD commented on GitHub (Sep 23, 2020):

Thanks a lot for the information @jviotti @sickcodes!

I can see that there's a display being exported in the VNC version. Would it be possible to entirely drop rendering of the desktop to save resources? I'm looking into only using SSH to access the container post installation.

@GrabbenD commented on GitHub (Sep 23, 2020): Thanks a lot for the information @jviotti @sickcodes! I can see that there's a display being exported in the VNC version. Would it be possible to entirely drop rendering of the desktop to save resources? I'm looking into only using SSH to access the container post installation.
Author
Owner

@sickcodes commented on GitHub (Sep 23, 2020):

Maybe try booting into the recovery disk, it has a terminal, I haven't tried automating it tho.

@sickcodes commented on GitHub (Sep 23, 2020): Maybe try booting into the recovery disk, it has a terminal, I haven't tried automating it tho.
Author
Owner

@sickcodes commented on GitHub (Sep 23, 2020):

@jviotti Thanks for uploading that mate! I will add that second auto-booter next week unless someone wants to do a PR 😛

@sickcodes commented on GitHub (Sep 23, 2020): @jviotti Thanks for uploading that mate! I will add that second auto-booter next week unless someone wants to do a PR 😛
Author
Owner

@GrabbenD commented on GitHub (Sep 24, 2020):

Thanks for the insights @sickcodes!

At the moment the VNC container boots into boot disk selection menu, is there a way to automatically boot into the (predefined/right) disk?

@GrabbenD commented on GitHub (Sep 24, 2020): Thanks for the insights @sickcodes! At the moment the VNC container boots into boot disk selection menu, is there a way to automatically boot into the (predefined/right) disk?
Author
Owner

@sickcodes commented on GitHub (Sep 24, 2020):

Yes there is, @jviotti just explained above that you need to build a custom OpenCore qcow boot disk.

@sickcodes commented on GitHub (Sep 24, 2020): Yes there is, @jviotti just explained above that you need to build a custom OpenCore qcow boot disk.
Author
Owner

@JB-CHAUVIN commented on GitHub (Oct 5, 2020):

Hello @sickcodes, have you released the auto-booter option yet?
Thanks @jviotti for the tips !!

@JB-CHAUVIN commented on GitHub (Oct 5, 2020): Hello @sickcodes, have you released the auto-booter option yet? Thanks @jviotti for the tips !!
Author
Owner

@sickcodes commented on GitHub (Oct 5, 2020):

I think this is it:

https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore-nopicker.qcow2

Will have a look later this week

@sickcodes commented on GitHub (Oct 5, 2020): I think this is it: https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore-nopicker.qcow2 Will have a look later this week
Author
Owner

@JB-CHAUVIN commented on GitHub (Oct 6, 2020):

I think this is it:

https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore-nopicker.qcow2

Will have a look later this week

This is working ! It would be great if you add an option to choose the OpenCore version :)

Thanks for the great work with this tool @sickcodes !

@JB-CHAUVIN commented on GitHub (Oct 6, 2020): > I think this is it: > > https://github.com/kholia/OSX-KVM/blob/master/OpenCore-Catalina/OpenCore-nopicker.qcow2 > > Will have a look later this week This is working ! It would be great if you add an option to choose the OpenCore version :) Thanks for the great work with this tool @sickcodes !
Author
Owner

@sickcodes commented on GitHub (Oct 6, 2020):

Sure, unless someone would like to submit a PR:

docker exec id sed -i -e opencore.qcow to the new version

@sickcodes commented on GitHub (Oct 6, 2020): Sure, unless someone would like to submit a PR: `docker exec id sed -i -e opencore.qcow` to the new version
Author
Owner

@sickcodes commented on GitHub (Oct 6, 2020):

Done! 81682df5fe

@sickcodes commented on GitHub (Oct 6, 2020): Done! https://github.com/sickcodes/Docker-OSX/commit/81682df5febf936cbadd889b8ec46c73b8d1466e
Author
Owner

@sickcodes commented on GitHub (Oct 6, 2020):

Will work in both VNC and regular containers btw

@sickcodes commented on GitHub (Oct 6, 2020): Will work in both VNC and regular containers btw
Author
Owner

@AdamMomen commented on GitHub (Nov 6, 2020):

Thanks for your amazing efforts @sickcodes, I am running this on a VM on the cloud and wanted to make it boot autmatically, so I tried these two commands but did not work yet!

docker exec 260b77373875 mv ./Launch-nopicker.sh ./Launch.sh

# This one didn't work as well
docker exec 260b77373875 bash -c "grep -v InstallMedia ./Launch.sh > ./Launch-nopicker.sh
chmod +x ./Launch-nopicker.sh
sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch-nopicker.sh
"

Launch.sh file Content

sudo chown    $(id -u):$(id -g) /dev/kvm 2>/dev/null || true 
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true 
exec qemu-system-x86_64 -m ${RAM:-8}000 \
-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \
-machine q35,accel=kvm:tcg \
-smp ${SMP:-4},cores=${CORES:-4} \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \
-drive if=pflash,format=raw,readonly,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 ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \
-device ich9-ahci,id=sata \
#============>This seems okay! <===========
-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::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 \
-monitor stdio \
-vga vmware \

I am not sure putting container run logs would help here.

@jviotti could you please elaborate more on how to do your approach, I couldn't understand the "create a custom OpenCore image" part.
Thanks

2020-11-06-09-38-29 (1)

Edit
Running process monitor htop shows that docker or maybe arch-linux didn't update the image yet, I am still trying to figure out how to update it.
image

Edit 2
I found the issue, I am using vnc-version docker which uses Launch_custom.sh file instead of Launch.sh

Solution:

docker exec 260b77373875 bash -c "grep -v InstallMedia ./Launch-nopicker.sh > ./Launch_custom.sh
chmod +x ./Launch_custom.sh
sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch_custom.sh
"

@sickcodes maybe adding this to the readme so others won't fall into the same mistake I did, thanks.

@AdamMomen commented on GitHub (Nov 6, 2020): Thanks for your amazing efforts @sickcodes, I am running this on a VM on the cloud and wanted to make it boot autmatically, so I tried these two commands but did not work yet! ```bash docker exec 260b77373875 mv ./Launch-nopicker.sh ./Launch.sh # This one didn't work as well docker exec 260b77373875 bash -c "grep -v InstallMedia ./Launch.sh > ./Launch-nopicker.sh chmod +x ./Launch-nopicker.sh sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch-nopicker.sh " ``` #### Launch.sh file Content ```bash sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true exec qemu-system-x86_64 -m ${RAM:-8}000 \ -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \ -machine q35,accel=kvm:tcg \ -smp ${SMP:-4},cores=${CORES:-4} \ -usb -device usb-kbd -device usb-tablet \ -device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \ -drive if=pflash,format=raw,readonly,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 ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \ -device ich9-ahci,id=sata \ #============>This seems okay! <=========== -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::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 \ -monitor stdio \ -vga vmware \ ``` I am not sure putting container run logs would help here. @jviotti could you please elaborate more on how to do your approach, I couldn't understand the "create a custom OpenCore image" part. Thanks ![2020-11-06-09-38-29 (1)](https://user-images.githubusercontent.com/55929982/98345811-75f00b80-2015-11eb-8574-4ca5d499c569.gif) **Edit** Running process monitor `htop` shows that docker or maybe arch-linux didn't update the image yet, I am still trying to figure out how to update it. ![image](https://user-images.githubusercontent.com/55929982/98357198-26194080-2025-11eb-81bb-28259a1f63ab.png) **Edit 2** I found the issue, I am using vnc-version docker which uses `Launch_custom.sh file` instead of `Launch.sh` #### **Solution**: ```bash docker exec 260b77373875 bash -c "grep -v InstallMedia ./Launch-nopicker.sh > ./Launch_custom.sh chmod +x ./Launch_custom.sh sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch_custom.sh " ``` @sickcodes maybe adding this to the readme so others won't fall into the same mistake I did, thanks.
Author
Owner

@sickcodes commented on GitHub (Feb 26, 2021):

Added in a09c565e36

See https://github.com/sickcodes/Docker-OSX#quick-start-175gb-pre-made-image

@sickcodes commented on GitHub (Feb 26, 2021): Added in https://github.com/sickcodes/Docker-OSX/commit/a09c565e36d45f6663567b7c4f1402279e725519 See https://github.com/sickcodes/Docker-OSX#quick-start-175gb-pre-made-image
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#68