Dec 9, 2024
TechnologyChange the command:
#### 7. mysimplerecorder
(writeShellScriptBin "mysimplerecorder" ''
rm -f /tmp/tmprecording.mp4
wf-recorder -g "$(slurp)" -f /tmp/tmprecording.mp4 -c h264_vaapi -d /dev/dri/renderD128 -p "preset=superfast"
cp /tmp/tmprecording.mp4 /home/dash/Videos/`date +"%Y-%m-%d-%H-%M-%S" `.mp4
'')
Since we want to use h264_vaapi
, we need to enable vaapi under nixos’s configuration:
nixpkgs.config.packageOverrides = pkgs: {
intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
};
hardware.graphics = { # hardware.graphics since NixOS 24.11
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
libvdpau-va-gl
];
};
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Force intel-media-driver
Rebuild then you could use new comand for screen recorder:
sudo nixos-rebuild switch --option substituers https://mirror.sjtu.edu.cn/nix-channels/store
Dec 5, 2024
Technology安装
先试用,配置好网络后,安装:
进入系统后的安装和配置:
sudo apt update -y && sudo apt upgrade -y
sudo wget -O /etc/apt/trusted.gpg.d/drbl-gpg.asc https://drbl.org/GPG-KEY-DRBL
sudo vim /etc/apt/sources.list
deb http://free.nchc.org.tw/ubuntu jammy main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable
sudo apt update
sudo apt install -y drbl
配置:
ufw disable
sudo drblsrv -i
Dec 5, 2024
TechnologyHardware/OS/Software info:
dash@i9server:~$ cat /etc/issue
Ubuntu 22.04.5 LTS \n \l
dash@i9server:~$ uname -a
Linux i9server 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
dash@i9server:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 64M 1 loop /snap/core20/2379
loop1 7:1 0 63.7M 1 loop /snap/core20/2434
loop2 7:2 0 87M 1 loop /snap/lxd/29351
loop3 7:3 0 89.4M 1 loop /snap/lxd/31333
loop4 7:4 0 38.8M 1 loop /snap/snapd/21759
loop5 7:5 0 44.3M 1 loop /snap/snapd/23258
sda 8:0 0 1.8T 0 disk
└─sda1 8:1 0 1.8T 0 part
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot/efi
└─nvme0n1p2 259:2 0 475.9G 0 part /
dash@i9server:~$ free -m
total used free shared buff/cache available
Mem: 64079 565 60533 2 2981 62859
Swap: 8191 0 8191
dash@i9server:~$ cat /proc/cpuinfo | grep -i model
model : 165
model name : Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz
Install ltsp:
sudo add-apt-repository ppa:ltsp
sudo apt update
sudo apt install --install-recommends ltsp ltsp-binaries dnsmasq nfs-kernel-server openssh-server squashfs-tools ethtool net-tools epoptes
sudo gpasswd -a dash epoptes
Prepare the image:
# ls *.img -l -h
-rw-r--r-- 1 dash dash 4.0G Dec 5 02:33 kylin.img
-rw-r--r-- 1 dash dash 2.6G Dec 5 02:35 ubuntu2004.img
-rw-r--r-- 1 dash dash 3.2G Dec 5 02:34 uos613.img
-rw-r--r-- 1 dash dash 4.4G Dec 5 02:34 zkfd613.img
Create the dns/dhcp, import the images:
ltsp dnsmasq --proxy-dhcp=0
vim /etc/dnsmasq.d/ltsp-dnsmasq.conf
dhcp-range=192.168.1.34,192.168.1.250,600h
mkdir /srv/ltsp && cd /srv/ltsp
ln -s /home/dash/ubuntu2004.img .
ltsp image ubuntu2004
ltsp ipxe
ltsp nfs
Installed /usr/share/ltsp/server/nfs/ltsp-nfs.exports in /etc/exports.d/ltsp-nfs.exports
ltsp initrd
useradd -m test1
useradd -m test2
passwd test1
passwd test2
more images:
rm -f *.img
ln -s /home/dash/uos613.img .
ltsp image uos613 && ltsp ipxe && ltsp initrd
rm -f *.img
ln -s /home/dash/zkfd613.img .
ltsp image zkfd613 && ltsp ipxe && ltsp initrd
rm -f *.img
ln -s /home/dash/kylin.img .
ltsp image kylin && ltsp ipxe && ltsp initrd
Result: zkfd behaves bad
deepin image:
cd /srv/ltsp
ln -s /var/lib/libvirt/trueimages/deepin.img .
ltsp image deepin && ltsp ipxe && ltsp initrd
Dec 3, 2024
Technology安装ltspserver
Configuration:
Installation:
选择正常安装:
用户名创建:
配置:
sudo apt update
sudo apt install -y openssh-server vim nethogs iotop
sudo add-apt-repository ppa:ltsp && sudo apt update
sudo apt install --install-recommends ltsp ltsp-binaries dnsmasq nfs-kernel-server openssh-server squashfs-tools ethtool net-tools epoptes
sudo usermod -aG epoptes test
sudo apt upgrade -y && sudo shutdown -h now
添加一个isolated网卡:
在网络管理下,配置其ip地址为10.17.18.18:
sudo ltsp dnsmasq --proxy-dhcp=0
sudo vim /etc/dnsmasq.d/ltsp-dnsmasq.conf
dhcp-range=10.17.18.20,10.17.18.250,12h
sudo ltsp image /
sudo ltsp ipxe
sudo ltsp nfs
sudo ltsp initrd
sudo useradd -m test1
sudo useradd -m test2
sudo ltsp initrd
测试
4C 4G:
命名:
网络:
引导:
virtualbox创建镜像
pre-allocate Full size:
10G size:
enable 3d acceleration.
虚机分区:
其他按默认安装完毕。
gnome桌面:
进入系统后,关闭lock/sleep等选项。
cd /srv/ltsp/
ls
rm -f debian12_1.img
ln -s /home/test/ubuntu1-flat.vmdk ./ubuntu1.img
ltsp image ubuntu1
ltsp ipxe
Next time reboot then you could enter ubuntu1.
debian got some errors.
kylin problem:
root@ltscserver:/srv/ltsp# ln -s /home/test/kylin-flat.vmdk ./kylin.img
root@ltscserver:/srv/ltsp# ltsp image kylin
Running: losetup -rP /dev/loop6 /srv/ltsp/kylin.img
Running: mount -t tmpfs -o mode=0755 tmpfs /tmp/tmp.sV6xy2UAD1/tmpfs
Running: mount -t ext4 -o ro,noload /dev/loop6p1 /tmp/tmp.sV6xy2UAD1/tmpfs/0/looproot
Running: mount -t overlay -o upperdir=/tmp/tmp.sV6xy2UAD1/tmpfs/0/up,lowerdir=/tmp/tmp.sV6xy2UAD1/tmpfs/0/looproot,workdir=/tmp/tmp.sV6xy2UAD1/tmpfs/0/work /tmp/tmp.sV6xy2UAD1/tmpfs /tmp/tmp.sV6xy2UAD1/root/
Cleaning up kylin before mksquashfs...
Traceback (most recent call last):
File "/usr/share/ltsp/client/login/pwmerge", line 440, in <module>
main(sys.argv)
File "/usr/share/ltsp/client/login/pwmerge", line 434, in main
pwm = PwMerge(args[0], args[1], args[2], **dopts)
File "/usr/share/ltsp/client/login/pwmerge", line 117, in __init__
self.dpasswd, self.dgroup = self.read_dir(ddir, dur or dgr)
File "/usr/share/ltsp/client/login/pwmerge", line 151, in read_dir
with open("{}/passwd".format(xdir), "r") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.sV6xy2UAD1/root/etc/passwd'
LTSP command failed: /usr/share/ltsp/client/login/pwmerge --ltsp --quiet /tmp/tmp.sV6xy2UAD1/root/tmp/pwempty /tmp/tmp.sV6xy2UAD1/root/etc /tmp/tmp.sV6xy2UAD1/root/tmp/pwmerged
Aborting ltsp
kylin tips
Add repository:
wget https://ltsp.org/misc/ltsp-ubuntu-ppa-focal.list -O /etc/apt/sources.list.d/ltsp-ubuntu-ppa-focal.list
wget https://ltsp.org/misc/ltsp_ubuntu_ppa.gpg -O /etc/apt/trusted.gpg.d/ltsp_ubuntu_ppa.gpg
apt update
sudo apt install --install-recommends ltsp ltsp-binaries dnsmasq nfs-kernel-server openssh-server squashfs-tools ethtool net-tools epoptes
sudo gpasswd -a test epoptes
Nov 28, 2024
Technologyconfig for lxc common:
# cat /usr/share/lxc/config/common.conf
# Default configuration shared by all containers
# Setup the LXC devices in /dev/lxc/
lxc.tty.dir = lxc
# Allow for 1024 pseudo terminals
lxc.pty.max = 1024
# Setup 4 tty devices
lxc.tty.max = 4
# Drop some harmful capabilities
lxc.cap.drop = mac_admin mac_override sys_time sys_module sys_rawio
# Ensure hostname is changed on clone
lxc.hook.clone = /usr/share/lxc/hooks/clonehostname
# Default legacy cgroup configuration
#
# CGroup allowlist
lxc.cgroup.devices.deny = a
## Allow any mknod (but not reading/writing the node)
lxc.cgroup.devices.allow = c *:* m
lxc.cgroup.devices.allow = b *:* m
## Allow specific devices
### /dev/null
lxc.cgroup.devices.allow = c 1:3 rwm
### /dev/zero
lxc.cgroup.devices.allow = c 1:5 rwm
### /dev/full
lxc.cgroup.devices.allow = c 1:7 rwm
### /dev/tty
lxc.cgroup.devices.allow = c 5:0 rwm
### /dev/console
lxc.cgroup.devices.allow = c 5:1 rwm
### /dev/ptmx
lxc.cgroup.devices.allow = c 5:2 rwm
### /dev/random
lxc.cgroup.devices.allow = c 1:8 rwm
### /dev/urandom
lxc.cgroup.devices.allow = c 1:9 rwm
### /dev/pts/*
lxc.cgroup.devices.allow = c 136:* rwm
### fuse
lxc.cgroup.devices.allow = c 10:229 rwm
## graphics. /dev/dri
lxc.cgroup.devices.allow = c 226:0 rwm
lxc.cgroup.devices.allow = c 226:128 rwm
## graphics. /dev/fb0
lxc.cgroup.devices.allow = c 29:0 rwm
### tty0, tty1, tty7, tty8
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
lxc.cgroup.devices.allow = c 4:7 rwm
lxc.cgroup.devices.allow = c 4:8 rwm
### sound
lxc.cgroup.devices.allow = c 116:* rwm
### input
lxc.cgroup.devices.allow = c 13:* rwm
# Default unified cgroup configuration
#
# CGroup allowlist
lxc.cgroup2.devices.deny = a
## Allow any mknod (but not reading/writing the node)
lxc.cgroup2.devices.allow = c *:* m
lxc.cgroup2.devices.allow = b *:* m
## Allow specific devices
### /dev/null
lxc.cgroup2.devices.allow = c 1:3 rwm
### /dev/zero
lxc.cgroup2.devices.allow = c 1:5 rwm
### /dev/full
lxc.cgroup2.devices.allow = c 1:7 rwm
### /dev/tty
lxc.cgroup2.devices.allow = c 5:0 rwm
### /dev/console
lxc.cgroup2.devices.allow = c 5:1 rwm
### /dev/ptmx
lxc.cgroup2.devices.allow = c 5:2 rwm
### /dev/random
lxc.cgroup2.devices.allow = c 1:8 rwm
### /dev/urandom
lxc.cgroup2.devices.allow = c 1:9 rwm
### /dev/pts/*
lxc.cgroup2.devices.allow = c 136:* rwm
### fuse
lxc.cgroup2.devices.allow = c 10:229 rwm
## graphics. /dev/dri
lxc.cgroup2.devices.allow = c 226:0 rwm
lxc.cgroup2.devices.allow = c 226:128 rwm
## graphics. /dev/fb0
lxc.cgroup2.devices.allow = c 29:0 rwm
## tty0, 1, 7, 8
lxc.cgroup2.devices.allow = c 4:0 rwm
lxc.cgroup2.devices.allow = c 4:1 rwm
lxc.cgroup2.devices.allow = c 4:7 rwm
lxc.cgroup2.devices.allow = c 4:8 rwm
### sound
lxc.cgroup2.devices.allow = c 116:* rwm
### input
lxc.cgroup.devices.allow = c 13:* rwm
# Setup the default mounts
#lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.auto = cgroup:mixed proc:rw sys:mixed
lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none bind,optional 0 0
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
# Block some syscalls which are not safe in privileged
# containers
lxc.seccomp.profile = /usr/share/lxc/config/common.seccomp
# Lastly, include all the configs from /usr/share/lxc/config/common.conf.d/
lxc.include = /usr/share/lxc/config/common.conf.d/
config added :
lxc.mount.entry = /dev/fb0 dev/fb0 none bind,optional,create=file
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file
### allow tty8
lxc.mount.entry = /dev/tty7 dev/tty7 none bind,optional,create=file
lxc.mount.entry = /dev/tty8 dev/tty8 none bind,optional,create=file
lxc.mount.entry = /dev/tty0 dev/tty0 none bind,optional,create=file
#lxc.mount.entry = /dev/tty1 dev/tty1 none bind,optional,create=file
#lxc.mount.entry = /dev/tty2 dev/tty2 none bind,optional,create=file
#lxc.mount.entry = /dev/tty3 dev/tty3 none bind,optional,create=file
### allow all of the input
lxc.mount.entry = /dev/input dev/input none bind,optional,create=dir
### allow all of the snd
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
The others are the same as previous ones.