关于Linux上DST,饥荒,Don’t Starve Together MOD打不上,不下载的问题

因为dedicated_server_mods_setup.lua内容会被重置

如果使用的的是别人写的run_dedicated_servers.sh

其中

1
./steamcmd.sh +force_install_dir "$install_dir" +login anonymous +app_update 343050 validate +quit

在validate之后会重置dedicated_server_mods_setup.lua的内容,所以dst读不到

所以可以在steam更新及验证之后,dontstarve_dedicated_server_nullrenderer_x64启动之前,加上一句

1
2
#备份一下你的dedicated_server_mods_setup.lua
cp -f "$HOME/dedicated_server_mods_setup.lua" "$install_dir/mods"

SMI-S 模拟器

网上的水的论文不少,实际项目没看到,于是搞了一下,希望能有所参考

tog-pegasus

yum源里也有rpm,但release版隐藏我们需要的一个功能开关,这里我们自己编译

https://github.com/OpenPegasus/OpenPegasus

采用了rpmbuild方式,同时做了一些修改

  • tog-pegasus.spec: Version+1
  • tog-pegasus.spec: PEGASUS_REPOSITORY_DIR/PEGASUS_VARDATA_CACHE_DIR 移到了postun,否则yum remove时会报一堆repository找不到
  • rpm/wbem-redhat => rpm/wbem: 这个是pam验证的,根据自己系统的情况修改,装完再改/etc/pam.d/wbem也行
  • env_var_Linux.status: PEGASUS_USE_RELEASE_CONFIG_OPTIONS=false 以启用repositoryIsDefaultInstanceProvider等配置项

准备好tar.gz和相关重命名,然后编译rpmbuild -bb tog-pegasus.spec,rpm在rpmbuild/RPMS下,然后使用yum localinstall xxx安装

/etc/Pegasus/access.conf,wbemNetwork中去掉了root,禁止root账号远程登录

yum完跑以下命令

1
2
3
4
5
6
7
8
9
10
/usr/share/Pegasus/scripts/genOpenPegasusSSLCerts           // 生成证书
cimserver // 先开启一下进行一些配置
cimconfig -s enableHttpConnection=true -p // 启用HTTP
cimconfig -s repositoryIsDefaultInstanceProvider=true -p // 关键!省去了我们写Provider
cimconfig -s enableAuthentication=true -p // 开启认证登录
cimserver -s // 关闭重开以生效
useradd -g pegasus smissim // PAM登录的话,走的就是系统的账号
// 把要登录的账号放到pegasus组,相关组配置在access.conf
passwd smissim // 来个密码
cimserver // 启动

Class & Instance

由于开启了repositoryIsDefaultInstanceProvider,使得我们可以不用编写Provider,而对Class具有Create / Get / Enumerate操作

相关说明和更多配置见项目的doc/BuildAndReleaseOptions.html

instance以xxx.idx和xxx.instances文件的方法在于在[namespace]/instances/下

添加时只需cimmof -n[namespace] -aEV xxx.mof

提示没有相关qualifiers就去其它namespace下copy一堆来

Tips

给想进一步写Provider的一些tips

  • provider只能注册在PEGASUS_INTEROP_NAMESPACE下,一般可能为: root/PG_InterOp 或者 root/interop 或者 interop

所以要注意注册provider时的cimmof -n参数

  • create出来的instance都是浮云

REF http://cvs.opengroup.org/pegasus-doc/CIMProvider.html

virtual void initialize(CIMOMHandle & cimom) = 0
Performs any setup required before normal operation of the provider.
The initialize() function allows the provider to conduct the necessary preparations to handle requests. The initialize function is called only once during the lifetime of the provider. Note, however, that with the Pegasus automatic unload function enabled, a provider many be unloaded and loaded many times during one cycle of the CIMOM. This function must complete before the CIM server invokes any other function of the provider, other than terminate.

virtual void terminate(void) = 0
Performs any cleanup required before termination.
The terminate function allows the provider to conduct the necessary preparations for termination. This function may be called by the CIM Server at any time, including initialization. Once invoked, no other provider functions are invoked until after a call to initialize.

如果你create出来的东西没有存在什么地方,provider.so是会被随时unload再load的,所以_instances中的实例不是持久的

可以参考在项目在SDK/samples/Providers/DefaultC++/InstanceProvider中给出的例子

因为initialize方法总是会在其它方法调用前执行

Linux下

1
2
3
4
5
6
7
8
9
10
11
wmic -U [user]%[pass] //[IP] "select Name,PNPDeviceID from Win32_VideoController"
DeviceID|Name|PNPDeviceID
VideoController1|NVIDIA GeForce GTX 1660 SUPER|PCI\VEN_10DE&DEV_21C4&SUBSYS_13D310B0&REV_A1\4&945BE43&0&00E6
VideoController2|NVIDIA GeForce GTX 1660 SUPER|PCI\VEN_10DE&DEV_21C4&SUBSYS_13D310B0&REV_A1\4&20EA873F&0&00E4
VideoController3|NVIDIA GeForce RTX 3080|PCI\VEN_10DE&DEV_2206&SUBSYS_404B1458&REV_A1\4&3081E79F&0&00E3
VideoController4|NVIDIA GeForce GTX 1660 SUPER|PCI\VEN_10DE&DEV_21C4&SUBSYS_13D310B0&REV_A1\4&D1659EC&0&00E2
VideoController5|NVIDIA GeForce GTX 1660 SUPER|PCI\VEN_10DE&DEV_21C4&SUBSYS_13D310B0&REV_A1\4&121866D4&0&00E0
VideoController6|NVIDIA GeForce RTX 3080|PCI\VEN_10DE&DEV_2206&SUBSYS_404B1458&REV_A1\4&651A21D&0&00E7
VideoController7|NVIDIA GeForce RTX 3080|PCI\VEN_10DE&DEV_2206&SUBSYS_404B1458&REV_A1\4&2810674&0&00E1
VideoController8|Intel(R) HD Graphics|PCI\VEN_8086&DEV_0402&SUBSYS_04028086&REV_06\3&11583659&0&10
VideoController9|NVIDIA GeForce RTX 3080|PCI\VEN_10DE&DEV_2206&SUBSYS_404B1458&REV_A1\4&34528348&0&00E5

通过wmic采集Win32_VideoController的PNPDeviceID

我们关注VEN_10DE&DEV_21C4&SUBSYS_13D310B0这部分

  • VEN_XXXX,这四位是Vendor ID,10DE 表示 NVIDIA Corporation
  • DEV_XXXX,这四位是Device ID,21C4 表示 TU116 [GeForce GTX 1660 SUPER]

参考: https://devicehunt.com/view/type/pci/vendor/10DE

  • SUBSYS_XXXXYYYY中,YYYY这四位是制造商Vendor ID,10B0 表示 Gainward Technology Int’l Limited

参考: https://pcisig.com/membership/member-companies?combine=10B0

GPU-Z的Subvendor查询也是依赖于此

顺便也把PCI-SIG上的数据抓了一份,方便大家使用

pcisig.csv

Linux Fuck Windows

开一个Linux监控Windows系列的大坑

先从不同版本的winexe搞起

Winexe 0.80

这里选择的代码是 https://github.com/greenbone/openvas-smb

原因是最近还有在更新

1
[/root/test/openvas-smb-21.4.0/winexe/winexe.c:90:parse_args()] winexe version 0.80

编译

分别记录一下Fedora和CentOS7两种系统下的编译过程

搞了两套是因为

  • CentOS7的EPEL源移除了mingw相关的包
  • 在Fedora上编译完之后要迁往CentOS7,要同时迁移N多依赖,也很不方便

先说一下共有问题

No package ‘heimdal-gssapi’ found

dnf/yum出来的heimdal-devel不支持pkgconfig,后续许多操作都很麻烦,建议按下面的方法自己先compile一个

https://community.greenbone.net/t/full-gvm-11-build-guide-for-centos-8/5425

1
2
3
4
5
6
7
./configure --enable-otp=no --prefix=/opt/heimdal
make && make install

echo "/opt/heimdal/lib" > /etc/ld.so.conf.d/heimdal-xxx.conf
ldconfig

export PKG_CONFIG_PATH=/opt/heimdal/lib/pkgconfig

ld -ltspi

ld问题参考 https://www.hbspy.moe/2021/06/07/ld_cannot_find/

1
ln -s /usr/lib64/libtspi.so.1 /usr/lib64/libtspi.so

Fedora 编译

mingw can no longer be found in the Centos 7 EPEL Repository See bugzilla.redhat.com/show_bug.cgi?id=1807975 and pagure.io/fesco/issue/2333

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
yum install gcc cmake pkg-config mingw64-gcc gnutls-devel \
perl-base popt-devel glib2-devel \
libunistring-devel krb5-devel

yum install mingw32-gcc-c++ \
mingw32-gcc \
mingw32-pthreads \
mingw32-w32api \
mingw32-binutils \
mingw32-runtime \
mingw32-filesystem \
mingw32-cpp \
mingw32-dlfcn-static

mkdir build
cd build
cmake ..
make && make install

https://wiki.videolan.org/Win32Compile_Under_Fedora/

CentOS7 编译

CentOS7多一个popt的问题,类似heimdal,也是yum出来的包不支持pkgconfig

参照heimdal的处理自己先compile一个

1
2
3
4
5
6
7
8
./autogen.sh
./configure --prefix=/opt/popt
make && make install

echo "/opt/popt/lib/" > /etc/ld.so.conf.d/popt.conf
ldconfig

export PKG_CONFIG_PATH=/opt/popt/lib/pkgconfig

主要需要搞定mingw的问题

这里分享一个可用的repo: https://copr.fedorainfracloud.org/coprs/alonid/mingw-epel7/

使用的时候需要只enable它,yum install --disablerepo=* --enablerepo=mingw-epel7 xxx

常见问题

NT_STATUS_IO_TIMEOUT

  1. 一种可能是0.80似乎只支持SBMv1

smb1protocol

https://docs.microsoft.com/zh-cn/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3

顺便分享一些远程安装启用的命令

是在Windows下使用的

首先利用SysinternalsSuite包中提供的PsExec拉Dism,用WMIC process call create应该也行

NOTE 这里加了/NoRestart,主要是由于Dism提供的重启不够强力,可能造成卡住

后面用WMIC shutdown -r -f强制重启

1
2
.\PsExec.exe \\[IP] -u [user] -p [passwd] Dism /online /Enable-Feature /FeatureName:smb1protocol /NoRestart /ALL
wmic /node:[IP] /user:[user] /password:[passwd] process call create "shutdown -r -f -t 0"
  1. 另一种可能的原因是防火墙

可以查看目前网络配置文件是公用还是专用。如果是公用,进一步查看是否开启了公用网络的防火墙

可以考虑直接切换到专用,关闭或配置专用网络的防火墙规则

本机上的system32目录内容与winexe cmd.exe dir出来的不一致

这是一个32-bit/64-bit问题

winexe新一点的版本会有[–ostype=0|1|2]选项,来指定x86/x64

可以通过echo %programfiles%看判断

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
C:\Windows\system32>echo %programfiles%
echo %programfiles%
C:\Program Files (x86)

C:\Windows\system32>dir nv*

2020/10/13 16:40 5,972,824 nvapi.dll
2020/10/13 16:42 4,174,064 nvcuda.dll
2020/10/13 16:42 6,860,184 nvcuvid.dll
2020/10/13 16:42 657,304 nvEncodeAPI.dll
2020/10/13 16:42 1,585,560 NvFBC.dll
2020/10/13 16:43 1,161,112 NvIFR.dll
2020/10/13 16:43 555,248 NvIFROpenGL.dll
2020/10/13 16:43 543,128 nvofapi.dll
8 21,509,424
0 ¼ 55,284,584,448

这里%programfiles%会被认为是 (x86)

没有nvidia-smi.exe

我们可以直接拉"c:\windows\sysnative\cmd.exe"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
C:\Windows\system32>echo %programfiles%
echo %programfiles%
C:\Program Files

C:\Windows\system32>dir nv*

2020/10/13 16:41 7,001,536 nvapi64.dll
2020/10/13 16:42 5,519,600 nvcpl.dll
2020/10/13 16:42 2,508,528 nvcuda.dll
2020/10/13 16:42 7,707,544 nvcuvid.dll
2020/10/13 16:42 445,848 nvdebugdump.exe
2020/10/13 16:42 813,464 nvEncodeAPI64.dll
2020/10/13 16:43 2,098,072 NvFBC64.dll
2020/10/13 16:43 589,208 nvidia-smi.exe
2020/10/13 16:43 1,507,224 NvIFR64.dll
2020/10/13 16:43 670,616 NvIFROpenGL.dll
2020/10/01 15:14 80,930 nvinfo.pb
2020/10/13 16:43 816,368 nvmcumd.dll
2020/10/13 16:43 1,023,216 nvml.dll
2020/10/13 16:43 673,520 nvofapi64.dll
14 31,455,674
0 ¼ 55,284,584,448

这样就正常了

参考 https://ss64.com/nt/syntax-64bit.html

LD 找不到 -l问题的统一解决

/usr/bin/ld: cannot find -l
collect2: error: ld returned 1 exit status

1
ld -l<xxx> --verbose

/usr/bin/ld: cannot find -lhdb

1
2
3
4
5
6
7
8
9
ld -lhdb --verbose
...
attempt to open /usr/lib64/libhdb.so failed
attempt to open /usr/lib64/libhdb.a failed
attempt to open /usr/local/lib64/libhdb.so failed
attempt to open /usr/local/lib64/libhdb.a failed
attempt to open /lib64/libhdb.so failed
attempt to open /lib64/libhdb.a failed
...

可以看到ld在尝试从哪些地方寻找所需的文件

然后就方面通过文件名判断该安装什么包或者做软连接

1
2
3
4
5
6
locate libhdb
/usr/lib64/heimdal/libhdb.a
/usr/lib64/heimdal/libhdb.so
/usr/lib64/heimdal/libhdb.so.9
/usr/lib64/heimdal/libhdb.so.9.2.0
ln -s /usr/lib64/heimdal/libhdb.so /usr/lib64/libhdb.so

参考代码:https://github.com/HBSpy/music163

FLAC to ALAC

1
ffmpeg -i input.flac -acodec alac -vn output.m4a

从云音乐获取的FLAC有时封面会有问题

1
2
3
4
5
6
7
8
9
[mjpeg @ 0x227f2c0] bits 223 is invalid
[flac @ 0x227c400] decoding for stream 1 failed
[flac @ 0x227c400] Could not find codec parameters for stream 1 (Video: mjpeg, none(bt470bg/unknown/unknown), lossless): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options

...

Automatic encoder selection failed for output stream #0:0. Default encoder for format ipod (codec h264) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:0

这里使用-vn去掉封面图片,后续再通过其它方式添加

添加封面

封面图片获取

云音乐的FLAC备注中有163 key(Don’t modify):xxx,可以解密得出JSON

  • 算法: AES-128-ECB
  • KEY: #14ljk_!]&0U<'(

从albumPic字段获取封面图片地址

iTunes可识别的封入封面图片

到目前为止,直接使用ffmpeg封入封面,iTunes还是不能识别的

有给视频添加Cover的方式

1
ffmpeg -i input.m4a -i image.jpg -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.m4a

但iTunes是识别不了的

目前使用AtomicParsley封入封面,https://github.com/wez/atomicparsley

1
./AtomicParsley output.m4a --artwork cover.jpg

–overWrite 参数有些编译版本似乎没有,手动重命名吧

我们记录,我们监控,我们管理

不做事,不BB

Problem

使用composer require 本地GitLab中的项目,会把.git文件夹一块拉进来,从而在commit的时候报子项目问题

Cause

在配置composer repositories时,type使用的是git,则在提取时,等同于git clone,则会连着.git一起clone下来

正确的方法应该是参考 https://docs.gitlab.com/ee/user/packages/composer_repository/

发布时

  1. 在项目中composer init 来生成composer.json
  2. 发布一个release或打一个tag
  3. 通过API发布Composer package,这一步需要access token

成功后会在项目的Package Registry的菜单下看到他

安装时

  1. 在Package Registry点详情进去也会看到相关命令
1
composer config repositories.<group_id> composer https://gitlab.example.com/api/v4/group/<group_id>/-/packages/composer/
  1. 需要设置access token,推荐–global,不然会在项目中留下auth.json,不宜提交
  2. 需要设置gitlab-domains
1
composer config gitlab-domains <你的GitLab地址>
  1. 如果你的GitLab是HTTP,还需要设置"secure-http": false
  2. composer require 你的包

对于Linux命令参数中被误解析成-xxx的参数问题,如

1
2
[root@HBSpy extreme]# rename -mib
rename: invalid option -- 'm'

可以在参数前加–

1
[root@HBSpy extreme]# rename -- -mib .mib extreme-*

参考: https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean

More precisely, a double dash (–) is used in most bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted.
Example use: lets say you want to grep a file for the string -v - normally -v will be considered the option to reverse the matching meaning (only show lines that do not match), but with – you can grep for string -v like this:
grep – -v file

0%