LinuxTips15

1. x11docker

Start and specify vt:

# x11docker --gpu --vt=2 --xorg x11docker/mate

With internet and more features:

# x11docker --gpu --vt=2 --network --desktop --init=systemd x11docker/deepin

2. git without ssl check

via:

export GIT_SSL_NO_VERIFY=1
git clone https://xxxx.xx

3. Home Sharing environment

Install dnsmasq and configure:

# vim /etc/dnsmasq.conf
bind-interfaces
dhcp-range=10.1.10.128,10.1.10.200,12h
dhcp-option=3,10.1.10.1
dhcp-authoritative
interface=enp0s25
# systemctl restart dnsmasq

Start the sharing via(enp0s25->wlo1):

$ sudo iptables -t nat -A POSTROUTING -s '10.1.10.0/24' -o wlo1 -j MASQUERADE

Then with a ethernet cable connected, the other client could get reach into the internet via sharing.

4. system_reset in qemu

via:

telnet localhost 1111
> system_reset
this could reset the machine and let it reboot.

5. uhd510 win7 driver

download url:

https://downloadmirror.intel.com/30195/a08/win64_15.45.5174.exe

6. intel graphics

version:

21.20.16.5174 intel

7. Fix zsh issue

When type tab key in zsh shell, it will complains following arguments, and won’t automatically auto-complete the command:

(eval):setopt:3: no such option: NO_typesettounset

Fixed via:

# chsh -s $(which zsh)
# vim /etc/shells
/usr/bin/zsh

Reboot the machine and this issue fixed.

8. Enter to M

^M will be replaced ,when hitting Enter:

stty icrnl

9. wine with input method

Could not use fcitx in wine’s tim:

Add:

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

into /opt/apps/com.qq.tim.spark/files/run.sh

10. os-probe in archlinux

Add following lines into /etc/default/grub, then update grub configuration:

GRUB_DISABLE_OS_PROBER=false

11. ubuntu upgrade issue

solved via:

cd /var/lib/dpkg/info
sudo rm usrmerge.*
sudo apt-get -f install

12. ssh to dropbear

issue:

Unable to negotiate with 192.168.1.1 port 22: no matching host key type found. Their offer: ssh-rsa

solved via:

ssh  -oHostKeyAlgorithms=+ssh-rsa root@xxx.xxx.xxx.xxx

13. autologin xfce4

Edit lightdm configuration files:

vi /etc/lightdm/lightdm.conf

[SeatDefaults]
autologin-user=username    #需要登录的用户名
autologin-user-timeout=delay

14. detect pci parameters

via:

sudo lspci  -v -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation Device 9a49 (rev 01) (prog-if 00 [VGA controller])
	DeviceName: Onboard - Video
	Subsystem: Intel Corporation Device 3004
	Flags: bus master, fast devsel, latency 0, IRQ 190
	Memory at 603c000000 (64-bit, non-prefetchable) [size=16M]
	Memory at 4000000000 (64-bit, prefetchable) [size=256M]
	I/O ports at 3000 [size=64]
	Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
	Capabilities: [40] Vendor Specific Information: Len=0c <?>
	Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
	Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable+ 64bit-
	Capabilities: [d0] Power Management version 2
	Capabilities: [100] Process Address Space ID (PASID)
	Capabilities: [200] Address Translation Service (ATS)
	Capabilities: [300] Page Request Interface (PRI)
	Capabilities: [320] Single Root I/O Virtualization (SR-IOV)
	Kernel driver in use: i915
	Kernel modules: i915

15. dnf speed up

add following :

# vim /etc/dnf/dnf.conf
fastestmirror=true


16. makepkg ignore check

via:

makepkg --skipinteg

17. building on cdesktop

on building gstreamer:

Force specify a macro. 

on building net-snmp:

sudo apt install automake -y
aclocal
automake --add-missing --copy --force-missing

Detect pre-defined macros:

uos@uos-PC:~$ echo | gcc -E -dM - | grep sw
#define __sw_64_bwx__ 1
#define __sw_64 1
#define __sw_64_fix__ 1
#define __sw_64_sw6b__ 1
#define __sw_64__ 1
#define __sw_64_cix__ 1

18. markdown in confluence

via:

https://www.cnblogs.com/cuianbing/p/15891950.html

19. wine app fcitx

Added following in run.sh:

env locale=zh_CN

export XIM="fcitx"
export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"
export XMODIFIERS="@im=fcitx"

20. wine app fonts

Verify you have the correct fonts under :

➜  Fonts pwd
/home/dash/.deepinwine/Spark-TIM/drive_c/windows/Fonts
➜  Fonts ls
simsunb.ttf  simsun.ttc

Then add following into the run.sh:

env locale=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8
WINE_CMD="LC_ALL=zh_CN.UTF-8 deepin-wine5"

21. virtualbox time issue

Windows side:

c:\Progra~1\Oracle\VirtualBox\VBoxManage setextradata %NOME% "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1
c:\Progra~1\Oracle\VirtualBox\VBoxManage modifyvm %NOME% --biossystemtimeoffset -7628000000

22. python simple http server

via:

python -m http.server 9000

23. build kernel

BTF: .tmp_vmlinux.btf: pahole (pahole) is not available

sudo apt install dwarves

24. kernel install module

via:

make INSTALL_MOD_STRIP=1 modules_install -j4

then the initrd size will be small. Or you will encounter initrd is too big issue.

25. Auto restart sshd

via:

pacman -S cron
systemctl enable cronie
crontab -e
@reboot sleep 120 && systemctl restart sshd

Then each time you reboot the machine it will automatically restart sshd.

26. Install graphical in pve

Install kde via following command:

apt install -y task-kde-desktop

27. RemoteDesktop GPU

via:

显卡加速
win+r打开运行 输入gpedit.msc
依次找到计算机配置->管理模板->Windows组件->远程桌面服务->远程桌面会话主机->远程会话环境
在右边选择将硬件图形适配器应用于所有远程桌面服务会话
右键编辑,选择已启用确定保存。
重启远程主机。
现在可以在远程桌面里运行需要GPU支持的应用了

提升传输帧率
RDP默认的帧率是30,可以设置为60帧传输
实际效果取决于客户端设置、网络环境等等因素
打开远程主机上的注册表编辑器 win+r输入regedit
找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations
在空白处右键->新建->DWORD(32位)值,命名为DWMFRAMEINTERVAL
双击刚添加的这一项,基数选择为十进制,数值数据填写15
确定保存,重启生效

28. fsck ext4 disk

error message:

[ 5903.331828] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[ 5911.746891] EXT4-fs (sdb1): ext4_check_descriptors: Checksum for group 1 failed (43829!=56479)
[ 5911.746897] EXT4-fs (sdb1): group descriptors corrupted!

fixed via:

fsck.ext4 -fvy  /dev/sdb1

29. width height

55 <40

30. check ssd/hdd in linux

via:

lsblk -d -o name,rota
NAME ROTA
sda     0
sdb     0
sdc     1

30. list all xsessions

Available session types can be found in /usr/share/xsessions/ for X and in /usr/share/wayland-sessions/ for Wayland.

31. gdm 6000 issue

Solved via:

[dash@localhost ~]$ which X
/usr/bin/X
[dash@localhost ~]$ sudo vim /usr/bin/X
[dash@localhost ~]$ ls -l -h /usr/bin/X
lrwxrwxrwx. 1 root root 4 Sep 26  2022 /usr/bin/X -> Xorg
[dash@localhost ~]$ sudo rm -f /usr/bin/X
[dash@localhost ~]$ sudo vim /usr/bin/X
[dash@localhost ~]$ sudo netstat -anp | grep 6000
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      4215/X              
tcp6       0      0 :::6000                 :::*                    LISTEN      4215/X              
[dash@localhost ~]$ sudo systemctl restart gdm
[dash@localhost ~]$ sudo netstat -anp | grep 6000
[dash@localhost ~]$ cat /usr/bin/X
#!/bin/bash
exec /usr/bin/Xorg "$@" -nolisten tcp
exit 0

32. centos issue

disk full, restart machine with a cdrom, press F11 for boot menu.

/images/2023_03_29_09_59_13_674x419.jpg

33. zhaoxin gpu

/images/2023_03_30_09_22_18_864x289.jpg

https://www.zhaoxin.com/qdxz.aspx?nid=31&typeid=554

/images/2023_03_30_09_26_10_864x617.jpg

ubuntu guest, with qxl disabled. windows, no spice server, no qxl graphical card.

34. sddm autologin

via:

vim /etc/sddm.conf.d/autologin.conf
[Autologin]
User=john
Session=plasma

35. reboot for normal user(ubuntu18.04)

via:

echo '[Remote SSH]
Identity=unix-user:userrer
Action=org.freedesktop.login1.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes' | sudo tee /etc/polkit-1/localauthority/50-local.d/power.pkla

36. pivpn

create via:

pivpn add

Then copy the configuration files to wireguards.

37. setdefault

via:

 systemctl get-default
 systemctl set-default graphical.target
 systemctl get-default
 systemctl start graphical.target
 ps -ef | grep X

38. hackitosh

via:

https://www.itmanbu.com/ryzen-hackintosh-using-kvm-proxmox.html
https://blog.lv5.moe/p/pve-virtualized-hackintosh-gpu-passthrough-and-remote-access-tutorial
https://www.sqlsec.com/2022/04/pve.html#%E5%88%9D%E5%A7%8B%E5%8C%96%E8%99%9A%E6%8B%9F%E6%9C%BA

39. noip on rpi

add into the crontab via:

@reboot sleep 30 &&  /usr/local/bin/noip2 &

40. npci

via:

X99、X299 平台以及部分 AMD 平台需要添加 npci=0x2000 或 npci=0x3000,当跑代码卡在 PCI Start Configuration 时使用;

只有 AMD 平台的 BIOS 没有 Above 4G Decoding 选项时添加此参数,二者不可同时使用。 

41. du and sort

via:

du -hs -- * .[^.]* | sort -h

42. Get the virsh parameters

Query the os type via osinfo-query, then install the os via:

virt-install --name win1010 --memory 10240 --vcpus=2 --os-type=Windows --os-variant=win10 --cdrom=/var/lib/libvirt/images/Win10_20H2_v2_Chinese_x64.iso --network network=default --graphics=vnc -v
osinfo-query os

43. qemu build

-no-pie error resolution:

Q: ld: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
A: 这是因为新版本的ld不支持该参数导致,因此需要降低ld版本,由于ld属于Binutils中,所以要降低Binutils版本,参考如下方式:

# 下载binutils
wget https://ftp.gnu.org/gnu/binutils/binutils-2.30.tar.gz
tar zxvf  binutils-2.30.tar.gz
# 进入源码目录编译安装
cd binutils-2.30
./configure
make
make install
# 替换原来的ld
cd /usr/bin
mv ld ld.copy #备份旧版本ld
cd /usr/local/bin
ln -s ld /usr/bin/ld
# 验证ld版本是否降下来了
ld --version

44. Install mainline kernel on ubuntu

Via:

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update && sudo apt install mainline
sudo mainline --install-latest

Not working for ubuntu18.04.

via:

https://www.reddit.com/r/VFIO/comments/ayuffy/custom_ovmf_boot_logo/

46. virsh start with

With console output:

 virsh start realwin10 --console 2>&1 | tee outputlog.txt

47. build ovmf with debug

via:

OvmfPkg/build.sh -a X64 -D DEBUG_ON_SERIAL_PORT

48. copy Vbt.bin

via:

sudo cp /sys/kernel/debug/dri/0/i915_vbt Vbt.bin

49. Disable suspend/hibernate service

via:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

50. pnputil uninstall

via:

pnputil /delete-driver oem0.inf
pnputil /d oem0.inf

51. enable netplan Ubuntu

via:

sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo systemctl mask NetworkManager
Next, start and enable the systemd-networkd service:

sudo systemctl unmask systemd-networkd.service
sudo systemctl enable systemd-networkd.service
sudo systemctl start systemd-networkd.service
Add the interface configuration to the netplan config file (in the /etc/netplan directory):

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: yes
Apply the changes by running the following command:
sudo netplan apply

52. amt

3 articles:

https://mp.weixin.qq.com/s?__biz=MzAwODExNjI3NA==&mid=2649779334&idx=1&sn=1ca539bb708e8628a8beeaa8d4406985&chksm=83770ddbb40084cd9806537e1f31b9ac39bccccff0ee1ba7f7fe2e5c55296299b83ebf335014&cur_album_id=1374168008981184514&scene=189#wechat_redirect
https://mp.weixin.qq.com/s?__biz=MzAwODExNjI3NA==&mid=2649779281&idx=1&sn=3d5d84c753cb424bd7e1cefdf7ab30e8&chksm=83770d0cb400841a912ce894a94e555603a8c2b0314ec81c3e4701948da2d3b97ee8e085b204&token=187057378&lang=zh_CN&scene=21#wechat_redirect
https://mp.weixin.qq.com/s?__biz=MzAwODExNjI3NA==&mid=2649779314&idx=1&sn=f40ca8f4f4ba4ad2645cc0dc8fe658ee&chksm=83770d2fb400843949326a557f9849d1360f72ee79615d5be2a7793851e247c40caea13a08d8&token=187057378&lang=zh_CN&scene=21#wechat_redirect

53. redfish

https://mp.weixin.qq.com/s?__biz=MzAwODExNjI3NA==&mid=2649775148&idx=1&sn=9638581928f7fa98714c1ad24fafccdb&chksm=83773d71b400b467a9b72cbe8ae433393ab4e9f0b306c309d757ea08ba7bb4e27ddc24943951&token=1820633067&lang=zh_CN&scene=21#wechat_redirect

54. virt-xml

remove:

virt-xml instance-00000001 --remove-device --network 2

Add:

virt-xml instance-00000001 --add-device --network type=direct,mac=52:54:00:2d:2a:bb,source=enp1s0,source_mode=bridge,model=virtio

55. guestfish

Using guestfish for copy-in content:

主机上安装`libguestfs-tools`: `sudo apt-get install -y libguestfs-tools`:    

关机进入到 guest镜像编辑, 拷贝文件/文件夹到Administrator桌面:    

guestmount -a /var/lib/nova/instances/75f9c5f1-edc1-4184-969a-db326d973570/75f9c5f1-edc1-4184-969a-db326d973570.snap1 -m /dev/sda3 --rw /mnt
cp -r /root/2023_06_06_08_40_09_1912x1055.jpg /root/Videos/ /mnt/Users/Administrator/Desktop/
guestunmount /mnt

56. novnc desktop

https://hub.docker.com/r/fredblgr/ubuntu-novnc

57. build libvirtd(ubuntu22.04)

Build latest libvirtd(9.5.0)

sudo apt install -y build-essential git meson byobu 
git clone https://gitlab.com/libvirt/libvirt.git
cd libvirt/
sudo apt install -y libxml2-utils xsltproc pkg-config libglib2.0-dev gnutls-bin libgnutls28-dev libxml2-dev libyajl-dev python3-docutils
meson build -Dsystem=true -Ddriver_qemu=enabled
ninja -C build
./build/src/libvirtd --version
systemctl stop libvirtd
./build/src/libvirtd 

58. install new kernel-headers

via:

rpm -e --nodeps kernel-headers
rpm -ivh kernel-headers-5.15.85_lts2021_iotg-3.x86_64.rpm 

59. build libvirt(centos)

tobe finished. on centos 7, bad ….

pip3 install --user meson
export PATH=/root/.local/bin:$PATH
yum install -y git libxslt gnutls-devel 
meson build -Dsystem=true -Ddriver_qemu=enabled

? 
meson build -Dsystem=true -Ddriver_qemu=enabled -Ddriver_libvirtd=enabled -Ddriver_remote=enabled -Ddocs=disabled

60. dd speed(nvme)

via:

dd if=/dev/sda of=/root/240GSSD_FLH.img bs=30M status=progress && sync
255873515520 bytes (256 GB, 238 GiB) copied, 1648 s, 155 MB/s
8139+1 records in
8139+1 records out
256060514304 bytes (256 GB, 238 GiB) copied, 1648.91 s, 155 MB/s

61. vg activate

Show the volume uuid of the vg:

[root@ttt ~]# vgs -o vg_name,vg_uuid,pv_uuid
  VG     VG UUID                                PV UUID                               
  centos 2e15nC-l5TX-2hfy-gETN-cDj1-feIR-inF45Q Tfqq5p-otmc-PJ1u-8ySN-vX4v-0xmh-JzOnZg
  centos eShAUV-BMx6-ENXN-9L94-UNVC-PXJT-4bElEb uC9tgf-Jps0-TS9J-tesU-92MJ-J1o3-fa1eE1

Activate via uuid:

[root@ttt ~]#  lvchange -a y --select vg_uuid=eShAUV-BMx6-ENXN-9L94-UNVC-PXJT-4bElEb
[root@ttt ~]#  lvchange -a y --select vg_uuid=2e15nC-l5TX-2hfy-gETN-cDj1-feIR-inF45Q

now mount via:

[root@ttt ~]# mount /dev/mapper/centos-root1  /mnt

62. tips on vacation

https://www.reddit.com/r/VFIO/comments/uh172m/libvirt_82_qemudeviceoverride/
https://github.com/crc-org/crc/issues/2839
https://blog.51cto.com/u_15127621/2763672
https://www.jianshu.com/p/55cf54659e62
https://www.frytea.com/archives/546/#%e7%96%91%e9%9a%be%e8%a7%a3%e5%86%b3
https://www.mail-archive.com/libvir-list@redhat.com/msg226678.html
https://github.com/libvirt/libvirt/tags?after=v8.2.0

63. launch shell script on desktop

via desktop shortcuts:

test@test-VTE510:~$ cat Desktop/start_vm1.desktop 
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Exec=sudo -E /home/test/win10/start_vm1.sh -m 8G -c 2 --audio device=intel-hda,name=hda-audio,timer-period=5000,sink=alsa_output.pci-0000_00_1f.3.hdmi-stereo
#Exec=sh /usr/bin/startvm1
Name=Start vm1
GenericName=Start vm1
Comment=Start vm1 sr-iov gtk
Encoding=UTF-8
Terminal=false
Type=Application
Categories=Application;Network;
test@test-VTE510:~$ cat Desktop/start_vm2.desktop 
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Exec=sudo -E /home/test/win10/start_vm2.sh -m 8G -c 2 --spice display=egl-headless,disable-ticketing=on,port=5002
#Exec=sh /usr/bin/startvm1
Name=Start vm2
GenericName=Start vm2
Comment=Start vm2 sr-iov gtk
Encoding=UTF-8
Terminal=false
Type=Application
Categories=Application;Network;

64. nvidia vgpu

Create :

[root@text mdev_supported_types]# cd /sys/class/mdev_bus/0000\:01\:00.0/mdev_supported_types/
[root@text mdev_supported_types]# echo "638916c5-46ad-4a2f-9248-27b0164efc02">nvidia-232/create
# virsh start win10-rtx2080

65. Installation of 22h2

ignore the login for installing 22h2.

在 Windows 11 的最新版本 22H2 中,微软干掉了“我没有 Internet 连接”按钮,没登陆不让你装系统。有些电脑网卡没有驱动就直接卡在这里了。

此时你可以按下 Shift+F10 打开命令提示符,输入 oobe\BypassNRO.cmd 即可重启进入带有跳过按钮的 OOBE。

66. always restart docker instance

update its property:

docker update --restart=always grafana

67. keepcache in rockylinux

via:

vim /etc/dnf/dnf.conf
add:
keepcache=1

68. meshcommander

via:

https://github.com/Ylianst/MeshCommander

69. find DISPLAY

via:

ls /tmp/.X11-Unix

find the XNumber, where DISPLAY is the number

70. user network

via:

 qemu-system-x86_64 -net nic -net user,hostfwd=tcp::2222-:22 -M q35 -cpu host -smp 4,sockets=1,cores=4,threads=1  -enable-kvm -m 16384 -drive file=/var/lib/libvirt/images/ubuntubuildidv.qcow2

71. openmdtk

download url https://meshcentral.com/info/extra/mdtk/ManageabilityDeveloperToolKit.msi

72. ubuntu2204 static ip

via:

/etc/netplan/00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp89s0:
      addresses:
        - 192.168.1.11/24
      nameservers:
        addresses: [223.5.5.5,180.76.76.76]
      routes:
        - to: default
          via: 192.168.1.33
  version: 2

73. dnf builddep

via:

    yum install -y dnf-plugins-core
    dnf builddep kernel.spec 

74. depmod failed

in fedroa building kernel, just refers to https://www.spinics.net/linux/fedora/fedora-kernel/msg13605.html

75. set default kernel(grubby)

via:

 grubby --info=ALL
 grubby --default-index
 grubby --set-default 1

76. on build rpms

Tips:

1. using dockerimage for building
2. change the kernel.spec and related files in SOURCES FOLDER
3. manually enable btf items. 

77. 4 core vcpu

via:

  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='1'/>
  </cpu>

78. awesome customization

via editing the default theme:

# vim /usr/share/awesome/theme/default/theme.lua
theme.font          = "Consolas 14"

theme.bg_normal     = "#222222"
-- theme.bg_focus      = "#535d6c"
theme.bg_focus      = "#14EEEE"

79. sr-iov items

Information:

https://www.supermicro.com/zh_cn/products/motherboard/H13SAE-MF
its mainboard:   https://www.supermicro.com/manuals/motherboard/H13/MNL-2627.pdf

80. git proxy(socks5)

via:

git config --global http.proxy 'socks5://192.168.1.22:10800'

81. ustc centos repository

via:

sed -e 's|^mirrorlist=|#mirrorlist=|g' \
         -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' \
         -i.bak \
         /etc/yum.repos.d/CentOS-Base.repo

82. install docker on rockylinux

via:

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf install docker-ce docker-ce-cli containerd.io

83. nomachine issue

solved on nvidia machine via:

 $HOME/.nx/config/player.cfg and set the configuration key “Enable hardware accelerated decoding” to “disabled”. 

84. route add -net

via:

route add -net 172.23.0.0/16 gw 192.168.1.33

85. bridge example

via:

idv@idv-VTE510:~$ cd /etc/netplan/
idv@idv-VTE510:/etc/netplan$ ls
01-network-manager-all.yaml  01-network-manager-all.yaml.orig
idv@idv-VTE510:/etc/netplan$ cat 01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: networkd

  ethernets:
    enp1s0:
      dhcp4: false 
      dhcp6: false 

  bridges:
    br0:
      interfaces: [enp1s0]
      addresses: [192.168.1.239/24]
      # gateway4 is deprecated, use routes instead
      routes:
      - to: default
        via: 192.168.1.1
        metric: 100
        on-link: true
      mtu: 1500
      nameservers:
        addresses: [8.8.8.8]
      parameters:
        stp: true
        forward-delay: 4
      dhcp4: no
      dhcp6: no

Thus you will have your br0 setup.

86. qemu tap setup

create a tap0 via:

$ sudo tunctl -t tap0 -u `whoami`
Add tap0 to bridge
$ sudo brctl addif br0 tap0
$ sudo ifconfig tap0 up

Start the qemu instance via adding following guest network setting:

-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01

87. du with hidden directorys

via:

du -hs .[^.]*

88. meson build prefix

via:

meson -Dprefix=/usr ......

89. lxd issue(snapd)

solved via:

apt install libsquashfuse0 squashfuse fuse
apt install snapd

90. pve lxc desktop

via:

https://github.com/mrrudy/proxmoxHelper

91. cuda on ubuntu22.04

Install Steps:

sudo apt-get install linux-headers-$(uname -r)
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb 
sudo apt-get update
sudo apt-get install cuda-toolkit
sudo apt-get install nvidia-gds
sudo reboot

Configure steps:

# cat ~/.bashrc
......
export PATH=/usr/local/cuda-12.3/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Sep__8_19:17:24_PDT_2023
Cuda compilation tools, release 12.3, V12.3.52
Build cuda_12.3.r12.3/compiler.33281558_0

Test steps:

git clone https://github.com/NVIDIA/cuda-samples.git
cd ./cuda-samples/Samples/1_Utilities/deviceQuery
make
./deviceQuery

92. bluetooth headset autodisconnect issue

solved via:

# cat /etc/default/grub
GRUB_CMDLINE_LINUX="btusb.enable_autosuspend=n"
sudo grub-mkconfig -o /boot/grub/grub.cfg
# cat /etc/modprobe.d/disable_autosuspend.conf
    # Disable autosuspend for btusb to make the bluetooth keyboard work again
    options btusb enable_autosuspend=n

Reboot then bluetooth headset runs well.

Examine via:

sudo systool -v -m btusb

93. gradio issue

listen on 0.0.0.0 modification:

Find networking.py in \python_embeded\Lib\site-packages\gradio
adjust :
LOCALHOST_NAME = os.getenv("GRADIO_SERVER_NAME", "0.0.0.0")
AND
server_name = server_name or LOCALHOST_NAME
url_host_name = "localhost" if server_name == "0.0.0.0" else server_name
By
server_name = "192.168.1.10"
url_host_name = "localhost" if server_name == "0.0.0.0" else server_name
192.168.1.10 is your server IP.
it works with Gradio

94. virsh undefine

undefine the vms which contains nvram:

virsh undefine --nvram 

95. disable ipv6 at home

rpi :

# vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

Ubuntu22.04:

# vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
# update-grub2

96. nethogs listening UDP

for:

nethogs -C

97. pypi

pip using tsinghua

pip install -r requirements_versions.txt  -i https://pypi.tuna.tsinghua.edu.cn/simple

98. yay using proxy

Example:

$ export https_proxy=http://192.168.1.194:10809
$ export http_proxy=http://192.168.1.194:10809
$ yay  --sudoflags="http_proxy=http://192.168.1.194:10809 https_proxy=http://192.168.1.194:10809" nomachine

RaspberryPI_PKVM_WorkingTips

Flash aosp 13 images

Image download URL:
https://konstakang.com/devices/rpi4/AOSP13/

Flash it into rpi 4b.

pkvm kernel/images

Download alpine kernel/images from(https://www.worldofgh0st.com/blog/):

https://www.worldofgh0st.com/wp-content/uploads/2022/09/KVM-Linux.zip

adb push them to /data/local/tmp.

Start crosvm machine

adb root and login with adb shell:

➜  Downloads adb -s 192.168.1.114:5555 root 
restarting adbd as root
➜  Downloads adb -s 192.168.1.114:5555 shell
rpi4:/ # 

Start the crosvm vm and examine the vm info:

rpi4:/ # /apex/com.android.virt/bin/crosvm run --disable-sandbox -p 'init=/bin/sh' --rwroot /data/local/tmp/alpine.img /data/local/tmp/kernel.img

..............

/ # uname -a
Linux (none) 5.19.0-13666-gffcf9c5700e4 #3 SMP PREEMPT Sat Sep 3 15:11:04 PDT 2022 aarch64 Linux
/ # cat /etc/issue
Welcome to Alpine Linux 3.16
Kernel \r on an \m (\l)

Customize Kernel

In an arm64 server, clone the latest kernel and compile Image:

# apt install build-essential flex bison libssl-dev -y
# git clone  git://mirrors.ustc.edu.cn/linux.git
# cd linux
# make defconfig
# make -j128
# ls arch/arm64/boot
dts  Image  Image.gz  install.sh  Makefile

Transfer the Image to rpi4’s /data/local/tmp/

Customize Ubuntu20.04 rootfs

Get the latest aarch64 image and change the corresponding items:

# axel https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-arm64-root.tar.xz
# qemu-img create -f raw ubuntu.img 6G
# mkfs.ext4 ubuntu.img
# mount ubuntu.img /mnt
# tar xJvf ubuntu-20.04-server-cloudimg-arm64-root.tar.xz -C /mnt/
# cd /mnt
# touch etc/cloud/cloud-init.disabled
# vim etc/passwd
Change the first line :   
root::0:0:root:/root:/bin/bash
# umount /mnt

Transfer the ubuntu.img onto the rpi4’s /data/local/tmp/

Start ubuntu vm

Start via:

# /apex/com.android.virt/bin/crosvm run --disable-sandbox -p 'root=/dev/vda' --rwroot /data/local/tmp/ubuntu.img /data/local/tmp/Image

Examine the vm info:

root@ubuntu:~# uname -a
Linux ubuntu 6.0.0-rc4-00062-g0066f1b0e275 #1 SMP PREEMPT Thu Sep 8 01:24:14 EDT 2022 aarch64 aarch64 aarch64 GNU/Linux
root@ubuntu:~# cat /etc/issue
Ubuntu 20.04.4 LTS \n \l

root@ubuntu:~# free -m
              total        used        free      shared  buff/cache   available
Mem:            221          88          17           0         115         127
Swap:             0           0           0
root@ubuntu:~# cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

WorkingTipsOnUpgradingSG1DriverCentOS1810.qcow2

VM

Import new image:

/images/2022_08_29_10_25_29_498x422.jpg

Name it:

/images/2022_08_29_10_26_09_467x332.jpg

Upgrade kernel to 4.19.12:

$ ls
kernel-4.19.12-1.x86_64.rpm  kernel-devel-4.19.12-1.x86_64.rpm  kernel-headers-4.19.12-1.x86_64.rpm  kmod-ukmd-4.19.12-20212.el7.x86_64.rpm
$ rpm -ivh *.rpm
$ vi /etc/default/grub
Changed to 4.19.12 kernel
$ grub2-mkconfig -o /boot/grub2/grub.cfg 
$ sudo reboot

Change the repository using iso:

# mount /dev/sr0 /mnt
# cat /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
# yum makecache

Using official install-sg1.sh for installing to 4.19.112 kernel for fetching the dependencies.

Merge steps

安装官方驱动的过程中会编译出相应的文件,需要按照以下步骤进行更改:

# mkdir /root/merge
# cp /root/rpmbuild/SRPMS/kmod-ukmd-4.19.112-20413.el7.centos.src.rpm /root/merge
# cd /root/merge
# mkdir kmod-ukmd-4.19.12.cpio
# cd kmod-ukmd-4.19.12.cpio
# rpm2cpio ../kmod-ukmd-4.19.112-20413.el7.centos.src.rpm | cpio -idmv
# ls
dg1_dmc_ver2_02.bin  dg1_guc_49.0.1.bin  dg1_huc_7.9.5.bin  kmod.spec  kmod-ukmd-4.19.112.tar.gz
# tar xzvf kmod-ukmd-4.19.112.tar.gz
# mv kmod-ukmd-4.19.112 kmod-ukmd-4.19.12
# vim kmod.spec 
Change 4.19.112->4.19.12
# vim kmod-ukmd-4.19.12/kmod.spec
Change 4.19.112->4.19.12
# cp /usr/src/kernels/4.19.12/drivers/gpu/drm/drm_edid.c kmod-ukmd-4.19.12/orig/drivers/gpu/drm/
# cp /usr/src/kernels/4.19.12/drivers/gpu/drm/drm_probe_helper.c kmod-ukmd-4.19.12/orig/drivers/gpu/drm/
# cp /usr/src/kernels/4.19.12/drivers/gpu/drm/drm_vblank.c kmod-ukmd-4.19.12/orig/drivers/gpu/drm/
# mv kmod-ukmd-4.19.112.tar.gz /tmp
# tar czvf kmod-ukmd-4.19.12.tar.gz kmod-ukmd-4.19.12
# rm -rf kmod-ukmd-4.19.12
# ls
dg1_dmc_ver2_02.bin  dg1_guc_49.0.1.bin  dg1_huc_7.9.5.bin  kmod.spec  kmod-ukmd-4.19.12.tar.gz
# cd ..
# tar czvf kmod-ukmd-4.19.12.cpio.tar.gz kmod-ukmd-4.19.12.cpio
# ls
kmod-ukmd-4.19.112-20413.el7.centos.src.rpm  kmod-ukmd-4.19.12.cpio  kmod-ukmd-4.19.12.cpio.tar.gz
# mv /root/rpmbuild/SOURCES/ /root/rpmbuild/SOURCES.back && mkdir -p /root/rpmbuild/SOURCES/
# cp -ar /root/merge/kmod-ukmd-4.19.12.cpio/* /root/rpmbuild/SOURCES
# cd /root/rpmbuild/SOURCES
# vim /usr/src/kernels/4.19.12/include/linux/math64.h
在文件末尾倒数第二行添加
.....
    #endif /* mul_u64_u32_div */
    +++++ #define DIV64_U64_ROUND_UP(ll, d)	\
    +++++	({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); })
    
    #endif /* _LINUX_MATH64_H */

# rpmbuild -bb kmod.spec
# ls /root/rpmbuild/RPMS/x86_64
kmod-ukmd-4.19.12-20413.el7.centos.x86_64.rpm

Verification

Install any 4.19.12 kernel, test the package kmod-ukmd-4.19.12-20413.el7.centos.x86_64.rpm.

$ ls /dev/dri/
card0  renderD128
$ lsmod | grep i915
i915_spi               20480  0 
mtd                    57344  5 i915_spi
i915                 1933312  0 
drm_ukmd_kms_helper   188416  1 i915
drm_ukmd              495616  3 drm_ukmd_kms_helper,i915
drm_ukmd_compat        98304  3 drm_ukmd_kms_helper,i915,drm_ukmd
video                  40960  1 i915
i2c_algo_bit           16384  1 i915
cec                    45056  1 i915
mfd_core               16384  2 lpc_ich,i915

Examine the kernel demsg:

$ sudo dmesg | grep drm
[sudo] password for ctctest: 
[    7.776406] drm: loading out-of-tree module taints kernel.
[    7.800836] Initialized drm/i915 compat module 20160105
[    7.892916] [drm] i915 backporting
[    7.893701] [drm] Intel graphics LMEM: [mem 0x00000000-0x1fb7fffff]
[    7.893702] [drm] Intel graphics LMEM IO start: a00000000
[    7.893702] [drm] Intel graphics LMEM size: 1fb800000
[    7.893714] [drm] Intel graphics stolen LMEM: [mem 0x1fc000000-0x1ffffffff]
[    7.893714] [drm] Intel graphics stolen LMEM IO start: bfc000000
[    7.895015] i915 0000:07:00.0: [drm] Couldn't get system memory bandwidth
[    7.895053] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    7.895054] [drm] Driver supports precise vblank timestamp query.
[    7.971850] i915 0000:07:00.0: [drm] Finished loading DMC firmware i915/dg1_dmc_ver2_02.bin (v2.2)
[    7.994442] [drm] GuC communication enabled
[    7.999403] i915 0000:07:00.0: [drm] GuC firmware i915/dg1_guc_49.0.1.bin version 49.0 submission:disabled
[    7.999405] i915 0000:07:00.0: [drm] HuC firmware i915/dg1_huc_7.9.5.bin version 7.9 authenticated:yes
[    8.001958] [drm] Initialized i915 1.6.0 20220718-8a58be7 for 0000:07:00.0 on minor 0
[    8.003950] i915 0000:07:00.0: [drm] Cannot find any crtc or sizes

BenchmarkOnSG1

Start the redroid via:

# docker run -itd --name redroid4cores --memory-swappiness=0 --privileged   -p 5556:5555 --cpuset-cpus 0-3 -v /root/cpus/present:/sys/devices/system/cpu/present -v /root/cpus/online:/sys/devices/system/cpu/online -v /root/cpus/possible:/sys/devices/system/cpu/possible redroid12:latest redroid.fps=120 ro.sf.lcd_density=240 redroid.width=1080 redroid.height=1920 redroid.gpu.mode=host redroid.gpu.node=/dev/dri/renderD128 androidboot.use_memfd=1
fe847de1c10fd9f28a358257b1c90c22884535a6d14c8867136bceea77cf140c
root@ctctest-UniServer-R4900-G3:~# docker exec -it redroid4cores sh
fe847de1c10f:/ # setprop sys.use_memfd 1 

/images/2022_08_26_11_10_15_585x711.jpg

Remove the other 3 socs:

# rm -rf /dev/dri/renderD129 /dev/dri/renderD130 /dev/dri/renderD131 
# rm -rf /dev/dri/card1 /dev/dri/card2 /dev/dri/card3

Rerun the benchmark, still the same:

/images/2022_08_26_11_17_06_590x521.jpg

Remove the device:

# echo 1 > /sys/bus/pci/devices/0000:b8:00.0/remove
# echo 1 > /sys/bus/pci/devices/0000:c2:00.0/remove
# echo 1 > /sys/bus/pci/devices/0000:bd:00.0/remove

System hang.

Using udev for removing the socs:

# cat /etc/udev/rules.d/removesg1.rules 
ACTION=="add", KERNEL=="0000:b8:00.0", SUBSYSTEM=="pci", RUN+="/bin/sh -c 'echo 1 > /sys/bus/pci/devices/0000:b8:00.0/remove'"
ACTION=="add", KERNEL=="0000:bd:00.0", SUBSYSTEM=="pci", RUN+="/bin/sh -c 'echo 1 > /sys/bus/pci/devices/0000:bd:00.0/remove'"
ACTION=="add", KERNEL=="0000:c2:00.0", SUBSYSTEM=="pci", RUN+="/bin/sh -c 'echo 1 > /sys/bus/pci/devices/0000:c2:00.0/remove'"

Examine the graphical cards:

# lspci | grep -i vga
0000:05:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 41)
0000:b3:00.0 VGA compatible controller: Intel Corporation Device 4907 (rev 01)

render nodes:

# ls /dev/dri/
by-path  card0  renderD128
# ls /dev/dri/by-path/ -l
total 0
lrwxrwxrwx 1 root root  8 8月  26 11:49 pci-0000:b3:00.0-card -> ../card0
lrwxrwxrwx 1 root root 13 8月  26 11:49 pci-0000:b3:00.0-render -> ../renderD128

Rerun the testing:

/images/2022_08_26_11_57_38_588x761.jpg

Another machine

/images/2022_08_26_12_21_46_584x203.jpg

Turbo boost mode(avd) comparision:

non-turbo boost

/images/2022_08_26_12_35_07_372x255.jpg

turbo boost(sg1):

/images/2022_08_26_12_41_30_373x417.jpg

Turbo boot (t4):

/images/2022_08_26_12_48_07_525x494.jpg

vnc(best perf mode):

/images/2022_08_26_15_00_35_589x281.jpg

no vnc(best perf mode), no scrcpy:

/images/2022_08_26_15_06_44_595x985.jpg

scrcpy with 15fps:

/images/2022_08_26_15_22_06_528x261.jpg

scrcpy with 5fps:

/images/2022_08_26_15_27_03_528x285.jpg

no scrcpy again:

/images/2022_08_26_15_31_56_534x261.jpg

t4 with scrcpy:

/images/2022_08_26_15_39_49_1029x473.jpg

ampere t4 with scrcpy:

/images/2022_08_26_15_49_37_480x918.jpg

Performance:

cpupower frequency-set -g performance

ampere t4 without scrcpy:

/images/2022_08_26_16_58_06_469x380.jpg

should upgrade to oibaf? upgrading to stable.

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade

Next week, upgrading to 5.19.3

Even on 5.19.3, benchmark is very bad:

/images/2022_08_29_11_37_21_502x253.jpg

SG1OnArchLinux2

Installation

After install arch system, install packages:

# pacman -S gnome libva-mesa-driver  mesa-demos mesa-utils mesa-vdpau opencl-mesa vulkan-intel vulkan-mesa-layers vulkan-radeon adriconf awesome x11vnc net-tools

List all of the sg socs:

# lspci | grep -i vga
0000:05:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 41)
0000:b3:00.0 VGA compatible controller: Intel Corporation SG1 [Server GPU SG-18M] (rev 01)
0000:b8:00.0 VGA compatible controller: Intel Corporation SG1 [Server GPU SG-18M] (rev 01)
0000:bd:00.0 VGA compatible controller: Intel Corporation SG1 [Server GPU SG-18M] (rev 01)
0000:c2:00.0 VGA compatible controller: Intel Corporation SG1 [Server GPU SG-18M] (rev 01)

List all of the render nodes:

# ls /dev/dri/
by-path  card0	card1  card2  card3  card4  renderD128	renderD129  renderD130	renderD131
# ls /dev/dri/by-path/ -l
lrwxrwxrwx 1 root root  8 Aug 25 08:30 pci-0000:05:00.0-card -> ../card0
lrwxrwxrwx 1 root root  8 Aug 25 08:30 pci-0000:b3:00.0-card -> ../card1
lrwxrwxrwx 1 root root 13 Aug 25 08:30 pci-0000:b3:00.0-render -> ../renderD128
lrwxrwxrwx 1 root root  8 Aug 25 08:30 pci-0000:b8:00.0-card -> ../card2
lrwxrwxrwx 1 root root 13 Aug 25 08:30 pci-0000:b8:00.0-render -> ../renderD129
lrwxrwxrwx 1 root root  8 Aug 25 08:30 pci-0000:bd:00.0-card -> ../card3
lrwxrwxrwx 1 root root 13 Aug 25 08:30 pci-0000:bd:00.0-render -> ../renderD130
lrwxrwxrwx 1 root root  8 Aug 25 08:30 pci-0000:c2:00.0-card -> ../card4
lrwxrwxrwx 1 root root 13 Aug 25 08:30 pci-0000:c2:00.0-render -> ../renderD131

Benchmark

Create xorg:

[root@archsg1 ~]# cat /etc/X11/xorgintel.conf 
Section "Device"
    Identifier     "Device[179]"
    #BusID          "PCI:0@0:179:0"
    BusID          "PCI:179:0:0"
    VendorName     "Intel"
    BoardName      "DG1"
#    Option "AllowEmptyInitialConfiguration"
EndSection
Section "ServerFlags"
    Option "Debug" "dmabuf_capable"
EndSection
# Xorg :179 -config /etc/X11/xorgintel.conf

glmark2:

# export DISPLAY=:179
[root@archsg1 ~]# glmark2
=======================================================
    glmark2 2021.12
=======================================================
    OpenGL Information
    GL_VENDOR:     Intel
    GL_RENDERER:   Mesa Intel(R) Graphics (SG1)
    GL_VERSION:    4.6 (Compatibility Profile) Mesa 22.1.6
=======================================================
[build] use-vbo=false: FPS: 1825 FrameTime: 0.548 ms
[build] use-vbo=true: FPS: 2154 FrameTime: 0.464 ms
[texture] texture-filter=nearest: FPS: 2132 FrameTime: 0.469 ms
[texture] texture-filter=linear: FPS: 2150 FrameTime: 0.465 ms
[texture] texture-filter=mipmap: FPS: 2155 FrameTime: 0.464 ms
[shading] shading=gouraud: FPS: 2047 FrameTime: 0.489 ms
[shading] shading=blinn-phong-inf: FPS: 2044 FrameTime: 0.489 ms
[shading] shading=phong: FPS: 2041 FrameTime: 0.490 ms
[shading] shading=cel: FPS: 2040 FrameTime: 0.490 ms
[bump] bump-render=high-poly: FPS: 1753 FrameTime: 0.570 ms
[bump] bump-render=normals: FPS: 2252 FrameTime: 0.444 ms
[bump] bump-render=height: FPS: 2248 FrameTime: 0.445 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 1774 FrameTime: 0.564 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 1764 FrameTime: 0.567 ms
[pulsar] light=false:quads=5:texture=false: FPS: 1880 FrameTime: 0.532 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 1221 FrameTime: 0.819 ms
[desktop] effect=shadow:windows=4: FPS: 1425 FrameTime: 0.702 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 384 FrameTime: 2.604 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 1136 FrameTime: 0.880 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 481 FrameTime: 2.079 ms
[ideas] speed=duration: FPS: 1672 FrameTime: 0.598 ms
[jellyfish] <default>: FPS: 1423 FrameTime: 0.703 ms
[terrain] <default>: FPS: 435 FrameTime: 2.299 ms
[shadow] <default>: FPS: 1719 FrameTime: 0.582 ms
[refract] <default>: FPS: 924 FrameTime: 1.082 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 1906 FrameTime: 0.525 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 1904 FrameTime: 0.525 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 1904 FrameTime: 0.525 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 1905 FrameTime: 0.525 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 1903 FrameTime: 0.525 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 1903 FrameTime: 0.525 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 1904 FrameTime: 0.525 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 1902 FrameTime: 0.526 ms
=======================================================
                                  glmark2 Score: 1706 
=======================================================

Kernel change

Building kernel will takes more than 30 minutes….. Before makepkg, change the -j items in order to use maximum hardware capability.
Install asp for building kernel:

# pacman -S base-devel asp
# asp checkout linux-zen
# vim repos/extra-x86_64/config
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"

# cd repos/extra-x86_64
$ ls
config  keys  PKGBUILD
$ makepkg --clean --syncdeps --rmdeps

Docker binding cpus

Create the cpu cores definition file:

[root@archsg1 cpus]# cp present possible
[root@archsg1 cpus]# cp present online
[root@archsg1 cpus]# cat present 
0-3

Run with:

docker run -itd --name redroid4cores --memory-swappiness=0 --privileged   -p 5556:5555 --cpuset-cpus 0-3 -v /root/cpus/present:/sys/devices/system/cpu/present -v /root/cpus/online:/sys/devices/system/cpu/online -v /root/cpus/possible:/sys/devices/system/cpu/possible redroid12:latest redroid.fps=120 ro.sf.lcd_density=240 redroid.width=1080 redroid.height=1920 redroid.gpu.mode=host redroid.gpu.node=/dev/dri/renderD128 androidboot.use_memfd=1

with lxcfs:

 docker run -itd --name numa1 --memory-swappiness=0 --privileged   -p 5557:5555 -m 8192m --cpus=8 --cpuset-cpus="80-87" --cpuset-mems="1" --memory="8192M" -v /root/cpus1/present:/sys/devices/system/cpu/present -v /root/cpus1/online:/sys/devices/system/cpu/online -v /root/cpus1/possible:/sys/devices/system/cpu/possible -v /var/lib/lxcfs/proc/cpuinfo:/proc/cpuinfo:rw -v /var/lib/lxcfs/proc/diskstats:/proc/diskstats:rw  -v /var/lib/lxcfs/proc/meminfo:/proc/meminfo:rw -v /var/lib/lxcfs/proc/uptime:/proc/uptime:rw -v /var/lib/lxcfs/proc/stat:/proc/stat:rw redroid12:latest redroid.fps=120 ro.sf.lcd_density=240 redroid.width=1080 redroid.height=1920 redroid.gpu.mode=host redroid.gpu.node=/dev/dri/renderD130 androidboot.use_memfd=1

Limite memory:

root@sg1desktopubuntu2004:~# free -g
              total        used        free      shared  buff/cache   available
Mem:             60           7          52           0           0          52
Swap:             1           0           1
root@sg1desktopubuntu2004:~# cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-5.19.3-051903-generic root=UUID=c255524f-5692-457c-a0b6-d465e0b32707 ro quiet splash i915.force_probe=* modprobe.blacklist=ast,snd_hda_intel i915.enable_guc=2 drm_kms_helper.edid_firmware=edid/1920x1080.bin video=HDMI-A-1:e video=HDMI-A-5:e video=HDMI-A-9:e video=HDMI-A-13:e mem=65535M