GPG error
- W: GPG error: http://mirrors.ustc.edu.cn bullseye-updates InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
1 | ~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 648ACFD622F3D138 |
DEPRECATION legacy keyring
1 | W: http://dl.google.com/linux/earth/deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. |
- list all keys
1 | ~$ apt-key --keyring /etc/apt/trusted.gpg list | grep "google" -A +5 -B +5 |
- export to a new file.
1
2
3~$ sudo apt-key export D38B4796 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/dl-google.gpg
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
PulseAudio 设置与应用
安装如下包,具体安装可参考这里
1
2
3
4
5
6
7
8
9
10
11~$ dpkg -l | grep "pulseaudio"
ii gstreamer1.0-pulseaudio:amd64 1.10.4-1 amd64 GStreamer plugin for PulseAudio
ii pulseaudio 10.0-1+deb9u1 amd64 PulseAudio sound server
ii pulseaudio-dlna 0.5.2-1 all Stream audio to DLNA devices and Chromecasts
ii pulseaudio-module-bluetooth 10.0-1+deb9u1 amd64 Bluetooth module for PulseAudio sound server
ii pulseaudio-module-gconf 10.0-1+deb9u1 amd64 GConf module for PulseAudio sound server
ii pulseaudio-module-jack 10.0-1+deb9u1 amd64 jackd modules for PulseAudio sound server
ii pulseaudio-utils 10.0-1+deb9u1 amd64 Command line tools for the PulseAudio sound server
ii alsa-tools 1.1.3-1 amd64 Console based ALSA utilities for specific hardware
ii alsa-utils 1.1.3-1 amd64 Utilities for configuring and using ALSA
ii alsamixergui 0.9.0rc2-1-10 amd64 graphical soundcard mixer for ALSA soundcard driver添加这一行load-module module-alsa-sink device=hw:1,0到
/etc/pulse/default.pa
里面.
1 | ~$ cat /etc/pulse/daemon.conf |
- 把下面的输出转到 PulseAudio.
1 | ~$ cat ~/.asoundrc |
- 启动,停止 PulseAudio
1 | ~$ pulseaudio --kill |
- 如果出现任何问题,仔细查看系统日志解决.
minicom 使用
Linux
下的超级终端工具minicom
是命令行的工具不像 windows 下的串口工具那么直观,但是使用习惯了就一样.- 初次使用
minicom
除了一些串口的常规设置,跟其它串口工具都是一样的. - 在当前
Shell
下输入minicom -s
会出现如下界面:
1 | +-----[configuration]------+ |
- 选择
Serial port setup
设置串口参数:
1 | +-----------------------------------------------------------------------+ |
设置完成回车返回到一个菜单.选择
Save setup as dfl
保存退出.我一般使用 minicom 的参数去连接.例如:
1 | ~$ minicom -o -b 115200 -D /dev/ttyUSB5 |
AT 命令
- Use Minicom For Linux Modem & Dialup AT Command Testing
- Fun with AT commands and an old modem
- Configure modem with AT commands
- 一般图形串口工具都有一项,发送新行或者
**newline**
这个选项.在连接一些硬件串口时发送 AT 命令时,这个是必选的. - 但是在
minicom
就只能用组合快捷键来替换了. - 在
minicom
里发送AT
命令如:AT+OK
直接回车,它是不会有反应的,必须还要加一个ctrl+j
,才能提交,这个问题也是困扰了我很久.
esptool 升级固件
参考链接:
ESP-01
为例.1
2
3
4
5
6
7
8GPIO0 --> GND
GPIO2 --> 3V3
CH_PD --> 3V3
RST --> 3V3
VCC --> 3V3
GND --> GND
TX --> UART(RX)
RX --> UART(TX)-
1
~$ esptool.py -p /dev/ttyUSB5 write_flash --flash_mode dio --flash_size 8m 0x0 AiThinker_ESP8266_DIO_8M_8M_20160615_V1.5.4.bin
这个升级问题折腾了我很久,今天总算是升级成功.它们的文档很杂,图与板子上的名称又不全部对应.
下面是更新部分
- Updating ESP8266 Firmware
- Espressif Systems
- Update the Firmware in Your ESP8266 Wi-Fi Module
- ESP8266 - Upgrading the Firmware
- 这里以下载最新的v1.7.4固件为例,注意查看各个子文件目录里的
README.md
.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
TTL-USB ESP01
RX ---> TX
TX ---> RX
GND ---> GND
GND ---> GPIO0 # 烧写完成后,把它移除就进入正常模式
3V3 ---> 3V3
3V3 ---> CH_PD
~$ esptool.py flash_id
esptool.py v3.0-dev
Found 2 serial ports
Serial port /dev/ttyUSB1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:0a:6c:b8
Uploading stub...
Running stub...
Stub running...
Manufacturer: e0
Device: 4014
Detected flash size: 1MB
Hard resetting via RTS pin...
~$ esptool.py -p /dev/ttyUSB0 write_flash --flash_mode qio --flash_freq 40m 0x00000 boot_v1.7.bin 0x01000 at/512+512/user1.1024.new.2.bin 0xfc000 esp_init_data_default_v08.bin 0x7e000 blank.bin 0xfe000 blank.bin 0xfb000 blank.bin
esptool.py v3.0-dev
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:0a:6c:b8
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Flash params set to 0x0020
Compressed 4080 bytes to 2936...
Wrote 4080 bytes (2936 compressed) at 0x00000000 in 0.3 seconds (effective 123.6 kbit/s)...
Hash of data verified.
Compressed 413444 bytes to 296966...
Wrote 413444 bytes (296966 compressed) at 0x00001000 in 26.3 seconds (effective 126.0 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x000fc000 in 0.0 seconds (effective 85.1 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x0007e000 in 0.0 seconds (effective 4089.5 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x000fe000 in 0.0 seconds (effective 4159.4 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x000fb000 in 0.0 seconds (effective 4216.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin... - 使用
minicom
时注意,软硬件流控要为NO
,具体设置Ctrl-A Z, -> O [Configure Minicom] -> Serial Port Setup -> F
.使用putty
边接,输入下面的命令
1 | # 查看固件 |
转换GBK
文本文件的问题
- 有时在
Linux
下打开GBK
编码的文件会出现乱码,优其是一些在window
下载打包的源码压缩包,源码文件全都是GBK
编码.在Linux
下用一些文本编辑器打开全是乱码,有些甚至连目录都是乱码. - 下面记录一个
shell
脚本批量转换成UTF8
格式的文件.
1 | $ cat convert.sh |
1 |
|
- 在转换文件时,有时候路径中会包含空格,如果不按照上面的方式设置
IFS
变量,脚本就会出错在有空格的地方分隔,认为是两个文件.上面这个脚本只是 - 一个很简单的处理当前目录下所有文件的转换.还可以把它写的更通用灵活.
批量清除文件名中的特定字符串
- 有时从网站下载一些文件,资源经会把自已的名字或者网址加在文件名如:
电影名_[www.xxx.com].mkv
,这样的格式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
31
32
33
34
35
36
37
38
TMP_IFS=$IFS
IFS=$(echo -en "\n\b")
sub1="www\.xxx\.com"
sub2="www\.bbb\.com"
sub3="www\.ccc\.com"
#sub4="[(]www.ddd.com[)]" # 例如: fname-(www.ddd.com).pdf, sed -re "s/$sub4//g"
# 例如:匹配 538081 SCALA学习手册.pdf 556997 Scala函数式编.pdf 这样的文件名,删除前面的6个数字
#
# reg='^([0-9]{6})'
# for fname in `ls`;do
# string=$(echo $fname)
# if [[ $string =~ $reg ]];
# then
# nstr=$(echo $string | sed -r "s/${reg}//g")
# echo $nstr
# mv $fname $nstr
# fi
# done
#
#
for fname in `ls`;
do
string=$(echo $fname)
if [[ $string = *${sub1}* || $string = *${sub2}* || $string = *${sub3}* || $string = *${sub4}* ]];
then
nstring=$(echo $s | sed -e "s/${sub1}//g" -e "s/$sub2//g" -e "s/$sub3//g" -e "s/\(()\)//g/" -e "s/\[[]\]//g" )
echo $nstring
mv $f $nstring
fi
done
IFS=$TMP_IFS
路由表内存在多个default dev
的问题
1 | ~$ ip route |
- 因为是安装了
debian buster lxde-desktop
版本,先是怀疑avahi
问题,看了它的配置,有去配置169.254.x.x
的地址,删除后,还是没有解决问题。列出本地端口时,发现有一个进程listen 127.0.0.1:53
, 最终查到是connman
导至的问题。
Linux 下wireless WPA
加密连接
确保安装了 wpasupplicant
1
~$ sudo apt-get install wpasupplicant.
创建
/etc/wpa_supplicant.conf
或者从/usr/share/doc/wpa_supplicant/examples/wpa_supplicant.conf.gz
复制例如:
1
2
3
4network={
ssid="ssid_name"
psk="password"
}手动命令行连接
1 | ~$ sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext |
MT7601U 开启软件AP功能(非hostapd)
- 如果安装或是编译了其它的
mt7601u
的驱动,需要把它卸载或者加入黑名单里,不能加载它.1
2~$ cat /etc/modprobe.d/blacklist-mt7601u
blacklist mt7601u
RTL8812AU驱动(0bda:0811)
1 | ~$ lsusb -s 008 -v |
- 这块
RTL8812AU
的网卡是EDUP AC-1608
,查看它官方驱动是法支持AP功能且还不支持nl80211
的驱动,之后去到github搜索到一些驱动,有一些是只能使用网卡功能,有一些还连编译都无法通过.后来验证两个驱动如上,最后使用了aircrack-ng解决了所有的问题,不愧是黒技术的先锋. - 按照aircrack-ng的提示,直接
make && make install
或者sudo ./dkms-install.sh
就直接编译并安装到内核树的驱动里.加载成功后,查看模块信息,检测到功能如下:
1 | ~$ modinfo 88XXau | grep "0811" |
- 查看phy的信息.
1 | ~$ iw list |
- 把源码加入到
dkms
里,更新kernel
时动态编译。
1 | ~ rtl8812au$ git branch |
使用wpa_supplicant
- wpa_supplicant is a WPA Supplicant for Linux, BSD, Mac OS X, and Windows with support for WPA and WPA2 (IEEE 802.11i / RSN).
wpa_supplicant
是一个提供WPA认证的客户端,它除了可以做为网卡端提供认证外,还可以在AP模式提供认证.
AP模式
1 | ~$ cat /etc/wpa_supplicant/wpa_supplicant.conf |
- 创建如上面的配置文件,就可以使用命令运行它成为一AP点.认证连接后,需要为客户端分配IP,具体可以在本机上安装一个
udhcpd
.也可以客户端手动设置IP与这边的AP端是在同一个网络里.
1 | ~$ sudo wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf |
- 也可把它集成到
/etc/network/interfaces
里,网卡开启之后自动成为一个AP点.
1 | ~$ cat /etc/network/interfaces |
RTL8169 驱动
No Ethernet Connection in Ubuntu 16.04/Linux Mint 18 with Realtek RTL8111/8168/8411
https://github.com/fintecheando/r8168
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72# 查看本机硬件信息.
~$ lshw -c network
*-network UNCLAIMED
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
[....]
~$ tree r8168-8.043.02/
r8168-8.043.02/
├── dkms.conf
├── Makefile
├── r8168_asf.c
├── r8168_asf.h
├── r8168_dash.h
├── r8168_fiber.h
├── r8168.h
├── r8168_n.c
├── r8168_realwow.h
├── rtl_eeprom.c
├── rtl_eeprom.h
├── rtltool.c
└── rtltool.h
0 directories, 13 files
# 查看系统已经添加了那些dkms包.
~$ cd /usr/src/
lcy@debian:/usr/src$ dkms status
aufs, 4.9+20161219, 4.9.0-7-amd64, x86_64: installed
aufs, 4.9+20161219, 4.9.0-8-amd64, x86_64: installed
nvidia, 410.48, 4.14.77-20181016-lcy-amd64, x86_64: installed
r8168, 8.043.02, 4.9.0-8-amd64, x86_64: installed
rtl8812au, 4.3.8.12175.20140902+dfsg, 4.14.77-20181016-lcy-amd64, x86_64: installed
rtl8812au, 4.3.8.12175.20140902+dfsg, 4.9.0-8-amd64, x86_64: installed
# 如果没有看到添加进来,先把源码目录复制到/usr/src/r8168-8.043.02,再用下面命令加入dkms.
~$ sudo dkms add -m r8168 -v 8.043.02
# 使用dkms编译驱动包.
~$ sudo dkms build -m r8168 -v 8.043.02
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j6 KERNELRELEASE=4.14.77-20181016-lcy-amd64 -C /lib/modules/4.14.77-20181016-lcy-amd64/build M=/var/lib/dkms/r8168/8.043.02/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.14.77-20181016-lcy-amd64 (x86_64)
Consult /var/lib/dkms/r8168/8.043.02/build/make.log for more information.
# 查看dkms编译为什么出错.
~$ cat /var/lib/dkms/r8168/8.043.02/build/make.log
DKMS make.log for r8168-8.043.02 for kernel 4.14.77-20181016-lcy-amd64 (x86_64)
Sat Dec 29 16:31:32 CST 2018
make: Entering directory '/usr/src/linux-4.14.77'
AR /var/lib/dkms/r8168/8.043.02/build/built-in.o
CC [M] /var/lib/dkms/r8168/8.043.02/build/r8168_n.o
CC [M] /var/lib/dkms/r8168/8.043.02/build/r8168_asf.o
CC [M] /var/lib/dkms/r8168/8.043.02/build/rtl_eeprom.o
CC [M] /var/lib/dkms/r8168/8.043.02/build/rtltool.o
/var/lib/dkms/r8168/8.043.02/build/r8168_n.c: In function ‘rtl8168_rx_interrupt’:
/var/lib/dkms/r8168/8.043.02/build/r8168_n.c:25418:28: error: ‘struct net_device’ has no member named ‘last_rx’
dev->last_rx = jiffies;
^~
scripts/Makefile.build:328: recipe for target '/var/lib/dkms/r8168/8.043.02/build/r8168_n.o' failed
make[1]: *** [/var/lib/dkms/r8168/8.043.02/build/r8168_n.o] Error 1
Makefile:1527: recipe for target '_module_/var/lib/dkms/r8168/8.043.02/build' failed
make: *** [_module_/var/lib/dkms/r8168/8.043.02/build] Error 2
make: Leaving directory '/usr/src/linux-4.14.77'删除原有的系统包
1 | ~$ sudo apt-get purge r8168-dkms |
1 |
|
- 防止重命名网卡的名字,
1 | ~$ dmesg |
使用hostapd
配置WIFI
热点
- Beginners guide to a custom 802.11ac setup
- Hostapd
- WiFi/HowToUse
- Setting up a WIFI connection via command line on Debian/Ubuntu (Network Manager)
查看网卡配置
1 | ~$ iw list | grep "Supported interface modes" -A 8 |
安装
1 | ~$ sudo apt-get install hostapd |
调试配置文件错误
1 | # 配置文件错误 |
配置实例
- Hostapd
- 下面的配置有一些网卡是不支持的,出错需注释相关行.
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~$ sudo grep -v '^#' hostapd.conf | grep -v '^$'
interface=wlan0
driver=nl80211
logger_syslog=1
logger_syslog_level=0
logger_stdout=1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=lcy_home
country_code=CN
ieee80211d=1
hw_mode=g
channel=4
auth_algs=3
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
ieee80211n=1
ieee80211ac=1
eap_server=0
own_ip_addr=127.0.0.1
wpa=2
wpa_psk_file=/etc/hostapd.wpa_psk
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_group_rekey=600
wpa_gmk_rekey=86400
配置主机路由
1 | root# echo "net.ipv4.ip_forward=1" > /etc/sysconf.ctl # 这一行很重要. |
Linux 下是使用蓝牙串口通信
- 如果是自编译内核要确保
RFCOMM protocol support (BT_RFCOMM)
是编译成模块的,而不能直接编入内核或者不编. - Linux下使用蓝牙工具要安装
bluez
软件,有一个图形配置程序blueman
,使用会报一些Python
与Dbus
的错误,还是直接修改配置文件解决使用问题.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15~$ cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind yes;
device 00:15:83:00:43:AB
channel 0;
comment "Serial Port";
}
rfcomm1 {
bind yes;
device 00:14:01:22:14:49;
channel 1;
connment "Serial Port 1";
}
配对蓝牙
1 | $ bluetoothctl |
手动连接RFCOMM
串口
1 | sudo rfcomm connect /dev/rfcomm0 00:14:01:22:14:49 1 |
- 运行上面的命令无错,就可以使用 minicom 连接它了,
sudo minicom -o -b 115200 -D /dev/rfcomm0
- 如果运行图形配置向导,要先运行
blueman-applet
再运行blueman-manager
,就可以配置了.
蓝牙错误
1 | $ systemctl status bluetooth |
无法连接蓝牙音响
- Error when trying to connect to bluetooth speaker:
org.bluez.Error.Failed
- 错误提示:
Failed to connect: org.bluez.Error.Failed
1 | sudo apt install pulseaudio-module-bluetooth |
Linux Systemctl
启动服务超时设置
- 下面用一个网络连接服务为示例,如果网络配置是 DHCP,刚好网络没有提供 DHCP 服务,这时该服务程序会重试(默认)两分钟才会报错,这里可以设置成5到10 秒,快速跳过该服务启动.
- 在文件
/lib/systemd/system/networking.service.d/network-pre.conf
里添加下面两行:
1 | [Service] |
- 可以使用下面的方式来定位整个启动时的用时。
1 | ~$ systemd-analyze critical-chain |
- 如上所示,需要查一下
/etc/network/interfaces
里的配置,rc-local
里的配置,是什么原因导致在这里启动耗时。
安装 IBus 输入法框架
IBus("Intelligent Input Bus")
是一个输入法框架,一个输入非英语字符的系统.IBus
的功能与SCIM
和UIM
类似.在Debian
下面有一个问题,如果不安装ibus-gtk3,ibus-gtk
就会出现wxWidgets框架下的文本输入框无法使用Back Space,Arrown keys
这些按键.安装指导
1 | ~$ dpkg -l | grep "ibus" |
- 如果要配置
locales
,方法如下:1
2
3~$ sudo apt-get install locales
~$ sudo dpkg-reconfigure locales
~$ sudo locale-gen
BOSSAC 烧写 Arduino-DUE 无法找到设备
1 | ./bossac -i -d --port=ttyACM0 -U false -e -w -v -b ./nuttx.bin -R |
处理方法
1 | stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb |
Virt-Manager 虚拟机无法启动
有时
KVM
框架虚拟机系统无法启动,错误如下:1
2
3
4Error starting domain: Requested operation is not valid: network 'default' is not active
Traceback (most recent call last):
[...]通过如下命令启动网络即可.
1 | ~$ sudo virsh net-list --all |
Virt-Manager 使用 OpenvSwitch 交换机
- 使用 OpenvSwitch 的网络服务启动会有延迟一分钟左右.
安装 OpenvSwitch
1 | ~$ dpkg -l | grep "openvswitch" |
创建桥接端口
1 | ~$ sudo ovs-vsctl add-br ovsbr0 |
修改网卡启动配置
1 | ~$ cat /etc/network/interfaces |
创建 Virt-Manager 桥接网络
- Network_bridge
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~$ sudo cp /etc/libvirt/qemu/networks/{default.xml,ovsbr0.xml}
# 把内容修改成如下所示
~$ cat /etc/libvirt/qemu/networks/ovsbr0.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh net-edit ovsbr0
or other application using the libvirt API.
-->
<network>
<name>ovsbr0</name>
<uuid>fc0b3bb1-c273-49dc-b469-153dc4c452e2</uuid>
<forward mode='bridge'/>
<bridge name='ovsbr0'/>
<virtualport type='openvswitch'/>
</network>
~$ sudo virsh net-define /etc/libvirt/qemu/networks/ovsbr0.xml
~$ sudo virsh net-create /etc/libvirt/qemu/networks/ovsbr0.xml
~$ sudo virsh net-list --all
Name State Autostart Persistent
----------------------------------------------------------
default active yes yes
ovsbr0 inactive no yes
~$ sudo virsh net-autostart ovsbr0
设置虚拟机的网络
- 现在 KVM 虚拟机就有
default
,ovsbr0
两个网络,添加一个连接到OpenvSwitch
上的网卡如下图所示:
创建Debian Live USB
系统盘
- 如果想要试用
Linux
,又不想安装它,可以把它烧写到U盘里,做为启动盘或者系统恢复盘. Debian 国内镜像下载链接
- 注意: 这里一定要选择
live
标志的 iso 镜像下载.在 windows 下面要先下载一个叫Win32DiskImager
的烧写工具,Linux 就很简单使用下面命令就能完成:
1 | $ ls debian-live-9.4.0-amd64-mate.iso |
- 严重注意 这里的
/dev/sdc1
一要是你想要格式华的U盘,如果这里是当前硬盘,或者是有重要资料的盘符,就会直接覆盖它,找不回来.注意,注意,注意
开启Debian Hibernate
功能
有时工作进行到一个阶段,不想系统重启之后,再费时间来打开与配置环境.开启系统休眠功能非常有用.先要确保有一个
swap
分区,最好是两倍与系统内存的大小.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57~$ sudo apt-get install acpi-support pm-utils
~$ sudo mkswap /dev/sdb1
~$ sudo swapon /dev/sdb1
# 确保下面这两个文件里有这些行.
~$ sudo cat /etc/fstab | grep "swap"
/dev/sdb1 none swap pri=1 0 0
# 如果是在本机为其它机器编译内核与initramfs的,需要把resume=删除后,再make install,否则到目标机器上会panic.
~$ blkid
[...]
/dev/sdb3: UUID="ae170b9d-832a-46a7-beca-5fb7c9329b1b" TYPE="swap" PARTUUID="6daebe63-03"
~$ sudo cat /etc/default/grub | grep "resume"
GRUB_CMDLINE_LINUX="resume=UUID=ae170b9d-832a-46a7-beca-5fb7c9329b1b"
~$cat /etc/initramfs-tools/conf.d/resume
RESUME=UUID=ae170b9d-832a-46a7-beca-5fb7c9329b1b
#这一操作很重要.
~$ update-initramfs -u -k `uname -r` ## 更新当前内核的启动镜像.
~$ sudo update-grub
~$ cat /proc/acpi/wakeup
Device S-state Status Sysfs node
PB31 S4 *disabled pci:0000:00:03.1
PB32 S4 *disabled
PB33 S4 *disabled pci:0000:00:03.3
PB34 S4 *disabled
SBAZ S4 *disabled pci:0000:00:14.2
PS2K S3 *disabled
PS2M S3 *disabled
ECIR S4 *disabled
P0PC S4 *disabled pci:0000:00:14.4
OHC1 S4 *disabled pci:0000:00:12.0
EHC1 S4 *disabled pci:0000:00:12.2
OHC2 S4 *disabled pci:0000:00:13.0
EHC2 S4 *disabled pci:0000:00:13.2
OHC3 S4 *disabled
EHC3 S4 *disabled
OHC4 S4 *disabled pci:0000:00:14.5
XHC0 S4 *disabled pci:0000:00:10.0
XHC1 S4 *disabled pci:0000:00:10.1
PE20 S4 *disabled
PE21 S4 *disabled
PE22 S4 *disabled
PE23 S4 *disabled
PWRB S3 *enabled platform:PNP0C0C:00
# 上面是一些如何唤醒休眠的设备, 休眠中是可以通过移动鼠标或者键盘来唤醒,但是我这里把它们都关闭,让它只能通过电源按钮(PWRB)唤醒系统.
~$ grep "echo" /etc/rc.local
[...]
for i in OHC1 EHC1 OHC2 EHC2 OHC4 XHC0 XHC1;
do
cat /proc/acpi/wakeup | grep "$i" | grep "enabled" && echo "$i" > /proc/acpi/wakeup
done
[...]测试休眠功能
echo disk > /sys/power/state
,或者运行pm-hibernate
进行休眠, 还有systemctl hibernate
进行休眠.通过上面设置,系统休眠与唤醒都很符合我的预期.还有一种方法是使用一个交换文件,不需要一个独立的分区,请参考这里
如果上述设置能休眠不能关机,就是休眠后马上又重启了,参照这里需要如下设置:
1 | /etc/systemd/sleep.conf.d/hibernatemode.conf |
如果不能使用界的
System->Shut Down->Hibernate
的进行休眠,但是可以直接使用sudo pm-hibernate
.需要重装下面的包试试.1
~$ apt-get install --reinstall pm-utils mate-power-manager-common hibernate upower
如果休眠后恢复系统不能使用
usb wifi
(rtl8812au) 网卡.1
2
3
4
5
6
7
8
9
10
11
12
13~$ sudo lshw -C network | grep "wlan" -A +3 | grep "driver"
configuration: broadcast=yes driver=rtl8812au ip=192.168.5.190 multicast=yes wireless=IEEE 802.11
# 创建如下文件
~$ sudo cat /etc/pm/config.d/unload_modules
SUSPEND_MODULES="$SUSPEND_MODULES rtl8812au"
# 创建成功,要加上运行权限.
~$ sudo cat /etc/pm/sleep.d/10_resume_wifi
#!/bin/sh
case "${1}" in
resume|thaw)
nmcli r wifi off && nmcli r wifi on;
esac
程序找不到链接库位置
Python ImportError
,这种错误是因为在PYTHONPATH
路径中找不相就的模块.1
2
3
4
5
6
7~$ ./modes_rx
Traceback (most recent call last):
File "./modes_rx", line 27, in <module>
import air_modes
ImportError: No module named air_modes
~$ PYTHONPATH=../lib/python2.7/dist-packages ./modes_rx #指定的环境变量对了就可以了.本地库链接错误
1
2
3
4
5
6
7
8
9
10
11
12~$ ldd /usr/local/bin/rtl_tcp
linux-vdso.so.1 (0x00007fff3d3eb000)
librtlsdr.so.0 => not found # 默认位置/lib/x86_64-linux-gnu找不该库.
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f3d0b328000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3d0b108000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3d0ad68000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f3d0b6d8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3d0b548000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3d0ab60000)
~$ ls /usr/local/lib/librtlsdr.so.0 # 这个位置有这个库
/usr/local/lib/librtlsdr.so.0上面的错误有两种方法可以解决:
- 把
/usr/local/lib
加入到/etc/ld.so.conf
里,再执行一次ldconfig
就可以链接这个库了. - 使用
LD_LIBRARY_PATH
环境变量指位置,这样运行:1
2
3
4
5
6
7
8~$ LD_LIBRARY_PATH=/usr/local/lib rtl_tcp
Found 1 device(s).
Found Rafael Micro R820T tuner
Using ezcap USB 2.0 DVB-T/DAB/FM dongle
Tuned to 100000000 Hz.
listening...
Use the device argument 'rtl_tcp=127.0.0.1:1234' in OsmoSDR (gr-osmosdr) source
to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).
- 把
在内核树里编译单个模块
- 比如,上面缺少一个
rfkill
的模块,现在可以在不重编整个内核的前提下,可以单独编译这个内核.1
2
3
4
5
6
7
8
9
10
11
12
13
14~$ cd /lib/modules/$(uname -r)/build/net/rfkill
~$ sudo make -C /lib/modules/$(uname -r)/build M=`pwd` modules # 要先在.config 把这一个模块选中为`编译`状态.
make: Entering directory '/usr/src/linux-4.14.77'
CC [M] /lib/modules/4.14.77-20181016-lcy-amd64/build/net/rfkill/core.o
LD [M] /lib/modules/4.14.77-20181016-lcy-amd64/build/net/rfkill/rfkill.o
Building modules, stage 2.
MODPOST 1 modules
CC /lib/modules/4.14.77-20181016-lcy-amd64/build/net/rfkill/rfkill.mod.o
LD [M] /lib/modules/4.14.77-20181016-lcy-amd64/build/net/rfkill/rfkill.ko
make: Leaving directory '/usr/src/linux-4.14.77'
~$ sudo mkdir /lib/modules/$(uname -r)/kernel/net/rfkill
~$ sudo cp rfkill.ko /lib/modules/$(uname -r)/kernel/net/rfkill/
~$ sudo depmod -a # 计算依赖关系
~$ modprobe -v rfkill # 加载模块.
- 如果每次重启,某一个网块或蓝牙都是
Soft Blocked
的话,尝试一下用命令nmcli r wifi on
.
编译carl9170出错问题
1 | michael@debian:/usr/src/linux-5.5.11/drivers/net/wireless/ath/carl9170$ sudo make -C /lib/modules/$(uname -r)/build M=`pwd` modules |
- 像上面错误,后续不能在内核树编译驱动模块,因为选中该驱动中的子选项
SoftLED Support(ONFIG_CARL9170_LEDS)
是不支持单独编译成.ko
或者包含在这个.ko
里,它必须编译进内核.所以碰到这种问题,只能重新编译整个内核.
创建大于 2TB 的分区
1 | ~$parted /dev/sda |
Linux 下修复(屏蔽)磁盘坏块
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux
查找坏块
1
~$ sudo badblocks -v /dev/sdaX > badsectors.txt
修复
1
2
3
4
5
6
7------------ Specifically for ext2/ext3/ext4 file-systems ------------
~$ sudo e2fsck -l badsectors.txt /dev/sdaX
OR
------------ For other file-systems ------------
~$ sudo fsck -l badsectors.txt /dev/sdaX
~$ sudo fsck -t -y -f -c /dev/sdaX
SmartCtl
1 | ~$ sudo smartctl -H /dev/sdaX |
- 上面分析结果
Current_Pending_Sector
显示代表有8处坏块.
使用Short Test
1 | ~$ smartctl -t short /dev/sda |
使用Long Test
- 如果短测试没有发现问题,可能要使用长测试,耗时根据硬盘容量决定,
ST4000DM000
使用了大概480分钟.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16~$ smartctl -t long /dev/sda
# 查看测试结果
~$ smartctl -x /dev/sda
[...]
SMART Extended Self-test Log Version: 1 (1 sectors)
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 7757 -
# 2 Short offline Completed without error 00% 7757 -
# 3 Extended offline Completed without error 00% 7752 -
# 4 Short offline Completed without error 00% 7744 -
# 5 Short offline Completed: read failure 90% 7744 5341719016
# 6 Short offline Completed without error 00% 7744 -
# 7 Extended offline Completed without error 00% 3769 -
# 8 Extended offline Completed without error 00% 3746 -
1 of 1 failed self-tests are outdated by newer successful extended offline self-test # 3
[...]
NVMe的固态硬盘
防止/etc/resolve.conf 被 DHCP 自动修改
1 | ~# cat /etc/NetworkManager/NetworkManager.conf |
- 或者用
chattr +i /etc/resolve.conf
锁定修改它.
apt-get使用 Socks5代理
1 | ~$ sudo apt-get install proxychains |
Git使用问题
- 统计工程代码数量.
1
~$ git log --since="2018-03-01" --before="2019-01-09" --author="username" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
脚本配置git Socks5代理
1 | ~$ cat /usr/local/bin/gitproxy |
Git 错误 error: refs/remotes/origin/rpi-4.19.y does not point to a valid object!
使用Intel AX200
网卡
1 | ~$ hwinfo --netcard --bluetooth | grep -v "Config S" |
测试不同的加载参数,下面参数等于
echo "options iwlwifi 11n_disable=8" > /etc/modprobe.d/iwlwifi.conf
.只是要重启生效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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62~$ sudo rmmod iwlmvm
~$ sudo rmmod iwlwifi
~$ sudo modprobe iwlwifi 11n_disable=8
# 对应的参数说明是
~$ modinfo iwlwifi
[...]
parm: swcrypto:using crypto in software (default 0 [hardware]) (int)
parm: 11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
parm: amsdu_size:amsdu size 0: 12K for multi Rx queue devices, 2K for AX210 devices, 4K for other devices 1:4K 2:8K 3:12K 4: 2K (default 0) (int)
parm: fw_restart:restart firmware in case of error (default true) (bool)
parm: antenna_coupling:specify antenna coupling in dB (default: 0 dB) (int)
parm: nvm_file:NVM file name (charp)
parm: uapsd_disable:disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3) (uint)
parm: enable_ini:Enable debug INI TLV FW debug infrastructure (default: 0 (bool)
parm: bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
parm: led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
parm: power_save:enable WiFi power management (default: disable) (bool)
parm: power_level:default power save level (range from 1 - 5, default: 1) (int)
parm: fw_monitor:firmware monitor - to debug FW (default: false - needs lots of memory) (bool)
parm: disable_11ac:Disable VHT capabilities (default: false) (bool)
parm: remove_when_gone:Remove dev from PCIe bus if it is deemed inaccessible (default: false) (bool)
parm: disable_11ax:Disable HE capabilities (default: false) (bool)
# 查看当前驱动的参数
~# systool -m iwlwifi -av
Module = "iwlwifi"
Attributes:
coresize = "282624"
initsize = "0"
initstate = "live"
refcnt = "1"
srcversion = "4E773ECBB9682B55D952A3C"
taint = ""
uevent = <store method only>
Parameters:
11n_disable = "0"
amsdu_size = "0"
antenna_coupling = "0"
bt_coex_active = "Y"
debug = "0"
disable_11ac = "N"
disable_11ax = "N"
enable_ini = "N"
fw_monitor = "N"
fw_restart = "Y"
led_mode = "0"
nvm_file = "(null)"
power_level = "0"
power_save = "N"
remove_when_gone = "N"
swcrypto = "0"
uapsd_disable = "3"
[....]
# 对应映射到系统的位置.
~$ ls /sys/module/iwlwifi/parameters/
11n_disable antenna_coupling disable_11ac enable_ini fw_restart nvm_file power_save swcrypto
amsdu_size bt_coex_active disable_11ax fw_monitor led_mode power_level remove_when_gone uapsd_disable最终参照这里,开启优化设置如下:
1 | ~$ cat /etc/modprobe.d/iwlwifi.conf |
- hcitool 连接蓝牙
1 | ~$ hcitool scan |
- 无法检测到蓝牙控制器
1 | ~$ bluetoothctl show |
- 尝试重装一下它的驱动
1 | ~# rmmod btusb |
查看WIFI的地区代码.
- iwconfig wlan0 txpower 30mW - not working
- How to create custom Linux Wi-Fi regulatory database to unlock 30db/1000mW
DFS
是为了使无线产品主动探测军方使用的频率,并主动选择另一个频率,以避开军方频率.所以上面那个链接说,在美国解除限制是违法.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
31
32~$ regdbdump /lib/crda/regulatory.bin
~$ iw reg get
phy#0 (self-managed)
country CN: DFS-UNSET
(2402 - 2437 @ 40), (6, 22), (N/A), AUTO-BW, NO-HT40MINUS, NO-80MHZ, NO-160MHZ
(2422 - 2462 @ 40), (6, 22), (N/A), AUTO-BW, NO-80MHZ, NO-160MHZ
(2447 - 2482 @ 40), (6, 22), (N/A), AUTO-BW, NO-HT40PLUS, NO-80MHZ, NO-160MHZ
(5170 - 5190 @ 160), (6, 22), (N/A), NO-OUTDOOR, AUTO-BW, IR-CONCURRENT, NO-HT40MINUS, PASSIVE-SCAN
(5190 - 5210 @ 160), (6, 22), (N/A), NO-OUTDOOR, AUTO-BW, IR-CONCURRENT, NO-HT40PLUS, PASSIVE-SCAN
(5210 - 5230 @ 160), (6, 22), (N/A), NO-OUTDOOR, AUTO-BW, IR-CONCURRENT, NO-HT40MINUS, PASSIVE-SCAN
(5230 - 5250 @ 160), (6, 22), (N/A), NO-OUTDOOR, AUTO-BW, IR-CONCURRENT, NO-HT40PLUS, PASSIVE-SCAN
(5250 - 5270 @ 160), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5270 - 5290 @ 160), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5290 - 5310 @ 160), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5310 - 5330 @ 160), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5490 - 5510 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5510 - 5530 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5530 - 5550 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5550 - 5570 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5570 - 5590 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5590 - 5610 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5610 - 5630 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, PASSIVE-SCAN
(5630 - 5650 @ 240), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, PASSIVE-SCAN
(5650 - 5670 @ 80), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, NO-160MHZ, PASSIVE-SCAN
(5670 - 5690 @ 80), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, NO-160MHZ, PASSIVE-SCAN
(5690 - 5710 @ 80), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40MINUS, NO-160MHZ, PASSIVE-SCAN
(5710 - 5730 @ 80), (6, 22), (0 ms), DFS, AUTO-BW, NO-HT40PLUS, NO-160MHZ, PASSIVE-SCAN
(5735 - 5755 @ 80), (6, 22), (N/A), AUTO-BW, IR-CONCURRENT, NO-HT40MINUS, NO-160MHZ, PASSIVE-SCAN
(5755 - 5775 @ 80), (6, 22), (N/A), AUTO-BW, IR-CONCURRENT, NO-HT40PLUS, NO-160MHZ, PASSIVE-SCAN
(5775 - 5795 @ 80), (6, 22), (N/A), AUTO-BW, IR-CONCURRENT, NO-HT40MINUS, NO-160MHZ, PASSIVE-SCAN
(5795 - 5815 @ 80), (6, 22), (N/A), AUTO-BW, IR-CONCURRENT, NO-HT40PLUS, NO-160MHZ, PASSIVE-SCAN
(5815 - 5835 @ 20), (6, 22), (N/A), AUTO-BW, IR-CONCURRENT, NO-HT40MINUS, NO-HT40PLUS, NO-80MHZ, NO-160MHZ, PASSIVE-SCAN - 也可以在
/etc/default/crda
设置区域代码.
1 | dmesg | grep "cfg80211" |
编译wireless-regdb
1 | # python2 required |
编译crda
1 | ~$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git |
创建Linux路由器(支持IPv6-PD)
链接:
一般来说,可以使用Linux来做一个完全路由(OpentWrt),这里讲的是如何在自己工作的台式电脑内安装路由(含WiFi)功能.一般是台机是只有一个以太网卡,外接一个
USB Wifi
网卡来做无线路由,当然也可以有这些组合:eth0(WAN)–>wlan0(LAN), eth0(WAN)–>eth1(LAN),wlan0(WAN)–>wlan1(lan). 一般卖的小家用路由器是:一个WAN
口,外加4个交换机LAN
口,可能还有一个Wifi
功能.其实这些低成本的路由器只有一个物理网卡,使用VLAN
把它分成两个子网(WAN,LAN
),其实也就是单臂路由
.如:eth0.0(WAN)-->br-lan(eth0.1,wlan)
使用桥接(bridge)功能把wifi
与4个LAN
口交换机绑定成一个内局域网内.下面这里是把两个
wifi
组成一个无线路由,wlan0(WAN)--wlan1(LAN)
,wlan0
是从连接上层路由(外部ISP)相当于是WAN
,wlan1
是内部子网相当于是LAN
.之前一般配置是,开启内核转发net.ipv4.ip_forward = 1
,再配置一个hostapd
,dnsmasq
就能对外提供一个简单在IPv4
的路由服务了.
系统配置
1 | ~$ cat /etc/sysctl.conf |
DHCP&DNS服务器
1 | ~$ sudo apt-get instal dnsmasq |
DHCP客户端
- 如果只是
ipv4
路由服务,是不需安装下面这些DHCP
客户端的.这里使用的是dhcpcd5
,功能:DHCPv4, IPv6RA and DHCPv6 client with IPv4LL support
.还有如:wide-dhcpv6-client
,dibbler-client
.这里是以dhcpcd5
为示例,具体详细配置可以通过man dhcpcd.conf
查看.
DHCPCD5
1 | ~$ sudo apt-get instal dhcpcd5 |
Wide-dhcpv6-client
wide-dhcpv6-client与dhcpcd二者不能同时运行.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19~$ sudo apt-get install wide-dhcpv6-client
~$ cat /etc/wide-dhcpv6/dhcp6c.conf
# Default dhpc6c configuration: it assumes the address is autoconfigured using
# router advertisements.
interface wlan0 {
send ia-pd 0;
send rapid-commit;
request domain-name-servers;
script "/sbin/dhcp6c-state";
};
id-assoc pd 0 {
prefix-interface wlan1 {
sla-id 0;
sla-len 0;
};
};
~$ sudo /etc/init.d/wide-dhcpv6-client start启动
/etc/init.d/dhcpcd restart
,获取PD
信息根据网络质量,可能会有不到十几秒的延时,现在查看接口会显示类似如下:1
2
3
4
5
6
7
8
9
10
11~$ ifconfig wlan1
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 2409:8a55:xxxx:xxxx::1 prefixlen 64 scopeid 0x0<global> # 这里是通过wlan1从上游ISP获取的PD.
inet6 fe80::705c:99ff:feda:9f46 prefixlen 64 scopeid 0x20<link>
ether 72:5c:99:da:9f:46 txqueuelen 1000 (Ethernet)
RX packets 174 bytes 21784 (21.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 401 bytes 76160 (74.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Wifi客户端
- 创建一个
Wifi AP
热点,首先需要硬件设备(wifi网卡)支持Soft AP
功能,最好要兼容nl80211
的驱动. Linux下有两种工具可以支持AP功能:hostapd: IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator,wpasupplicant: Linux WPA/WPA2/IEEE 802.1X Supplicant.hostapd
功能更多更复杂,wpasupplicant
主要是用于客户端WPA请求认证.
HOSTAPD
不幸的,
intel iwlwifi
它在hostapd
不支持AC 5G
的热点功能。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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50~$ sudo apt-get install hostapd
~$ cat /etc/hostapd/hostapd.conf
interface=wlan1
# bridge=br-lan
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=lcy
country_code=US
hw_mode=g # b,g,a三种模式,5G 是ac模式
channel=1
beacon_int=100
dtim_period=2
macaddr_acl=0
auth_algs=1
wmm_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
# ieee80211n=1 # 开启11N模式
# ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]
wpa=2
wpa_psk_file=/etc/hostapd/hostapd.wpa_psk
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_group_rekey=600
~$ systemctl start hostapd
WPASUPPLICANT
1 | ~$ sudo apt-get install wpasupplicant |
上面这些工具,都可以是运行为独立的服务,可以像要下面一样,通过网卡事件脚本来控制.
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
31
32
33
34
35
36
37
38
39
40~$ cat /etc/network/interfaces
auto wlan1
allow-hotplug wlan1
iface wlan1 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
#up ifconfig ovsbr0 down
# 使用wpa_supplicant 开启AP模式,提供wifi访问.
pre-up wpa_supplicant -B -Dnl80211 -i$IFACE -c/etc/wpa_supplicant/lcy_wifi.conf \
-P/var/run/wpa_supplicant.$IFACE.pid
# 在这里 hostapd与wpa_supplicant二选一提供AP认证服务
#post-up /usr/sbin/hostapd -B -P/var/run/hostapd.$IFACE.pid /etc/hostapd/hostapd.conf
post-up /usr/sbin/dnsmasq --conf-file=/etc/dnsmasq.conf \
--pid-file=/var/run/dnsmasq.$IFACE.pid
post-up /etc/init.d/dhcpcd restart
wait-delay 15
pre-down cat /var/run/dnsmasq.$IFACE.pid | xargs kill
pre-down cat /var/run/wpa_supplicant.$IFACE.pid | xargs kill
#pre-down cat /var/run/hostapd.$IFACE.pid | xargs kill
auto wlan0
iface wlan0 inet static
#up ip link set dev ovsbr0 down
#up ifconfig ovs-system down
#up ifconfig ovsbr0 down
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
# 这里也很重要,WAN口需要固定一个MAC地址,
# pre-up ip link set dev $IFACE addr 34:13:xx:xx:xx:76
# 使用wpa_supplicant去连接上游的wifi.
pre-up wpa_supplicant -B -Dnl80211 -i$IFACE -c/etc/wpa_supplicant/wpa_supplicant.conf \
-P/var/run/wpa_supplicant.$IFACE.pid
post-up /etc/init.d/dhcpcd start # 简单可以直接 dhcpcd $IFACE
wait-delay 15
post-down /etc/init.d/dhcpcd stop
pre-down cat /var/run/wpa_supplicant.$IFACE.pid | xargs kill也可以使用下面
wpa_supplicant
方式连接认证wifi
.用wpa_passphrase
生成要连接的ssid
与密钥.1
2
3
4
5
6~$ wpa_passphrase my_ssid 12345678
network={
ssid="my_ssid"
#psk="12345678"
psk=b63bb73550b08933c709bbff538af08d29024cbf0790981c116a3210391fe2d0
}使用
systemd
控制
1 | ~$ cat /etc/systemd/system/network-wireless@.service: |
最终的生成的数据如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14~$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
p2p_disabled=1
network={
ssid="my_ssid"
#psk="12345678"
psk=b63bb73550b08933c709bbff538af08d29024cbf0790981c116a3210391fe2d0
#COUNTRY=US
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
}如上所示,在
/etc/network/interfaces
的接口内加入pre-up wpa_supplicant -B -Dnl80211 -i$IFACE -c/etc/wpa_supplicant/wpa_supplicant.conf
方式连接.如果要查看一些调试信息,加上-dd
命令行中.查看状态
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15~$ wpa_cli status
Selected interface 'wlan0'
bssid=22:76:93:00:xx:xx
freq=5200
ssid=my_ssid
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.1.100
address=44:af:28:32:xx:xx
uuid=d52e74ae-991c-5d82-ab4f-80a9f2417de5
ieee80211ac=1使用手机连接到该
wifi
热点上,从手机信息的菜单项查看,是否获取一个240x
开头的IPv6地址.如果有,说明可以使用IPv6
访问网络了,打开test-ipv6.com
测试一下.如果
LAN
的客户端能够正常获取一个PD+MAC
全局地址,但是不能访问IPv6
网络.这就要仔细查看与调试各级路由了.我在此因为设置了动态MAC
,所以造成的路由问题.一般这里上游路由表如下:1
2
3
4
5
6~$ ip -6 route
# 上游路由取得的PD是 2409:xxxx:xxxx:4fc0::/60
default from 2409:xxxx:xxxx:4fc0::/60 via fe80::e681:84ff:fe44:a40f dev pppoe-wan proto static metric 512 pref medium
2409:8a55:2416:4fc0::/64 dev br-lan proto static metric 1024 pref medium
# 这里有一条静态的路由,去到这一级的WAN(wlan0)口的链路地址 fe80::xxxx:xxxx:21ba:6d93,这一条路由可以修改,但是这个客户端断开后,它又会重写回去.
2409:8a55:xxxx:xxxx::/64 via fe80::xxxx:xxxx:21ba:6d93 dev br-lan proto static metric 1024 pref medium刚好我又在这个Linux内安装了
macchanger
这个工具脚本,它链接网卡的启停脚本.所以本机系统每个网卡MAC
会因为每次up|down
后随机产生一个新的地址,所以依赖于MAC
计算出来的本地链路地址也变了,对于LAN口(wlan1)
的地址改变其实没有什么影响,但是WAN口(wlan0)
的地址改变就会影响到上游路由表无法到更新后的链路地址.或者说:本地WAN(wlan0)
的链路地址改变,需同步更改上游路由表,否则本级路由下LAN(wlan)
不能正常访问网络.
1 | /etc/network$ tree if-pre-up.d/ |
macchanger
可以查看硬件真实的MAC
,也可生成随机MAC
并修改它.这里需要在WAN口(wlan0)
固定硬件地址的随机更改.如果要防止它每次重启后随机变动.一种方法确保有下面配置:1
2
3
4~$ cat /etc/NetworkManager/NetworkManager.conf
[....]
[device]
wifi.scan-rand-mac-address=no- 或者使用
macchanger,ip
在/etc/network/interfaces
的里脚本里固定它.修改硬件地址先要关闭硬件功能,有时运行了如:ifdown wlan0 或者 ifconfig wlan0 down
,还是没有关闭硬件,导致无法修改MAC
,此时肯定还有其守护程序在运行,如:wicd
,可以运行systemctl stop wicd
再尝试修改.
Wifi Direct(p2p mode)
1 | ~$ cat /etc/wpa_supplicant/wpa_supplicant.conf |
VirtualBox虚拟机与主机的复制与粘贴
- 一般来说,如果虚拟机(Guest)安装的是
Windows
系统,只要安装VBoxGuestAddions.iso
里的驱动,再在菜单里选择Devices-->Shared Clipboard
方式,就可以与主机(Host)之前的共享复制粘贴了.如果Guest
是Linux
系统,安装完成VBoxGuestAddions.iso
且设置了Shared Clipboard
,然而不能复制的话,可以在Guest
里,运行sudo VBoxClient --clipboard
之后,再尝试上述操作.
VirtualBox在AMD Ryzen 7
运行出现Oops
AMD SME/SEV
相关内容:因为系统是自己编译的
linux-5.15.14
内核,并且选择了CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y
,安装了virtualbox 6.1
,运行VirtualBox
时主界面是正常,启动任意虚拟机时一直卡死在20%
的进度,且无法退出与关闭它。查看dmesg
显示如下错误。
1 | ~$ dpkg -l | grep "virtualbox" |
- 虽然设置了
CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=y
,还是可以通过设置kernel command line
去关闭它的,这里修改如下:
1 | ~$ grep -v '^#\|^$' /etc/default/grub |
- 关闭
AMD SME
之后,重启系统再次运行VirtualBox
就能正常使用了, 关于AMD SME/SEV
在QEMU-KVM
虚拟机支持的非常好。
Android连接USB时,MTP挂载错误.
- 有时会出现如:
error no such interface 'org.gtk.vfs.mount' on object at path /org/gtk/vfs/mount/1
,可以重启系统,也可以尝试如下:- GNOME: killall nautilus
- MATE: killall caja
- Cinnamon: killall nemo
Samba4 共享问题(SMB/CIFS)
- Samaba
- SMB4与前面的版本有一些改动,如:原
security = share
改成了security = user ; map to guest = Bad User
的组合.服务端与客户端的协议版本如果不匹配,也会无法握手连接.可以通过min protocol,client min|max protocol
等参数定制.
1 | grep -v '^#\|^$\|^;\|.*;' /etc/samba/smb.conf |
重启,查看服务.
1
2
3systemctl restart smbd nmbd
systemctl status smbd nmbdtestparm
查验配置文件.1
2
3
4
5
6
7
8
9~$ testparm
Registered MSG_REQ_POOL_USAGE
Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
Load smb config files from /etc/samba/smb.conf
Processing section "[Movies]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions使用
smbclient
查看,可以加入-d<number 0-10>
调试输出.
1 | smbclient -m SMB3 -N -L 192.168.1.100 |
- 调式
smbd,nmbd
输出,可以配置smb.conf
里面的log level = <0-100>
详细级别.1
2~$ smbd -i -l -S
~$ nmbd -i -l -S - 错误
Error NT_STATUS_IO_TIMEOUT
,这个错误最终发现是因服务端系统设置造成的,Samba
的配置并在服务端使用smbclient
测试都OK,而且在Android
手机端是可以查看共享,但是在Win10
端与IPad
不能连接.最后发现是服务端禁止了ping
入造成的.修改成net.ipv4.icmp_echo_ignore_all = 0
就可以连接了.
无法进虚拟终端的问题(Ctrl-Alt-f[1-6])
- NVIDIA
- NVIDIA/Tips and tricks
- Kernel mode setting
- The Framebuffer Console
- 有时新安装了新的(Nvidia)显卡驱动后,发现无法切换到虚拟的终端里,只能使用
Ctrl-Alt-F7
的终端.确认一下/etc/default/grub
内有如内容:1
2
3
4
5
6
7grep -v '^#\|^$' /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="splash"
GRUB_CMDLINE_LINUX="resume=UUID=ae170b9d-832a-46a7-beca-5fb7c9329b1b nomodeset"
GRUB_GFXPAYLOAD_LINUX=keep - 加入
nomodeset
,开启GRUB_GFXPAYLOAD_LINUX=keep
后运行update-grub
,重启系统可能会解决此问题.
一起无法重启networking
服务的问题
1 | ~$ sudo systemctl restart networking.service |
- status
1 | ~$ sudo systemctl status networking.service |
journatctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18sudo journalctl -u networking.service
[...]
Apr 14 19:26:20 debian ifup[916]: dnsmasq: failed to create listening socket for port 53: Address already in use
Apr 14 19:26:20 debian dnsmasq[7338]: failed to create listening socket for port 53: Address already in use
Apr 14 19:26:20 debian dnsmasq[7338]: FAILED to start up
Apr 14 19:26:20 debian ifup[916]: ifup: failed to bring up wlan1
[...]
Apr 14 19:26:20 debian ifup[916]: run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
Apr 14 19:26:20 debian ifup[916]: /sbin/ip addr add 192.168.3.1/255.255.255.0 broadcast 192.168.3.255 dev wlan2 label wlan2
Apr 14 19:26:20 debian ifup[916]: Cannot find device "wlan2"
Apr 14 19:26:20 debian ifup[916]: ifup: failed to bring up wlan2
Apr 14 19:26:20 debian ifup[916]: ifup: configuring interface br-lan=br-lan (inet)
Apr 14 19:26:20 debian ifup[916]: ifup: missing required variable: address
Apr 14 19:26:20 debian ifup[916]: ifup: missing required configuration variables for interface br-lan/inet
Apr 14 19:26:20 debian ifup[916]: ifup: failed to bring up br-lan
Apr 14 19:26:20 debian ifup[916]: ifup: configuring interface wlan0=wlan0 (inet)search
53
service1
2
3
4
5~$ sudo netstat -unlp | grep "53"
udp 0 0 224.0.0.251:5353 0.0.0.0:* 27555/brave --type=
udp 0 0 224.0.0.251:5353 0.0.0.0:* 27555/brave --type=
udp 0 0 127.0.0.1:53 0.0.0.0:* 1/init
udp6 0 0 ::1:53 :::* 1/init
1 | systemctl list-sockets | grep "53" |
- 查看系统启动时的所有错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14~$ systemctl --no-pager --all --state=failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● dokku-retire.service loaded failed failed Dokku retire service
● networking.service loaded failed failed Raise network interfaces
● rc-local.service loaded failed failed /etc/rc.local Compatibility
● systemd-modules-load.service loaded failed failed Load Kernel Modules
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
4 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
让远端的GUI运行到本机界面
SSH X Forwarding
- 这个比较简单,在
/etc/ssh/sshd_config
要有如下设置,再用要ssh -X user@<remote_host>
登录,运行一个类X
的程序,就会出现在本机.
1 | AllowTcpForwarding yes |
- 一般以查看
<remote_host>
里的echo $DISPLAY
变量是localhost:10.0
.
X Server tcp
这里以
lightdm
为例,其它:GDM,XDM
类似.确保/etc/lightdm/lightdm.conf
里有以下行1
2
3
4
5
6
7
8~$ grep -v '^#\|^$' /etc/lightdm/lightdm.conf
[LightDM]
[Seat:*]
xserver-allow-tcp=true
[XDMCPServer]
enabled=true
port=177
[VNCServer]重启本机的
lightdm
服务.就会有发现Xserver
的tcp listen
. 一般来说使用SSH X Fowarding
就可以满足很多场景需求.下面这个例就必须使用Xserver tcp
,如果使用SSH X Forwarding
就出现gtk initialization failed
.1
docker run --device /dev/kvm -e RAM=6 -p 50922:10022 -v $XAUTH:/root/.Xauthority -e DISPLAY=<remote_host>:0.0 docker-osx:latest
上面两个方式还是提示无权连接时,在本机运行
xhost +
再测试.
Linux下IPv6
路由丢失
- 在
Debian
下面遇到过种,不知道过了多久,系统内wlan0
网卡的IPv6
路由不见,但是IPv6
的地址还在.后来发现是sysctl
配置的问题,配置成下面就解决了:1
2net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.wlan0.autoconf = 0
Knot DNS缓存问题
- 之前使用
dnsmasq
做dhcp+dns
同时还支持IPv6
,不知何时dnsmasq
启动时,提示53端口被占,检查发现还是被1/init
进程占住.这里无法通过/proc/1/cmdline
查找.通过find /usr/lib/systemd/system -exec grep -nH "127.0.0.1:53" {} \;
发现在kresd.socket
文件内有如下设置.
1 | tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1/init |
在Debian 10
使用systemed
运行/etc/rc.local
开机自启命令
创建
systemed
服务描述文件.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16~$ cat>/etc/systemd/system/rc-local.service<<EOF
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
StandardOutput=tty
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF创建运行脚本文件,可以把需要运行的命令加入到
exit 0
之前.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16~$cat>/etc/rc.local<<EOF
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
EOF分配运行权限,与开机自运行命令
1
2
3
4~$ chmod +x /etc/rc.local
~$ systemctl enable rc-local
~$ systemctl start rc-local
Linux下安装Xrdp服务
- Ubuntu 18.04: Connect to MATE desktop environment via XRDP
1
~$ apt-get install xrdp
- xRDP uses the /etc/ssl/private/ssl-cert-snakeoil.key
file which belongs to the ssl-cert group. As such we need to add the xRDP user to that group:1
~$ sudo adduser xrdp ssl-cert
- 如果出现
Could not acquire name on session bus
. 需要如下设置:1
2
3
4cat <<EOF> ~/.xsession
unset DBUS_SESSION_BUS_ADDRESS
mate-session
EOF
Linux下运行x11vnc
x11vnc可以支持共享与控制的功能.简单运行如下
1
ssh -t -L 5900:localhost:5900 remote_vnchost 'VNC_PASSWORD=123456 x11vnc -localhost -display :0'
如遇到下面的错误.
1
2
3
4
527/09/2021 20:47:05 Xinerama: no blackouts needed (screen fills rectangle)
27/09/2021 20:47:05
27/09/2021 20:47:05 shmget(fullscreen) failed.
27/09/2021 20:47:05 shmget: No space left on device查看内核设置
1
2
3
4
5
6
7sudo sysctl -a | grep "shm"
kernel.shm_next_id = -1
kernel.shm_rmid_forced = 0
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
kernel.shmmni = 4096
vm.hugetlb_shm_group = 0需要把
kernel.shmmni
增加到8192
.
systemd
1 | ~$ cat /etc/systemd/system/x11vnc.service |
rime
同文输入法
Rime
是一个跨平台的输入框架.它的核心(或者说’后端’)是librime
引擎,不同平台的前端实现共用这个后端.目前在GitHub RIME
组织中维护的前端实现有三个:
用于 Windows 的 Weasel 「小狼毫」;
用于 macOS 的 Squirrel 「鼠须管」;
用于 Linux 的 ibus-rime 「中州韵」——Rime 本身的中文名字也叫「中州韵输入法引擎」.同步之后可以看到文件夹下的相关配置,基本上和桌面版的
RIME
是一致的:
default.yaml,各输入方案共享的全局配置
default.custom.yaml,(可选)对 default.yaml 的修改,不会随着客户端的更新而被覆盖,所以对default
的修改可以通过patch
的方式放入该配置文件
xxx.schema.yaml,xxx 输入方案的配置
xxx.custom.yaml,(可选)对 xxx.schema.yaml 的自定义修改
xxx.dict.yaml, xxx 输入方案的词库(字典)这里主要是记录网上链接,各种配置与词库都是热心网友供献,你可以稍作修改,或者不作修改都能有很好的体验.如果自已有空也可以定制出自已的风格,且可以同步各种平台上使用.
Youtube-dl使用
1 |
|
通过ADB安装程序到小米电视机
一般旧的电视视
MiTv
通过设置设置-->账号与安全-->允许安装未知来源的应用
后,再把相应的apk
复现到U盘接入后,可以直选择到文件,进行安装。还有另一种方式,稍微麻烦一的。开启
debug
调式模式:设置-->关于-->产品型号
遥控连续按5下OK键.打开后,界面有提示。再通过设置设置-->账号与安全-->允许ADB调试
允许调试。下面就是adb
的操作了。如:本电视机的IP是192.168.1.130
1 | ~$ adb connect 192.168.1.130:5555 |
adb shell
上传程序
1 | ~$ adb push kodi-20.1-Nexus-armeabi-v7a.apk /mnt/sdcard/Download |
- 安装程序
1 | ~$ adb install kodi-20.1-Nexus-armeabi-v7a.apk |
- 出现错误
Failure [INSTALL_FAILED_OLDER_SDK]
,说明系统版本太旧,SDK
不能兼容,旧的电视机只能安装降低版本的apk
HP
笔记本TouchPad
问题
Dell Precision 7550 physical mouse buttons behaving like clickpad
Clickpad left click not working on Ubuntu 20.04 when touchpad is not touched
新装有笔记本的电脑的
TouchPad
不能轻敲代替点击,需要按下物理键才行。1
2
3
4
5
6
7
8
9
10
11
12
13
14~$ xinput list
\u23a1 Virtual core pointer id=2 [master pointer (3)]
\u239c \u21b3 Virtual core XTEST pointer id=4 [slave pointer (2)]
\u239c \u21b3 SYNA30AA:00 06CB:CDEB Mouse id=12 [slave pointer (2)]
\u239c \u21b3 SYNA30AA:00 06CB:CDEB Touchpad id=13 [slave pointer (2)]
\u23a3 Virtual core keyboard id=3 [master keyboard (2)]
\u21b3 Virtual core XTEST keyboard id=5 [slave keyboard (3)]
\u21b3 Power Button id=6 [slave keyboard (3)]
\u21b3 Video Bus id=7 [slave keyboard (3)]
\u21b3 Video Bus id=8 [slave keyboard (3)]
\u21b3 Power Button id=9 [slave keyboard (3)]
\u21b3 Sleep Button id=10 [slave keyboard (3)]
\u21b3 HP HD Camera: HP HD Camera id=11 [slave keyboard (3)]
\u21b3 AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
1 | ~$ xinput list-props "SYNA30AA:00 06CB:CDEB Touchpad" | grep -i click |
- 把
Synaptics ClickPad
设置为0
.就能正常使用了。1
102 xinput set-prop "SYNA30AA:00 06CB:CDEB Touchpad" "Synaptics ClickPad" 0
Vim
无法使用YouCompleteMe
的插件
- 已经进入到目录里并且安装:
~/.vim/bundle/YouCompleteMe && ./install.py --all
,但是运行还是出现如下的错误。
1 | ~$ vim |
- 进入
vim
,运行::echo has("python_dynamic")
,:echo has("python_dynamic")
都是返回0
,说明没有加载到python
,可以运行::help python-dynamic
查看相关的帮助文档。 - 运行
vim --version
查看详情
1 | ~$ vim --version |
- 上面显示
-python,-python3
. 安装apt-get install vim-nox vim-youcompleteme
就能正常使用了。