From 152009fe6df891877fc5be2ffae17092f78bbd0b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Dec 2024 11:32:17 +0000 Subject: [PATCH] first_try --- setup-usi-mm | 56 +++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/setup-usi-mm b/setup-usi-mm index 8af6577..3e112ef 100755 --- a/setup-usi-mm +++ b/setup-usi-mm @@ -49,28 +49,21 @@ zfs create crypt/lxd zfs create crypt/lxd/dir zfs create crypt/lxd/storage -echo "Switch to 6.1 LXD version" -snap switch --channel 6.1/stable lxd -snap refresh +echo "Deleting everything in /var/lib/incus/*" +rm /var/lib/incus/* -r -echo "Disabling lxd snap" -snap disable lxd - -echo "Deleting everything in /var/snap/lxd/common/lxd/*" -rm /var/snap/lxd/common/lxd/* -r - -echo "Creating mountpoint /var/snap/lxd/common/lxd to crypt/lxd/dir" -zfs set mountpoint=/var/snap/lxd/common/lxd crypt/lxd/dir +echo "Setting mountpoint /var/lib/incus to crypt/lxd/dir" +zfs set mountpoint=/var/lib/incus crypt/lxd/dir echo "Configuring sysctl" -echo "vm.swappiness = 1" > /etc/sysctl.d/50-usl-mm.conf -echo "vm.min_free_kbytes = 131072" >> /etc/sysctl.d/50-usl-mm.conf -echo "vm.dirty_background_ratio = 5" >> /etc/sysctl.d/50-usl-mm.conf -echo "fs.inotify.max_queued_events = 1048576" >> /etc/sysctl.d/50-usl-mm.conf -echo "fs.inotify.max_user_instances = 1048576" >> /etc/sysctl.d/50-usl-mm.conf -echo "fs.inotify.max_user_watches = 1048576" >> /etc/sysctl.d/50-usl-mm.conf -echo "kernel.dmesg_restrict = 1" >> /etc/sysctl.d/50-usl-mm.conf -echo "net.netfilter.nf_conntrack_max = 4194304" >> /etc/sysctl.d/50-usl-mm.conf +echo "vm.swappiness = 1" > /etc/sysctl.d/50-usi-mm.conf +echo "vm.min_free_kbytes = 131072" >> /etc/sysctl.d/50-usi-mm.conf +echo "vm.dirty_background_ratio = 5" >> /etc/sysctl.d/50-usi-mm.conf +echo "fs.inotify.max_queued_events = 1048576" >> /etc/sysctl.d/50-usi-mm.conf +echo "fs.inotify.max_user_instances = 1048576" >> /etc/sysctl.d/50-usi-mm.conf +echo "fs.inotify.max_user_watches = 1048576" >> /etc/sysctl.d/50-usi-mm.conf +echo "kernel.dmesg_restrict = 1" >> /etc/sysctl.d/50-usi-mm.conf +echo "net.netfilter.nf_conntrack_max = 4194304" >> /etc/sysctl.d/50-usi-mm.conf #Ugly fix echo "@reboot root /sbin/sysctl -w net.netfilter.nf_conntrack_max=4194304" > /etc/cron.d/conntrack_cron @@ -127,14 +120,18 @@ echo "else" >> /root/onstart echo "echo \"Passwords not match!\"" >> /root/onstart echo "exit 1" >> /root/onstart echo "fi" >> /root/onstart -echo "echo \"Stopping LXD snap daemon and deleting /var/snap/lxd/common/lxd/*\"" >> /root/onstart -echo "snap disable lxd" >> /root/onstart -echo "rm /var/snap/lxd/common/lxd/* -rf" >> /root/onstart +echo "echo \"Stopping Incus daemons and deleting /var/lib/incus/*\"" >> /root/onstart +echo "systemctl stop incus" >> /root/onstart +echo "systemctl stop incus.socket" >> /root/onstart +echo "systemctl stop incus-user.socket" >> /root/onstart +echo "rm /var/lib/incus/* -rf" >> /root/onstart echo "echo \"Opening encrypted partition\"" >> /root/onstart echo "echo \$pass_var | cryptsetup open $PARTITION crypt -c -" >> /root/onstart echo "partprobe" >> /root/onstart echo "zpool import -d /dev/mapper crypt -f -m" >> /root/onstart -echo "snap enable lxd" >> /root/onstart +echo "systemctl start incus-user.socket" >> /root/onstart +echo "systemctl start incus.socket" >> /root/onstart +echo "systemctl start incus" >> /root/onstart chmod +x /root/onstart read -p "Press any key for reboot" @@ -150,8 +147,8 @@ echo "Executing /root/onstart" bash /root/onstart echo "Configuring LXD" -lxd waitready -cat <