Compare commits

..

21 Commits

Author SHA1 Message Date
databreach
51cedfb50e Merge 6afb3f1acc into 631a558a9f 2025-05-23 20:40:23 +02:00
databreach
6afb3f1acc Add user scripts folder with LXC scripts from issue #382
Added a user-scripts folder containing the LXC scripts referenced in vdsm/virtual-dsm#382, preserving them before the original repository is deleted.
2025-05-23 20:38:56 +02:00
Kroese
631a558a9f feat: Enable IPv6 support for user-mode container networking (#983)
Some checks failed
Build / Check (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-04-27 11:28:54 +02:00
Kroese
d5805b4e08 feat: Check CPU vendor (#982) 2025-04-27 11:21:37 +02:00
Kroese
1dc15ce2e0 docs: Add input types (#981) 2025-04-23 12:54:22 +02:00
Kroese
4145e811df feat: Improve CPU detection (#980)
Some checks failed
Build / Check (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-04-20 21:43:02 +02:00
Kroese
fe8615d7d3 docs: Add quotes around $PWD (#977)
Some checks failed
Build / Check (push) Has been cancelled
Update / dockerHubDescription (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-04-16 12:10:59 +02:00
Kroese
27ea5506bc feat: Default to 2 CPU cores and 2GB of RAM (#976) 2025-04-16 11:56:02 +02:00
Kroese
394131a0d7 feat: Podman detection (#972)
Some checks failed
Build / Check (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-04-09 09:01:01 +02:00
Kroese
4d0d16023f feat: Podman detection (#971) 2025-04-09 08:58:02 +02:00
Kroese
60dd794b29 fix: Avoid pipe to head on find (#970) 2025-04-09 08:03:41 +02:00
Kroese
f13d104968 build: Add root-user-action flag (#968)
Some checks are pending
Build / Check (push) Waiting to run
Build / Build (push) Blocked by required conditions
2025-04-08 07:53:17 +02:00
Kroese
914099fd12 build: Add --root-user-action flag (#967)
Some checks are pending
Build / Check (push) Waiting to run
Build / Build (push) Blocked by required conditions
2025-04-07 18:47:36 +02:00
Kroese
639725957d fix: Permission errors on QNAP (#966) 2025-04-07 18:36:47 +02:00
Kroese
64bbe82c4a fix: KVM warning (#965) 2025-04-07 17:44:26 +02:00
Kroese
73a13e5697 fix: QNAP permission errors (#964) 2025-04-07 17:20:14 +02:00
Kroese
e8ec5fb8ed feat: Support 4k sector sizes (#963)
Some checks failed
Build / Check (push) Waiting to run
Build / Build (push) Blocked by required conditions
Update / dockerHubDescription (push) Has been cancelled
2025-04-07 13:25:20 +02:00
Kroese
0b500ca377 docs: Disk pass-through (#960)
Some checks failed
Update / dockerHubDescription (push) Has been cancelled
2025-04-03 10:22:26 +02:00
Kroese
df58745ed8 fix: Ignore missing custom .pat after install (#959)
Some checks failed
Build / Check (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-04-03 01:13:14 +02:00
Kroese
55e8ab4930 docs: Github Codespaces (#956)
Some checks failed
Update / dockerHubDescription (push) Has been cancelled
2025-03-27 01:48:40 +01:00
Kroese
4882fd3bf6 fix: Local file support (#955)
Some checks failed
Build / Check (push) Has been cancelled
Build / Build (push) Has been cancelled
2025-03-26 19:51:58 +01:00
13 changed files with 329 additions and 62 deletions

View File

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

View File

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

View File

@@ -44,7 +44,7 @@ RUN set -eu && \
netcat-openbsd \
qemu-system-x86 && \
apt-get clean && \
pip3 install --no-cache-dir --break-system-packages dissect.cstruct && \
pip3 install --no-cache-dir --break-system-packages --root-user-action=ignore dissect.cstruct && \
mkdir -p /etc/qemu && \
echo "allow br0" > /etc/qemu/bridge.conf && \
unlink /etc/nginx/sites-enabled/default && \
@@ -61,9 +61,9 @@ ADD --chmod=775 https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/
VOLUME /storage
EXPOSE 22 139 445 5000
ENV RAM_SIZE="1G"
ENV RAM_SIZE="2G"
ENV CPU_CORES="2"
ENV DISK_SIZE="16G"
ENV CPU_CORES="1"
HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh

View File

@@ -47,7 +47,7 @@ services:
##### Via Docker CLI:
```bash
docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v ${PWD:-.}/dsm:/storage --stop-timeout 120 vdsm/virtual-dsm
docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/dsm:/storage" --stop-timeout 120 vdsm/virtual-dsm
```
##### Via Kubernetes:
@@ -58,7 +58,7 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
##### Via Github Codespaces:
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=619260050&machine=basicLinux32gb)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/vdsm/virtual-dsm)
## FAQ 💬
@@ -123,20 +123,19 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
### How do I pass-through a disk?
It is possible to pass-through a disk device directly, which can be useful when your host is a virtual machine, as it removes an extra layer and allows for easier image management on the host.
For use with physical disks this method provides little advantage over using an image and is not recommended. You can add the device to your compose file like this:
It is possible to pass-through disk devices or partitions directly by adding them to your compose file in this way:
```yaml
devices:
- /dev/sdc:/disk1
- /dev/sdb:/disk1
- /dev/sdc1:/disk2
```
Replace `/dev/sdc` with the name of the disk. It needs to be totally empty (without any partition table) otherwise DSM does not always format it into a volume.
Make sure it is totally empty (without any filesystem), otherwise DSM may not format it as a volume.
### How do I change the amount of CPU or RAM?
By default, the container will be allowed to use a maximum of 1 CPU core and 1 GB of RAM.
By default, the container will be allowed to use a maximum of 2 CPU cores and 2 GB of RAM.
If you want to adjust this, you can specify the desired amount using the following environment variables:

View File

@@ -0,0 +1,122 @@
#!/bin/bash
# Constants
CONFIG_DIR="/etc/pve/lxc"
TMP_DIR="/tmp"
# Function to display log messages
log() {
echo -e "$1"
}
# Function to display error and exit
function display_error_and_exit() {
log "Error: $1 Exiting."
exit 1
}
# Function to display information
function display_info {
clear
log "This script is used to configure prerequisites to run Synology Virtual DSM"
log "in a Docker container inside an unprivileged Proxmox LXC container."
log "Please run this script on the Proxmox host, not inside the LXC container.\n"
}
# Check for root privileges
if [ "$EUID" -ne 0 ]; then
display_error_and_exit "Please run this script as root."
fi
display_info
read -p "Do you want to continue? (y/n): " choice
if [[ $choice == "y" || $choice == "Y" ]]; then
read -p "Enter the LXC Container ID (CT ID): " ct_id
read -p "Enter the vGPU card ID (e.g. card1 = 1): " gpu_card
read -p "Enter the vGPU renderD ID (e.g. renderD129 = 129): " gpu_renderd
# Check if ct_id is a non-empty numeric value
if [[ ! $ct_id =~ ^[0-9]+$ ]]; then
display_error_and_exit "Invalid LXC Container ID. Please enter a numeric value."
fi
# Check if gpu_card is a non-empty numeric value
if [[ ! $gpu_card =~ ^[0-9]+$ ]]; then
display_error_and_exit "Invalid vGPU card number. Please enter a numeric value."
fi
# Check if gpu_renderd is a non-empty numeric value
if [[ ! $gpu_renderd =~ ^[0-9]+$ ]]; then
display_error_and_exit "Invalid vGPU renderD number. Please enter a numeric value."
fi
# Check if the configuration file exists
config_file="$CONFIG_DIR/$ct_id.conf"
if [[ ! -f "$config_file" ]]; then
display_error_and_exit "Configuration file $config_file does not exist."
fi
# Check if the LXC container is running
container_status=$(pct status $ct_id 2>&1)
if [[ "$container_status" == *"running"* ]]; then
log "Stopping running LXC container $ct_id..."
pct stop $ct_id || display_error_and_exit "Failed to stop LXC container $ct_id."
fi
# Remove existing dev folder and tun, kvm, and vhost-net devices
if [[ -d "/dev-$ct_id" ]]; then
log "Removing existing /dev-$ct_id folder..."
rm -r "/dev-$ct_id" || display_error_and_exit "Failed to remove existing /dev-$ct_id folder."
fi
# Function to configure devices
function configure_device() {
device=$1
module=$2
major=$3
minor=$4
log "Configuring $device..."
mkdir -p "/dev-$ct_id/net" || display_error_and_exit "Failed to create /dev-$ct_id/net"
mkdir -p "/dev-$ct_id/dri" || display_error_and_exit "Failed to create /dev-$ct_id/dri"
mknod "/dev-$ct_id/$device" c $major $minor || display_error_and_exit "Failed to mknod /dev-$ct_id/$device"
chown 100000:100000 "/dev-$ct_id/$device" || display_error_and_exit "Failed to chown /dev-$ct_id/$device"
#log "Checking if /dev-$ct_id/$device exists..."
if ! [[ -e "/dev-$ct_id/$device" ]]; then
display_error_and_exit "/dev-$ct_id/$device should have been created but does not exist."
fi
}
# Configure devices
configure_device "net/tun" "tun" 10 200
configure_device "kvm" "kvm" 10 232
configure_device "vhost-net" "vhost-net" 10 238
configure_device "dri/card0" "card0" 226 $gpu_card
configure_device "dri/renderD128" "renderD128" 226 $gpu_renderd
# Check and add configuration lines to /et/pve/lxc/<CT ID>.conf
log "Checking and adding configuration to $config_file..."
lines_to_add=(
"lxc.mount.entry: /dev-$ct_id/net/tun dev/net/tun none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/kvm dev/kvm none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/vhost-net dev/vhost-net none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/dri/card0 dev/dri/card0 none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/dri/renderD128 dev/dri/renderD128 none bind,create=file 0 0"
)
# Error handling for config file changes
for line in "${lines_to_add[@]}"; do
if ! grep -qF "$line" "$config_file"; then
echo "$line" >> "$config_file" || display_error_and_exit "Failed to add line '$line' to $config_file."
fi
done
log "Configuration completed successfully.\n\nStart the docker image (vdsm/virtual-dsm:latest) inside the LXC container."
else
clear
log "\nScript aborted. No changes were made."
fi

105
scripts/virtual-dsm-lxc.sh Normal file
View File

@@ -0,0 +1,105 @@
#!/bin/bash
# Constants
CONFIG_DIR="/etc/pve/lxc"
TMP_DIR="/tmp"
# Function to display log messages
log() {
echo -e "$1"
}
# Function to display error and exit
function display_error_and_exit() {
log "Error: $1 Exiting."
exit 1
}
# Function to display information
function display_info {
clear
log "This script is used to configure prerequisites to run Synology Virtual DSM"
log "in a Docker container inside an unprivileged Proxmox LXC container."
log "Please run this script on the Proxmox host, not inside the LXC container.\n"
}
# Check for root privileges
if [ "$EUID" -ne 0 ]; then
display_error_and_exit "Please run this script as root."
fi
display_info
read -p "Do you want to continue? (y/n): " choice
if [[ $choice == "y" || $choice == "Y" ]]; then
read -p "Enter the LXC Container ID (CT ID): " ct_id
# Check if ct_id is a non-empty numeric value
if [[ ! $ct_id =~ ^[0-9]+$ ]]; then
display_error_and_exit "Invalid LXC Container ID. Please enter a numeric value."
fi
# Check if the configuration file exists
config_file="$CONFIG_DIR/$ct_id.conf"
if [[ ! -f "$config_file" ]]; then
display_error_and_exit "Configuration file $config_file does not exist."
fi
# Check if the LXC container is running
container_status=$(pct status $ct_id 2>&1)
if [[ "$container_status" == *"running"* ]]; then
log "Stopping running LXC container $ct_id..."
pct stop $ct_id || display_error_and_exit "Failed to stop LXC container $ct_id."
fi
# Remove existing dev folder and tun, kvm, and vhost-net devices
if [[ -d "/dev-$ct_id" ]]; then
log "Removing existing /dev-$ct_id folder..."
rm -r "/dev-$ct_id" || display_error_and_exit "Failed to remove existing /dev-$ct_id folder."
fi
# Function to configure devices
function configure_device() {
device=$1
module=$2
major=$3
minor=$4
log "Configuring $device..."
mkdir -p "/dev-$ct_id/net" || display_error_and_exit "Failed to create /dev-$ct_id/net"
mknod "/dev-$ct_id/$device" c $major $minor || display_error_and_exit "Failed to mknod /dev-$ct_id/$device"
chown 100000:100000 "/dev-$ct_id/$device" || display_error_and_exit "Failed to chown /dev-$ct_id/$device"
#log "Checking if /dev-$ct_id/$device exists..."
if ! [[ -e "/dev-$ct_id/$device" ]]; then
display_error_and_exit "/dev-$ct_id/$device should have been created but does not exist."
fi
}
# Configure devices
configure_device "net/tun" "tun" 10 200
configure_device "kvm" "kvm" 10 232
configure_device "vhost-net" "vhost-net" 10 238
# Check and add configuration lines to /et/pve/lxc/<CT ID>.conf
log "Checking and adding configuration to $config_file..."
lines_to_add=(
"lxc.mount.entry: /dev-$ct_id/net/tun dev/net/tun none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/kvm dev/kvm none bind,create=file 0 0"
"lxc.mount.entry: /dev-$ct_id/vhost-net dev/vhost-net none bind,create=file 0 0"
)
# Error handling for config file changes
for line in "${lines_to_add[@]}"; do
if ! grep -qF "$line" "$config_file"; then
echo "$line" >> "$config_file" || display_error_and_exit "Failed to add line '$line' to $config_file."
fi
done
log "Configuration completed successfully.\n\nStart the docker image (vdsm/virtual-dsm:latest) inside the LXC container."
else
clear
log "\nScript aborted. No changes were made."
fi

View File

@@ -368,6 +368,8 @@ createDevice () {
local DISK_FMT=$5
local DISK_IO=$6
local DISK_CACHE=$7
local DISK_SERIAL=$8
local DISK_SECTORS=$9
local DISK_ID="data$DISK_INDEX"
local index=""
@@ -381,29 +383,29 @@ createDevice () {
;;
"usb" )
result+=",if=none \
-device usb-storage,drive=${DISK_ID}${index}"
-device usb-storage,drive=${DISK_ID}${index}${DISK_SERIAL}${DISK_SECTORS}"
echo "$result"
;;
"nvme" )
result+=",if=none \
-device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}"
-device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}${DISK_SERIAL}${DISK_SECTORS}"
echo "$result"
;;
"ide" | "sata" )
result+=",if=none \
-device ich9-ahci,id=ahci${DISK_INDEX},addr=$DISK_ADDRESS \
-device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}"
-device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}"
echo "$result"
;;
"blk" | "virtio-blk" )
result+=",if=none \
-device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}"
-device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}${DISK_SERIAL}${DISK_SECTORS}"
echo "$result"
;;
"scsi" | "virtio-scsi" )
result+=",if=none \
-device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \
-device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}"
-device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}"
echo "$result"
;;
esac
@@ -482,7 +484,7 @@ addDisk () {
fi
DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE")
DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" "" "")
return 0
}
@@ -497,7 +499,26 @@ addDevice () {
[ -z "$DISK_DEV" ] && return 0
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE")
local sectors=""
local result logical physical
result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-)
logical="${result%% *}"
physical=$(echo "$result" | grep -m 1 -o "/ .*" | cut -c 3-)
physical="${physical%% *}"
if [ -n "$physical" ]; then
if [[ "$physical" == "512" ]] || [[ "$physical" == "4096" ]]; then
if [[ "$physical" == "4096" ]]; then
sectors=",logical_block_size=$logical,physical_block_size=$physical"
fi
else
warn "Unknown physical sector size: $physical for $DISK_DEV"
fi
else
warn "Failed to determine the sector size for $DISK_DEV"
fi
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors")
return 0
}
@@ -529,8 +550,8 @@ else
DISK_ALLOC="preallocation=falloc"
fi
DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "1" "0xa" "raw" "$DISK_IO" "$DISK_CACHE")
DISK_OPTS+=$(createDevice "$SYSTEM" "$DISK_TYPE" "2" "0xb" "raw" "$DISK_IO" "$DISK_CACHE")
DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "1" "0xa" "raw" "$DISK_IO" "$DISK_CACHE" "" "")
DISK_OPTS+=$(createDevice "$SYSTEM" "$DISK_TYPE" "2" "0xb" "raw" "$DISK_IO" "$DISK_CACHE" "" "")
DISK1_FILE="$STORAGE/${DISK_NAME}"
if [[ ! -f "$DISK1_FILE.img" ]] && [[ -f "$STORAGE/data${DISK_SIZE}.img" ]]; then

View File

@@ -8,7 +8,9 @@ set -Eeuo pipefail
: "${DISPLAY:="none"}" # Display type
: "${RENDERNODE:="/dev/dri/renderD128"}" # Render node
if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
CPU_VENDOR=$(lscpu | awk '/Vendor ID/{print $3}')
if [[ "$GPU" != [Yy1]* ]] || [[ "$CPU_VENDOR" != "GenuineIntel" ]] || [[ "$ARCH" != "amd64" ]]; then
[[ "${DISPLAY,,}" == "none" ]] && VGA="none"
DISPLAY_OPTS="-display $DISPLAY -vga $VGA"

View File

@@ -13,28 +13,30 @@ else
fi
FN="boot.pat"
if [ -d "/$FN" ]; then
error "The file /$FN does not exist, please check that you mapped it to a valid path!" && exit 65
DIR=$(find / -maxdepth 1 -type d -iname "$FN" -print -quit)
[ ! -d "$DIR" ] && DIR=$(find "$STORAGE" -maxdepth 1 -type d -iname "$FN" -print -quit)
if [ -d "$DIR" ]; then
BASE="DSM_VirtualDSM" && URL="file://$DIR"
if [[ ! -s "$STORAGE/$BASE.boot.img" ]] || [[ ! -s "$STORAGE/$BASE.system.img" ]]; then
error "The bind $DIR maps to a file that does not exist!" && exit 65
fi
fi
FILE=$(find / -maxdepth 1 -type f -iname "$FN" | head -n 1)
[ ! -s "$FILE" ] && FILE=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" | head -n 1)
FILE=$(find / -maxdepth 1 -type f -iname "$FN" -print -quit)
[ ! -s "$FILE" ] && FILE=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -print -quit)
[ -s "$FILE" ] && BASE="DSM_VirtualDSM" && URL="file://$FILE"
if [ -n "$URL" ]; then
if [ ! -s "$FILE" ]; then
BASE=$(basename "$URL" .pat)
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
BASE=$(basename "${URL%%\?*}" .pat)
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
fi
if [ -n "$URL" ] && [ ! -s "$FILE" ] && [ ! -d "$DIR" ]; then
BASE=$(basename "$URL" .pat)
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
BASE=$(basename "${URL%%\?*}" .pat)
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
fi
if [[ "${URL,,}" != "http"* ]] && [[ "${URL,,}" != "file:"* ]] ; then
URL="file:///$BASE.pat"
if [ ! -s "/$BASE.pat" ]; then
error "File '$BASE.pat' does not exist!" && exit 65
fi
[ ! -s "$STORAGE/$BASE.pat" ] && error "Invalid URL: $URL" && exit 65
URL="file://$STORAGE/$BASE.pat"
fi
fi
@@ -268,12 +270,9 @@ mv "$HDA.tgz" "$HDA.txz"
[ -d "$PKG" ] && mv "$PKG/" "$MOUNT/.SynoUpgradePackages/"
rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
[ -s "$HDP.txz" ] && tar xpfJ "$HDP.txz" --absolute-names -C "$MOUNT/"
if [ -s "$IDB.txz" ]; then
INDEX_DB="$MOUNT/usr/syno/synoman/indexdb/"
INDEX_DB="$MOUNT/usr/syno/synoman/indexdb"
mkdir -p "$INDEX_DB"
tar xpfJ "$IDB.txz" --absolute-names -C "$INDEX_DB"
fi
LABEL="1.44.1-42218"
@@ -282,6 +281,8 @@ NUMBLOCKS="2097152" # (16777216 * 512) / 4096
MSG="Installing system partition..."
fakeroot -- bash -c "set -Eeu;\
[ -s $HDP.txz ] && tar xpfJ $HDP.txz --absolute-names -C $MOUNT/;\
[ -s $IDB.txz ] && tar xpfJ $IDB.txz --absolute-names -C $INDEX_DB/;\
tar xpfJ $HDA.txz --absolute-names --skip-old-files -C $MOUNT/;\
printf '%b%s%b' '\E[1;34m \E[1;36m' 'Install: $MSG' '\E[0m\n';\
mke2fs -q -t ext4 -b 4096 -d $MOUNT/ -L $LABEL -F -E offset=$OFFSET $SYSTEM $NUMBLOCKS"

View File

@@ -176,7 +176,11 @@ getHostPorts() {
configureUser() {
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
if [ -z "$IP6" ]; then
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
else
NET_OPTS="-netdev user,id=hostnet0,ipv4=on,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,ipv6=on,hostname=$VM_NET_HOST"
fi
local forward
forward=$(getUserPorts "$USER_PORTS")
@@ -192,6 +196,7 @@ configureNAT() {
# Create the necessary file structure for /dev/net/tun
if [ ! -c /dev/net/tun ]; then
[[ "$PODMAN" == [Yy1]* ]] && return 1
[ ! -d /dev/net ] && mkdir -m 755 /dev/net
if mknod /dev/net/tun c 10 200; then
chmod 666 /dev/net/tun
@@ -199,15 +204,14 @@ configureNAT() {
fi
if [ ! -c /dev/net/tun ]; then
[[ "$PODMAN" != [Yy1]* ]] && error "$tuntap"
return 1
error "$tuntap" && return 1
fi
# Check port forwarding flag
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || :
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
[[ "$PODMAN" != [Yy1]* ]] && error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
return 1
fi
fi
@@ -338,17 +342,17 @@ closeNetwork() {
checkOS() {
local name
local kernel
local os=""
local if="macvlan"
name=$(uname -a)
kernel=$(uname -a)
[[ "${name,,}" == *"darwin"* ]] && os="Docker Desktop for macOS"
[[ "${name,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows"
[[ "${kernel,,}" == *"darwin"* ]] && os="Docker Desktop for macOS"
[[ "${kernel,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows"
if [[ "$DHCP" == [Yy1]* ]]; then
if="macvtap"
[[ "${name,,}" == *"synology"* ]] && os="Synology Container Manager"
[[ "${kernel,,}" == *"synology"* ]] && os="Synology Container Manager"
fi
if [ -n "$os" ]; then

View File

@@ -37,14 +37,14 @@ if [[ "$KVM" != [Nn]* ]]; then
KVM_ERR=""
if [ ! -e /dev/kvm ]; then
KVM_ERR="(device file missing)"
KVM_ERR="(/dev/kvm is missing)"
else
if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then
KVM_ERR="(no write access)"
KVM_ERR="(/dev/kvm is unwriteable)"
else
flags=$(sed -ne '/^flags/s/^.*: //p' /proc/cpuinfo)
if ! grep -qw "vmx\|svm" <<< "$flags"; then
KVM_ERR="(vmx/svm disabled)"
KVM_ERR="(not enabled in BIOS)"
fi
fi
fi
@@ -53,9 +53,17 @@ if [[ "$KVM" != [Nn]* ]]; then
KVM="N"
if [[ "$OSTYPE" =~ ^darwin ]]; then
warn "you are using macOS which has no KVM support, this will cause a major loss of performance."
else
error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance."
error "See the FAQ on how to diagnose the cause, or continue without KVM by setting KVM=N (not recommended)."
else
kernel=$(uname -a)
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
fi
fi

View File

@@ -17,8 +17,8 @@ echo " For support visit $SUPPORT"
: "${CONSOLE:="N"}" # Disable console mode
: "${ALLOCATE:=""}" # Preallocate diskspace
: "${ARGUMENTS:=""}" # Extra QEMU parameters
: "${CPU_CORES:="1"}" # Amount of CPU cores
: "${RAM_SIZE:="1G"}" # Maximum RAM amount
: "${CPU_CORES:="2"}" # Amount of CPU cores
: "${RAM_SIZE:="2G"}" # Maximum RAM amount
: "${RAM_CHECK:="Y"}" # Check available RAM
: "${DISK_SIZE:="16G"}" # Initial data disk size
: "${STORAGE:="/storage"}" # Storage folder location

View File

@@ -113,15 +113,15 @@ cpu() {
local cpu=""
ret=$(lscpu)
if grep -qi "model name" <<< "$ret"; then
cpu=$(echo "$ret" | grep -m 1 -i 'model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
fi
if [ -z "${cpu// /}" ] && grep -qi "model:" <<< "$ret"; then
cpu=$(echo "$ret" | grep -m 1 -i 'model:' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
fi
cpu="${cpu// CPU/}"
cpu="${cpu// 4 Core/}"
cpu="${cpu// 6 Core/}"
@@ -147,7 +147,8 @@ cpu() {
cpu="${cpu// Core TM/ Core}"
cpu="${cpu// with Radeon Graphics/}"
cpu="${cpu// with Radeon Vega Graphics/}"
cpu="${cpu// with Radeon Vega Mobile Gfx/}"
[ -z "${cpu// /}" ] && cpu="Unknown"
echo "$cpu"