Compare commits

...

23 commits

Author SHA1 Message Date
Kroese
9546b11150
docs: Add input types (#245) 2025-04-23 12:56:20 +02:00
Kroese
ffc4bb39c2
docs: Add quotes around $PWD (#244) 2025-04-16 12:05:26 +02:00
Kroese
41da658176
build: Workflow file (#243) 2025-04-14 20:34:51 +02:00
Kroese
caa7bc311d
feat: Detect Docker Desktop (#242) 2025-04-08 07:59:16 +02:00
Kroese
72738ce2a3
build: Add e2fsprogs package (#241) 2025-04-06 00:39:53 +02:00
Kroese
d5cb0b8c71
fix: Remove obsolete packages (#240) 2025-04-06 00:28:51 +02:00
Kroese
038c4c6e14
fix: Refactor USB (#239) 2025-04-06 00:14:39 +02:00
Kroese
f89cb831c4
build: Use debian download mirror (#238) 2025-04-04 22:28:20 +02:00
Kroese
a100af1fc5
build: Pin qemu-efi-aarch64 (#237) 2025-04-04 21:41:45 +02:00
Kroese
56cb411a23
build: Remove ovmf (#236) 2025-04-04 21:17:26 +02:00
Kroese
7622677489
fix: Downgrade ovmf to 2024.11 (#235) 2025-04-04 01:14:23 +02:00
Kroese
18dee3c07d
docs: Disk pass-through (#234) 2025-04-03 10:27:02 +02:00
Kroese
105db123af
feat: Default to alpine (#233) 2025-04-03 01:32:34 +02:00
Kroese
846c232bd0
fix: Check if serial is readable (#232) 2025-03-28 20:14:19 +01:00
Kroese
0e5cca6a1e
docs: Github Codespaces (#231) 2025-03-27 01:46:34 +01:00
Kroese
cd018a0cca
feat: Validate BIOS serial (#230) 2025-03-27 01:08:17 +01:00
Kroese
be36019608
build: Add dmidecode (#229) 2025-03-27 00:26:27 +01:00
Kroese
8f70833e1f
fix: Increase number of USB ports (#228) 2025-03-26 19:29:04 +01:00
Kroese
29adf083b7
docs: Github Codespaces (#227) 2025-03-25 14:43:33 +01:00
Kroese
95848f01a0
feat: Remove non-printable characters (#226) 2025-03-24 13:57:49 +01:00
Kroese
469875fed4
docs: KVM information (#225) 2025-03-20 23:21:50 +01:00
Kroese
5659b0245d
docs: Compatiblity chart (#224) 2025-03-20 23:04:36 +01:00
Kroese
4177dcd59b
docs: Add Podman (#223) 2025-03-20 20:07:28 +01:00
8 changed files with 73 additions and 45 deletions

View file

@ -21,6 +21,7 @@ body:
attributes: attributes:
label: Docker compose label: Docker compose
description: The compose file (or otherwise the `docker run` command used). description: The compose file (or otherwise the `docker run` command used).
render: yaml
validations: validations:
required: true required: true
- type: textarea - type: textarea
@ -28,6 +29,7 @@ body:
attributes: attributes:
label: Docker log label: Docker log
description: The logfile of the container (as shown by `docker logs qemu`). description: The logfile of the container (as shown by `docker logs qemu`).
render: shell
validations: validations:
required: true required: true
- type: textarea - type: textarea

View file

@ -23,6 +23,7 @@ body:
attributes: attributes:
label: Docker compose label: Docker compose
description: The compose file (or otherwise the `docker run` command used). description: The compose file (or otherwise the `docker run` command used).
render: yaml
validations: validations:
required: true required: true
- type: textarea - type: textarea
@ -30,6 +31,7 @@ body:
attributes: attributes:
label: Docker log label: Docker log
description: The logfile of the container (as shown by `docker logs qemu`). description: The logfile of the container (as shown by `docker logs qemu`).
render: shell
validations: validations:
required: true required: true
- type: textarea - type: textarea

View file

@ -46,8 +46,8 @@ jobs:
with: with:
context: git context: git
images: | images: |
${{ secrets.DOCKERHUB_REPO }}
ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}
${{ secrets.DOCKERHUB_REPO }}
tags: | tags: |
type=raw,value=latest,priority=100 type=raw,value=latest,priority=100
type=raw,value=${{ vars.MAJOR }}.${{ vars.MINOR }} type=raw,value=${{ vars.MAJOR }}.${{ vars.MINOR }}

View file

@ -19,6 +19,7 @@ RUN set -eu && \
wget \ wget \
7zip \ 7zip \
curl \ curl \
fdisk \
nginx \ nginx \
procps \ procps \
seabios \ seabios \
@ -33,12 +34,12 @@ RUN set -eu && \
iputils-ping \ iputils-ping \
genisoimage \ genisoimage \
ca-certificates \ ca-certificates \
netcat-openbsd \ qemu-system-arm && \
qemu-system-arm \
qemu-efi-aarch64 && \
apt-get clean && \ apt-get clean && \
mkdir -p /etc/qemu && \ mkdir -p /etc/qemu && \
echo "allow br0" > /etc/qemu/bridge.conf && \ echo "allow br0" > /etc/qemu/bridge.conf && \
wget "https://snapshot.debian.org/archive/debian/20250128T092032Z/pool/main/e/edk2/qemu-efi-aarch64_2024.11-5_all.deb" -O /tmp/aavmf.deb -q --timeout=10 && \
dpkg -i /tmp/aavmf.deb && \
mkdir -p /usr/share/novnc && \ mkdir -p /usr/share/novnc && \
wget "https://github.com/novnc/noVNC/archive/refs/tags/v${VERSION_VNC}.tar.gz" -O /tmp/novnc.tar.gz -q --timeout=10 && \ wget "https://github.com/novnc/noVNC/archive/refs/tags/v${VERSION_VNC}.tar.gz" -O /tmp/novnc.tar.gz -q --timeout=10 && \
tar -xf /tmp/novnc.tar.gz -C /tmp/ && \ tar -xf /tmp/novnc.tar.gz -C /tmp/ && \
@ -59,9 +60,9 @@ COPY --chmod=755 ./src /run/
VOLUME /storage VOLUME /storage
EXPOSE 22 5900 8006 EXPOSE 22 5900 8006
ENV BOOT="alpine"
ENV CPU_CORES="2" ENV CPU_CORES="2"
ENV RAM_SIZE="2G" ENV RAM_SIZE="2G"
ENV DISK_SIZE="16G" ENV DISK_SIZE="16G"
ENV BOOT="http://example.com/image.iso"
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"] ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]

View file

@ -49,7 +49,7 @@ services:
##### Via Docker CLI: ##### Via Docker CLI:
```bash ```bash
docker run -it --rm --name qemu -e "BOOT=alpine" -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v ${PWD:-.}/qemu:/storage --stop-timeout 120 qemux/qemu-arm docker run -it --rm --name qemu -e "BOOT=alpine" -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/qemu:/storage" --stop-timeout 120 qemux/qemu-arm
``` ```
##### Via Kubernetes: ##### Via Kubernetes:
@ -60,16 +60,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu-arm/refs/heads/mas
##### Via Github Codespaces: ##### Via Github Codespaces:
[`Click here to launch this container in the cloud!`](https://github.com/codespaces/new?skip_quickstart=true&machine=basicLinux32gb&repo=626637620&ref=master&devcontainer_path=.devcontainer.json) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/qemus/qemu)
## Compatibility ⚙️
| **Product** | **Platform** | |
|---|---|---|
| Docker Engine | Linux | ✅ |
| Docker Desktop | Linux | ❌ |
| Docker Desktop | macOS | ❌ |
| Github Codespaces | cloud | ✅ |
## FAQ 💬 ## FAQ 💬
@ -206,9 +197,16 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu-arm/refs/heads/mas
### How do I verify if my system supports KVM? ### How do I verify if my system supports KVM?
Only Linux and Windows 11 support KVM virtualization, macOS and Windows 10 do not unfortunately. First check if your software is compatible using this chart:
You can run the following commands in Linux to check your system: | **Product** | **Linux** | **Win11** | **Win10** | **macOS** |
|---|---|---|---|---|
| Docker CLI | ✅ | ✅ | ❌ | ❌ |
| Docker Desktop | ❌ | ✅ | ❌ | ❌ |
| Podman CLI | ✅ | ✅ | ❌ | ❌ |
| Podman Desktop | ✅ | ✅ | ❌ | ❌ |
After that you can run the following commands in Linux to check your system:
```bash ```bash
sudo apt install cpu-checker sudo apt install cpu-checker
@ -223,11 +221,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu-arm/refs/heads/mas
- you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's. - you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.
If you do not receive any error from `kvm-ok` but the container still complains about KVM, please check whether: If you did not receive any error from `kvm-ok` but the container still complains about a missing KVM device, it could help to add `privileged: true` to your compose file (or `sudo` to your `docker` command) to rule out any permission issue.
- you are not using "Docker Desktop for Linux" as it does not support KVM, instead make use of Docker Engine directly.
- it could help to add `privileged: true` to your compose file (or `sudo` to your `docker run` command), to rule out any permission issue.
### How do I expose network ports? ### How do I expose network ports?
@ -307,12 +301,12 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu-arm/refs/heads/mas
### How do I pass-through a disk? ### How do I pass-through a disk?
It is possible to pass-through disk devices directly by adding them to your compose file in this way: It is possible to pass-through disk devices or partitions directly by adding them to your compose file in this way:
```yaml ```yaml
devices: devices:
- /dev/sdb:/disk1 - /dev/sdb:/disk1
- /dev/sdc:/disk2 - /dev/sdc1:/disk2
``` ```
Use `/disk1` if you want it to become your main drive, and use `/disk2` and higher to add them as secondary drives. Use `/disk1` if you want it to become your main drive, and use `/disk2` and higher to add them as secondary drives.

View file

@ -75,26 +75,42 @@ esac
MSRS="/sys/module/kvm/parameters/ignore_msrs" MSRS="/sys/module/kvm/parameters/ignore_msrs"
if [ -e "$MSRS" ]; then if [ -e "$MSRS" ]; then
result=$(<"$MSRS") result=$(<"$MSRS")
result="${result//[![:print:]]/}"
if [[ "$result" == "0" ]] || [[ "${result^^}" == "N" ]]; then if [[ "$result" == "0" ]] || [[ "${result^^}" == "N" ]]; then
echo 1 | tee "$MSRS" > /dev/null 2>&1 || true echo 1 | tee "$MSRS" > /dev/null 2>&1 || true
fi fi
fi fi
CLOCKSOURCE="tsc" CLOCKSOURCE="tsc"
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter" [[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource" CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
if [ ! -f "$CLOCK" ]; then if [ ! -f "$CLOCK" ]; then
warn "file \"$CLOCK\" cannot not found?" warn "file \"$CLOCK\" cannot not found?"
else else
result=$(<"$CLOCK") result=$(<"$CLOCK")
result="${result//[![:print:]]/}"
case "${result,,}" in case "${result,,}" in
"${CLOCKSOURCE,,}" ) ;; "${CLOCKSOURCE,,}" ) ;;
"kvm-clock" ) info "Nested KVM virtualization detected.." ;; "kvm-clock" ) info "Nested KVM virtualization detected.." ;;
"hyperv_clocksource_tsc_page" ) info "Nested Hyper-V virtualization detected.." ;; "hyperv_clocksource_tsc_page" ) info "Nested Hyper-V virtualization detected.." ;;
"hpet" ) warn "unsupported clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;; "hpet" ) warn "unsupported clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'." ;;
*) warn "unexpected clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;; *) warn "unexpected clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'." ;;
esac esac
fi fi
SM_BIOS=""
PS="/sys/class/dmi/id/product_serial"
if [ -s "$PS" ] && [ -r "$PS" ]; then
BIOS_SERIAL=$(<"$PS")
BIOS_SERIAL="${BIOS_SERIAL//[![:alnum:]]/}"
if [ -n "$BIOS_SERIAL" ]; then
SM_BIOS="-smbios type=1,serial=$BIOS_SERIAL"
fi
fi
return 0 return 0

View file

@ -3,7 +3,7 @@ set -Eeuo pipefail
: "${UUID:=""}" : "${UUID:=""}"
: "${SERIAL:="mon:stdio"}" : "${SERIAL:="mon:stdio"}"
: "${USB:="qemu-xhci,id=xhci"}" : "${USB:="qemu-xhci,id=xhci,p2=7,p3=7"}"
: "${MONITOR:="telnet:localhost:7100,server,nowait,nodelay"}" : "${MONITOR:="telnet:localhost:7100,server,nowait,nodelay"}"
: "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}" : "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}"
@ -12,20 +12,25 @@ SERIAL_OPTS="-serial $SERIAL"
CPU_OPTS="-cpu $CPU_FLAGS -smp $SMP" CPU_OPTS="-cpu $CPU_FLAGS -smp $SMP"
RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
MON_OPTS="-monitor $MONITOR -name $PROCESS,process=$PROCESS,debug-threads=on" MON_OPTS="-monitor $MONITOR -name $PROCESS,process=$PROCESS,debug-threads=on"
[ -n "$USB" ] && [[ "${USB,,}" != "no"* ]] && USB_OPTS="-device $USB -device usb-kbd -device usb-tablet"
MAC_OPTS="-machine type=${MACHINE},secure=${SECURE},dump-guest-core=off${KVM_OPTS}" MAC_OPTS="-machine type=${MACHINE},secure=${SECURE},dump-guest-core=off${KVM_OPTS}"
[ -n "$UUID" ] && MAC_OPTS="$MAC_OPTS -uuid $UUID"
[ -n "$UUID" ] && MAC_OPTS+=" -uuid $UUID"
[ -n "$SM_BIOS" ] && MAC_OPTS+=" $SM_BIOS"
DEV_OPTS="-object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS="-object rng-random,id=objrng0,filename=/dev/urandom"
DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0" DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0"
if [[ "${BOOT_MODE,,}" != "windows"* ]]; then if [[ "${BOOT_MODE,,}" != "windows"* ]]; then
DEV_OPTS+=" -device virtio-balloon-pci,id=balloon0,bus=pcie.0" DEV_OPTS+=" -device virtio-balloon-pci,id=balloon0,bus=pcie.0"
if [ -d "/shared" ]; then fi
if [ -d "/shared" ] && [[ "${BOOT_MODE,,}" != "windows"* ]]; then
DEV_OPTS+=" -fsdev local,id=fsdev0,path=/shared,security_model=none" DEV_OPTS+=" -fsdev local,id=fsdev0,path=/shared,security_model=none"
DEV_OPTS+=" -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=shared" DEV_OPTS+=" -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=shared"
fi
fi fi
[ -n "$USB" ] && [[ "${USB,,}" != "no"* ]] && USB_OPTS="-device $USB -device usb-kbd -device usb-tablet"
ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS ${USB_OPTS:-} $NET_OPTS $DISK_OPTS $BOOT_OPTS $DEV_OPTS $ARGUMENTS" ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS ${USB_OPTS:-} $NET_OPTS $DISK_OPTS $BOOT_OPTS $DEV_OPTS $ARGUMENTS"
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')

View file

@ -34,10 +34,10 @@ if [[ "$KVM" != [Nn]* ]]; then
KVM_ERR="" KVM_ERR=""
if [ ! -e /dev/kvm ]; then if [ ! -e /dev/kvm ]; then
KVM_ERR="(device file missing)" KVM_ERR="(/dev/kvm is missing)"
else else
if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then
KVM_ERR="(no write access)" KVM_ERR="(/dev/kvm is unwriteable)"
fi fi
fi fi
@ -46,8 +46,16 @@ if [[ "$KVM" != [Nn]* ]]; then
if [[ "$OSTYPE" =~ ^darwin ]]; then if [[ "$OSTYPE" =~ ^darwin ]]; then
warn "you are using macOS which has no KVM support, this will cause a major loss of performance." warn "you are using macOS which has no KVM support, this will cause a major loss of performance."
else else
error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance." kernel=$(uname -a)
error "See the FAQ on how to diagnose the cause, or continue without KVM by setting KVM=N (not recommended)." case "${kernel,,}" in
*"microsoft"* )
error "Please bind '/dev/kvm' as a volume in the optional container settings when using Docker Desktop." ;;
*"synology"* )
error "Please make sure that Synology VMM (Virtual Machine Manager) is installed and that '/dev/kvm' is binded to this container." ;;
*)
error "KVM acceleration is not available $KVM_ERR, this will cause a major loss of performance."
error "See the FAQ for possible causes, or continue without it by adding KVM: \"N\" (not recommended)." ;;
esac
[[ "$DEBUG" != [Yy1]* ]] && exit 88 [[ "$DEBUG" != [Yy1]* ]] && exit 88
fi fi
fi fi