Compare commits

..
53 Commits
Author SHA1 Message Date
Kroese 9c6aeca709 feat: Multiple disk support
feat: Multiple disk support
2023-10-09 19:47:05 +02:00
Kroese 81b0bba667 Shellcheck SC2153 2023-10-09 19:46:26 +02:00
Kroese e2c00a2e44 docs: GPU passthrough support 2023-10-09 19:41:07 +02:00
Kroese 7bb33f26cd feat: GPU passthrough support 2023-10-09 19:34:49 +02:00
Kroese 63b2d703a4 build: Debian Bookworm 2023-10-09 19:30:57 +02:00
Kroese a97dfbfdf2 feat: GPU passthrough support 2023-10-09 18:48:47 +02:00
Kroese b255cb03e8 feat: GPU passthrough support 2023-10-09 18:45:39 +02:00
Kroese 7a79ff1d2d style: Indentations 2023-10-09 18:35:04 +02:00
Kroese 06fda133ed fix: Remove GPU drivers 2023-10-09 18:32:52 +02:00
Kroese acedd1cdcf feat: Multiple disk support 2023-10-09 18:30:13 +02:00
Kroese 96083fddb3 build: Update to QEMU v8.1.1 (Debian 13) 2023-10-09 18:28:56 +02:00
Kroese 5d7604a205 feat: Multiple disk support 2023-10-09 14:10:31 +02:00
Kroese 24d44924fe docs: GPU support
docs: GPU support
2023-10-09 11:20:32 +02:00
Kroese db840db76f docs: GPU support 2023-10-09 11:19:57 +02:00
Kroese 38148641c0 feat: Install GPU drivers
feat: Install GPU drivers
2023-10-09 03:33:37 +02:00
Kroese 5941eae237 style: Empty line 2023-10-09 03:27:45 +02:00
Kroese 5fa117c4d8 fix: Remove platform dependant packages 2023-10-09 03:23:54 +02:00
Kroese 28fc911f00 feat: Install GPU drivers 2023-10-09 03:21:06 +02:00
Kroese c8eb659c3c feat: Install GPU drivers 2023-10-09 03:14:41 +02:00
Kroese 16ce7c07cf fix: Install platform dependant packages 2023-10-09 02:50:59 +02:00
Kroese f745e5e09d build: Dockerfile 2023-10-09 02:42:20 +02:00
Kroese 16b823f69b fix: add GPU drivers only on amd64
fix: add GPU drivers only on amd64
2023-10-09 02:27:46 +02:00
Kroese d69cceba8d fix: add GPU drivers only on amd64 2023-10-09 02:24:52 +02:00
Kroese c2cd9f52f4 feat: GPU passthrough support
feat: GPU passthrough support
2023-10-09 02:03:05 +02:00
Kroese 0d2a222af0 docs: GPU passthrough support 2023-10-09 02:00:03 +02:00
Kroese 868c7d1661 feat: GPU passthrough support 2023-10-09 01:54:25 +02:00
Kroese b6ca62da34 feat: GPU passthrough support 2023-10-09 01:42:01 +02:00
Kroese da4555925b Merge pull request #330 from amintong/master
dnat rule add dst restrictions
2023-10-08 15:08:25 +02:00
tong min 8c6f7e49ef network in NAT mode, processing packets only with the destination (dst) set to the container IP can prevent packets coming out of the QEMU virtual machine through eth0 from being incorrectly DNAT 2023-10-08 19:48:00 +08:00
Kroese 06829aac67 refactor: Filesystem detection
refactor: Filesystem detection
2023-10-07 12:09:11 +02:00
Kroese e5b7ade0d0 refactor: Filesystem detection 2023-10-07 12:06:22 +02:00
Kroese c1de32eff6 feat: Check filesystem during installation
feat: Check filesystem during installation
2023-10-05 16:53:56 +02:00
Kroese c2dc0cd3b6 feat: Check filesystem during installation 2023-10-05 16:49:00 +02:00
Kroese e2a4ab7515 feat: Check filesystem during installation 2023-10-05 16:45:12 +02:00
Kroese d94a9d0966 fix: Extract files inside container
fix: Extract files inside container
2023-10-05 15:55:49 +02:00
Kroese 6d9c281add build: Use DockerHub mirror 2023-10-05 15:51:42 +02:00
Kroese da51c1df1f fix: Extract files inside container 2023-10-05 15:47:17 +02:00
Kroese 97918abdb0 build: Remove btrfs-progs 2023-10-05 15:35:24 +02:00
Kroese 6a8093a3f4 fix: Do not format image as btrfs 2023-10-05 15:31:42 +02:00
Kroese 0bd0806ceb Merge pull request #321 from kroese/renovate/docker-setup-buildx-action-3.x
chore(deps): update docker/setup-buildx-action action to v3
2023-09-12 10:41:06 +02:00
Kroese 386c2ccc45 Merge pull request #320 from kroese/renovate/docker-login-action-3.x
chore(deps): update docker/login-action action to v3
2023-09-12 10:40:51 +02:00
renovate[bot] ff6a3b8776 chore(deps): update docker/setup-buildx-action action to v3 2023-09-12 08:10:13 +00:00
renovate[bot] f290fb7031 chore(deps): update docker/login-action action to v3 2023-09-12 08:10:09 +00:00
Kroese b4e19ccc23 Update readme.md
Update readme.md
2023-09-05 03:45:48 +02:00
Kroese e3c514f8dc Update readme.md 2023-09-05 03:45:32 +02:00
Kroese 101b509f81 Merge pull request #316 from kroese/renovate/actions-checkout-4.x
chore(deps): update actions/checkout action to v4
2023-09-04 16:07:12 +02:00
renovate[bot] 6a5301b3f2 chore(deps): update actions/checkout action to v4 2023-09-04 14:04:19 +00:00
Kroese cad5e5d5c2 Readme
Readme
2023-07-27 01:41:09 +02:00
Kroese 024170d190 docs: Readme 2023-07-27 01:40:31 +02:00
Kroese 0ce14f6c2d fix: Disable pidwait
fix: Disable pidwait
2023-07-18 20:17:19 +02:00
Kroese 272e491281 fix: Disable pidwait 2023-07-18 20:16:47 +02:00
Kroese 0518e1100b Add ARGUMENTS variable
Add ARGUMENTS variable
2023-07-18 19:47:56 +02:00
Kroese 8aa797b557 feat: Add ARGUMENTS variable 2023-07-18 19:44:09 +02:00
11 changed files with 146 additions and 72 deletions

No files matched your search

+4 -5
View File
@@ -12,7 +12,6 @@ on:
- '.dockerignore'
- '.github/**'
- '.github/workflows/**'
- 'Dockerfile'
jobs:
shellcheck:
@@ -28,10 +27,10 @@ jobs:
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
-
@@ -54,13 +53,13 @@ jobs:
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
-
name: Login into Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
+2 -2
View File
@@ -7,8 +7,8 @@ jobs:
name: shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
+20 -20
View File
@@ -1,4 +1,4 @@
FROM ghcr.io/qemu-tools/qemu-host as builder
FROM qemux/qemu-host as builder
# FROM golang as builder
# WORKDIR /
@@ -14,25 +14,25 @@ ARG DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y upgrade && \
apt-get --no-install-recommends -y install \
curl \
cpio \
wget \
fdisk \
unzip \
socat \
procps \
dnsmasq \
xz-utils \
iptables \
iproute2 \
net-tools \
btrfs-progs \
netcat-openbsd \
ca-certificates \
qemu-system-x86 \
curl \
cpio \
tini \
wget \
fdisk \
unzip \
socat \
procps \
xz-utils \
iptables \
iproute2 \
dnsmasq \
net-tools \
ca-certificates \
netcat-openbsd \
qemu-system-x86 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY run/*.sh /run/
COPY agent/*.sh /agent/
@@ -44,7 +44,7 @@ VOLUME /storage
EXPOSE 22
EXPOSE 80
EXPOSE 139
EXPOSE 139
EXPOSE 445
EXPOSE 5000
@@ -65,4 +65,4 @@ LABEL org.opencontainers.image.url=https://hub.docker.com/r/kroese/virtual-dsm/
HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh
ENTRYPOINT ["/run/run.sh"]
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/run.sh"]
+13 -2
View File
@@ -170,6 +170,17 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
With this method, you are able to switch between different versions while keeping your file data.
* ### How do I passthrough my GPU?
To enable this feature, add the following lines to your compose file:
```yaml
environment:
GPU: "Y"
devices:
- /dev/dri
```
* ### What are the differences compared to the standard DSM?
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
@@ -178,7 +189,7 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
Yes, this project contains only open-source code and does not distribute any copyrighted material. Neither does it try to circumvent any copyright protection measures. So under all applicable laws, this project would be considered legal.
However, by installing Synology's Virtual DSM, you must accept their end-user license agreement, which does not permit installation on non-Synology hardware. So only run this project on an official Synology NAS via the Container Manager package, as any other use will be a violation of their terms and conditions.
However, by installing Synology's Virtual DSM, you must accept their end-user license agreement, which does not permit installation on non-Synology hardware. So only run this project on an official Synology NAS, as any other use will be a violation of their terms and conditions.
## Disclaimer
@@ -191,4 +202,4 @@ Only run this container on Synology hardware, any other use is not permitted by
[Build]: https://github.com/kroese/virtual-dsm/actions/workflows/build.yml/badge.svg
[Size]: https://img.shields.io/docker/image-size/kroese/virtual-dsm/latest?color=066da5&label=size
[Pulls]: https://img.shields.io/docker/pulls/kroese/virtual-dsm.svg?style=flat&label=pulls&logo=docker
[Version]: https://img.shields.io/docker/v/kroese/virtual-dsm?arch=amd64&sort=date&color=066da5
[Version]: https://img.shields.io/docker/v/kroese/virtual-dsm/latest?arch=amd64&sort=semver&color=066da5
+25 -1
View File
@@ -125,7 +125,7 @@ if [ ! -f "${DATA}" ]; then
fi
# Format as BTRFS filesystem
mkfs.btrfs -q -L data -d single -m dup "${DATA}" > /dev/null
# mkfs.btrfs -q -L data -d single -m dup "${DATA}" > /dev/null
fi
@@ -153,3 +153,27 @@ DISK_OPTS="\
-device virtio-scsi-pci,id=hw-userdata,bus=pcie.0,addr=0xc \
-drive file=${DATA},if=none,id=drive-userdata,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,rotation_rate=${DISK_ROTATION},bootindex=3"
STORAGE2="/storage2"
DATA2="${STORAGE2}/data.img"
if [ -f "${DATA2}" ]; then
DISK_OPTS="${DISK_OPTS} \
-device virtio-scsi-pci,id=hw-userdata2,bus=pcie.0,addr=0xd \
-drive file=${DATA2},if=none,id=drive-userdata2,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata2.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata2,id=userdata2,rotation_rate=${DISK_ROTATION},bootindex=4"
fi
STORAGE3="/storage3"
DATA3="${STORAGE3}/data.img"
if [ -f "${DATA3}" ]; then
DISK_OPTS="${DISK_OPTS} \
-device virtio-scsi-pci,id=hw-userdata3,bus=pcie.0,addr=0xe \
-drive file=${DATA3},if=none,id=drive-userdata3,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata3.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata3,id=userdata3,rotation_rate=${DISK_ROTATION},bootindex=5"
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
set -Eeuo pipefail
[ ! -d /dev/dri ] && mkdir -m 755 /dev/dri
if [ ! -c /dev/dri/card0 ]; then
mknod /dev/dri/card0 c 226 0
fi
if [ ! -c /dev/dri/renderD128 ]; then
mknod /dev/dri/renderD128 c 226 128
fi
chmod 666 /dev/dri/card0
chmod 666 /dev/dri/renderD128
DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128"
DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"
if ! apt-mark showinstall | grep -q "xserver-xorg-video-intel"; then
info "Installing GPU drivers..."
export DEBCONF_NOWARNINGS="yes"
export DEBIAN_FRONTEND="noninteractive"
apt-get -qq update
apt-get -qq --no-install-recommends -y install xserver-xorg-video-intel > /dev/null
fi
+29 -18
View File
@@ -31,13 +31,20 @@ rm -f "$STORAGE"/"$BASE".agent
rm -f "$STORAGE"/"$BASE".boot.img
rm -f "$STORAGE"/"$BASE".system.img
TMP="$STORAGE/tmp"
RDC="$STORAGE/dsm.rd"
TMP="/tmp/dsm"
FS=$(stat -f -c %T "$STORAGE")
[[ "$FS" == "ext"* ]] && TMP="$STORAGE/tmp"
rm -rf "$TMP" && mkdir -p "$TMP"
# Check free diskspace
MIN_SPACE=5842450944
SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1)
(( MIN_SPACE > SPACE )) && error "Not enough free space for installation." && exit 95
[[ "${DEBUG}" == [Yy1]* ]] && set -x
RDC="$STORAGE/dsm.rd"
if [ ! -f "${RDC}" ]; then
info "Install: Downloading installer..."
@@ -95,7 +102,7 @@ if [ -f "${RDC}" ]; then
cp "$TMP/usr/lib/libc.so.6" /lib64/
cp "$TMP/usr/lib/libpthread.so.0" /lib64/
cp "$TMP/usr/lib/ld-linux-x86-64.so.2" /lib64/
fi
fi
mv /run/extract/scemd /run/extract/syno_extract_system_patch
chmod +x /run/extract/syno_extract_system_patch
@@ -120,28 +127,27 @@ if ((SIZE<250000000)); then
error "The specified PAT file is probably an update pack as it's too small." && exit 62
fi
info "Install: Extracting downloaded image..."
if { tar tf "$PAT"; } >/dev/null 2>&1; then
info "Install: Extracting downloaded image..."
tar xpf "$PAT" -C "$TMP/."
else
if [ "$ARCH" != "amd64" ]; then
info "Install: Installing QEMU..."
export DEBCONF_NOWARNINGS="yes"
export DEBIAN_FRONTEND="noninteractive"
apt-get -qq update
apt-get -qq -y upgrade
apt-get -qq --no-install-recommends -y install qemu-user > /dev/null
export DEBIAN_FRONTEND=""
export DEBCONF_NOWARNINGS=""
fi
info "Install: Extracting downloaded image..."
export LD_LIBRARY_PATH="/run/extract"
if [ "$ARCH" == "amd64" ]; then
@@ -198,14 +204,14 @@ SIZE=$(stat -c%s "${SYSTEM}")
PART="$TMP/partition.fdisk"
{ echo "label: dos"
echo "label-id: 0x6f9ee2e9"
echo "device: ${SYSTEM}"
echo "unit: sectors"
echo "sector-size: 512"
echo ""
echo "${SYSTEM}1 : start= 2048, size= 4980480, type=83"
echo "${SYSTEM}2 : start= 4982528, size= 4194304, type=82"
{ echo "label: dos"
echo "label-id: 0x6f9ee2e9"
echo "device: ${SYSTEM}"
echo "unit: sectors"
echo "sector-size: 512"
echo ""
echo "${SYSTEM}1 : start= 2048, size= 4980480, type=83"
echo "${SYSTEM}2 : start= 4982528, size= 4194304, type=82"
} > "$PART"
sfdisk -q "$SYSTEM" < "$PART"
@@ -250,6 +256,11 @@ mke2fs -q -t ext4 -b 4096 -d "$MOUNT/" -L "$LABEL" -F -E "offset=$OFFSET" "$SYST
rm -rf "$MOUNT"
echo "$BASE" > "$STORAGE"/dsm.ver
# Check free diskspace
SPACE=$(df --output=avail -B 1 "$STORAGE" | tail -n 1)
(( MIN_SPACE > SPACE )) && error "Not enough free space in storage folder." && exit 94
mv -f "$PAT" "$STORAGE"/"$BASE".pat
mv -f "$BOOT" "$STORAGE"/"$BASE".boot.img
mv -f "$SYSTEM" "$STORAGE"/"$BASE".system.img
+4 -2
View File
@@ -147,9 +147,11 @@ configureNAT () {
ip link set dev "${VM_NET_TAP}" master dockerbridge
# Add internet connection to the VM
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
iptables -t nat -A POSTROUTING -o "${VM_NET_DEV}" -j MASQUERADE
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p tcp -j DNAT --to $VM_NET_IP
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -p udp -j DNAT --to $VM_NET_IP
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -d "${IP}" -p tcp -j DNAT --to $VM_NET_IP
iptables -t nat -A PREROUTING -i "${VM_NET_DEV}" -d "${IP}" -p udp -j DNAT --to $VM_NET_IP
if (( KERNEL > 4 )); then
# Hack for guest VMs complaining about "bad udp checksums in 5 packets"
+13 -16
View File
@@ -4,8 +4,10 @@ set -Eeuo pipefail
# Docker environment variables
: ${URL:=''} # URL of the PAT file
: ${DEBUG:='N'} # Enable debug mode
: ${GPU:='N'} # Enable GPU passthrough
: ${DEBUG:='N'} # Enable debugging mode
: ${ALLOCATE:='Y'} # Preallocate diskspace
: ${ARGUMENTS:=''} # Extra QEMU parameters
: ${CPU_CORES:='1'} # Amount of CPU cores
: ${DISK_SIZE:='16G'} # Initial data disk size
: ${RAM_SIZE:='512M'} # Maximum RAM amount
@@ -40,17 +42,10 @@ if [[ ! -f "$STORAGE/$BASE.boot.img" ]] || [[ ! -f "$STORAGE/$BASE.system.img" ]
. /run/install.sh
fi
# Initialize disks
. /run/disk.sh
# Initialize network
. /run/network.sh
# Initialize serialport
. /run/serial.sh
# Configure shutdown
. /run/power.sh
. /run/disk.sh # Initialize disks
. /run/network.sh # Initialize network
. /run/serial.sh # Initialize serialport
. /run/power.sh # Configure shutdown
KVM_ERR=""
KVM_OPTS=""
@@ -80,7 +75,9 @@ EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS}"
[[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]] && . /run/gpu.sh
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}"
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')
trap - ERR
@@ -93,8 +90,8 @@ set -m
)
set +m
if (( KERNEL > 5 )) || ( (( KERNEL == 5 )) && (( MINOR > 2 )) ); then
pidwait -F "${_QEMU_PID}" & wait $!
fi
#if (( KERNEL > 5 )) || ( (( KERNEL == 5 )) && (( MINOR > 2 )) ); then
# pidwait -F "${_QEMU_PID}" & wait $!
#else
tail --pid "$(cat "${_QEMU_PID}")" --follow /dev/null & wait $!
+5 -5
View File
@@ -52,8 +52,8 @@ fi
SERIAL_OPTS="\
-serial mon:stdio \
-device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3 \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \
-chardev socket,id=charchannel0,host=127.0.0.1,port=12345,reconnect=10 \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=vchannel"
-device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3 \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \
-chardev socket,id=charchannel0,host=127.0.0.1,port=12345,reconnect=10 \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=vchannel"