switch between shell and anaconda in serial console

as are indicated at the bottom of the console, there are 5 windows in anaconda, we can toggle any of them by press:

<Ctrl> + <b> + <window number>

in a tmux style.

refer to:
https://docs.centos.org/en-US/centos/install-guide/Trouble-x86/
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-consoles-logs-during-installation-x86

automatic disk performance test

mkdir like test_case1, copy three files below in it:

test_case1/test.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/python3
import os
 
def shell_run(name, cmd):
	os.system('mkdir result')
	os.system(cmd + '> ./result/' + name)
 
def run_cmds(cmds):
	for name, cmd in cmds.items():
		shell_run(name, cmd)
 
cmds = {
	'1_small_read'		: 'fio -name iops -rw=read -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_randread'	: 'fio -name iops -rw=randread -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_write'		: 'fio -name iops -rw=write -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_small_randwrite'	: 'fio -name iops -rw=randwrite -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_read'		: 'fio -name iops -rw=read -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_randread'	: 'fio -name iops -rw=randread -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_write'		: 'fio -name iops -rw=write -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'1_big_randwrite'	: 'fio -name iops -rw=randwrite -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1',
	'4_small_read'		: 'fio -name iops -rw=read -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_randread'	: 'fio -name iops -rw=randread -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_write'		: 'fio -name iops -rw=write -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_small_randwrite'	: 'fio -name iops -rw=randwrite -bs=4k -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_read'		: 'fio -name iops -rw=read -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_randread'	: 'fio -name iops -rw=randread -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_write'		: 'fio -name iops -rw=write -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4',
	'4_big_randwrite'	: 'fio -name iops -rw=randwrite -bs=10M -runtime=60 -iodepth 32 -filename /dev/sda6 -ioengine libaio -direct=1 -numjobs=4'
}
run_cmds(cmds)

test_case1/parse.cpp

Read more

how to turn off fans in linux

after running 'sensors-detect' command, kernel modules controlling fan speed should be loaded.

here is an occasion with 'Nuvoton NCT6102D/NCT6104D/NCT6106D Super IO Sensors' detected.

as nct6775 document said:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#/sys/class/hwmon/hwmon4
pwm[1-7]
    - this file stores PWM duty cycle or DC value (fan speed) in range:
	   0 (lowest speed) to 255 (full)
 
pwm[1-7]_enable
    - this file controls mode of fan/temperature control:
	* 0 Fan control disabled (fans set to maximum speed)
	* 1 Manual mode, write to pwm[0-5] any value 0-255
	* 2 "Thermal Cruise" mode
	* 3 "Fan Speed Cruise" mode
	* 4 "Smart Fan III" mode (NCT6775F only)
	* 5 "Smart Fan IV" mode
...

ps1. if set pwm[1-7]_enable to 0, we will not be able to change it to other value, unless reboot linux.
ps2. I still can't find a common way to turn off fans using ipmitool.

IPMI: Intelligent Platform Management Interface
BMC: Baseboard Management Controller
FRU: Field Replaceable Unit

refer to:
[linux-kernel-src-root]/Documentation/hwmon/nct6775.rst
https://bbs.archlinux.org/viewtopic.php?id=225349

AF-1020 ipsec

问题一:第三方对接都配置好了,实时抓包却未见AF-1020发isakmp或esp包。
1,第一阶段里要配线路出口,网络接口要选对接口并指定同样的线路出口。
2,VPN接口设置里要选择另一个网络接口为内网接口。
3,线路出口对应的网络接口与内网对应的网络接口不能相同网段。
问题二:第一阶段过后不进行第二阶段。
有可能在第二阶段设置中,出站策略与入站策略的源IP子网相同了。
问题三:同一个连接中无法生成多个ESP通道。
比如,同一个连接对应的第二阶段设置中,出站策略两个,入站策略两个,在AF-1020主动发起quick mode协商时,会一股脑儿向对端发2X2=4个esp sa isakmp包。
但根据ike协议的要求,每个包取hash需要的iv是放在ike sa的上下文中,这样其中3个esp sa isakmp包会被对端认为hash payload不正确而被抛弃。
而AF-1020 DLAN运行状态中却显示第二个通信连接成功了,其实是个BUG。
但是AF-1020在被动quick mode协商中,可以正确生成多个ESP通道。

refer to:
http://blog.itpub.net/81227/viewspace-2670399/

成为上帝玩转Chrome禁止图片显示

比如禁止微信公众号里的文章显示图片,经F12分析,图片来源为包含两种字符串的网址:

1
2
mmbiz.qpic.cn/mmbiz
mmbiz.qlogo.cn/mmbiz

把这两个字符串分两条规则加到BlockSitePlugin插件的strFrom里,strTo都置空,再在Chrome设置中的历史记录里,清空图片缓存,这点很重要。

之后刷新微信公众号文章,图片就没有了。

再比如禁止今日头条网页版顶部动画,在BlockSitePlugin插件的strFrom里输入

1
lf3-static.bytednsdoc.com/obj/eden-cn/upqlnvhj

strTo置空,加入此规则,并清空所有历史记录,由于这个动画是mp4,要重启Chrome,之后才能看到动画消失。

refer to:
成为上帝玩转Chrome之指定阻止访问的网站

send packet through nmap nping

nping in nmap suite can simulate sending packet on Windows platform.

this is an example of sending s7comm "Write Var" packet:

nping --dest-mac 00:50:56:32:5f:82 --source-mac 00:0c:29:29:15:30 --tcp -p 102 --dest-ip 10.2.0.10 -c 1 --data-length 37 --data 0300002502f080320100009378000e00060501120a1001000100018400001a000300010100

ps. on win7 platform, we should select "Install older Npcap 1.31 driver", maybe npcap 1.50 doesn't work in acquiring net card interface thereby.

refer to:
https://nmap.org/download.html

vmware mac big sur has no boot.efi in recovery selection

Make a bootable disk.

  1. create a vmdk with enough capacity, like 40G, add it to the guest vm.
  2. start up the vm, format the vmdk to HFS+(MAC OS扩展 日志式), name as MyVolume.
  3. download macos from app store, when installing dialog appears, leave it.
  4. open a terminal, type command below:
1
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume

Reboot the guest vm from this bootable disk.

1
BIOS -> EFI VMware Virtual SATA Hard Drive (2.0)

In recovery mode, we can switch off virtual memory.

1
2
3
4
5
csrutil disable
#after reboot
cd /System/Volumes/VM/
sudo mkdir swapfile0 swapfile1 swapfile2 swapfile3 swapfile4 swapfile5
sysctl vm.swapusage

refer to:
chrisleat
https://communities.vmware.com/t5/VMware-Fusion-Discussions/Can-t-boot-into-recovery-partition-on-macOS-11-Big-Sur/m-p/2298420#M139994
https://support.apple.com/en-us/HT201372
https://www.dazhuanlan.com/cossacks/topics/1189622