电脑使用Android的网络
sudo pacman -S usb_modeswitch
手机打开网络共享
Android使用usb连接电脑网络
yay -S gnirehte
gnirehtet run
Android 投屏到电脑
sudo pacman -S scrcpy
scrcpy
Plasma KDE Screen Locking Picture of the Day 每日一图的图片缓存位置
~/.cache/plasma_engine_potd
Where is Bing's Picture of the Day stored on my system?
Gwenview支持avif格式图片
sudo pacman -S kimageformats shared-mime-info libavif
EXT4 分区修复
检查文件系统并在发现任何错误时进行修复
umount /dev/sdb3
e2fsck -p /dev/sdb3
NTFS硬盘无法打开
fdisk -l # 查看硬盘名称
sudo mount -t ntfs3 /dev/sdc1 /mnt
# 报错
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
#修复
sudo ntfsfix -d /dev/sdc1
sudo mount -t ntfs3 /dev/sdc1 /mnt
配置DNS
创建修改配置文件
vim /etc/NetworkManager/conf.d/01-dns.conf
加入以下两行,防止NetworkManager修改resolv.conf文件
[main]
dns=none
修改隐藏权限,去掉只读
lsattr /etc/resolv.conf
chattr -i /etc/resolv.conf
vim /etc/resolv.conf
加入以下两行
nameserver 223.5.5.5 # 阿里巴巴
nameserver 223.6.6.6 # 阿里巴巴
nameserver 8.8.8.8
nameserver 8.8.4.4
systemctl restart NetworkManager
chattr +i /etc/resolv.conf # 加上只读隐藏权限
lsattr /etc/resolv.conf
使用DOH 加密DNS
pacman -S dns-over-https
修改hosts顺序
vim /etc/nsswitch.conf
hosts: myhostname mymachines resolve [!UNAVAIL=return] files dns
配置DOH客户端
vim /etc/dns-over-https/doh-client.conf
修改
upstream_selector = "weighted_round_robin"
增加DOH地址
[[upstream.upstream_ietf]]
url = "https://223.5.5.5/dns-query"
weight = 50
修改 /etc/resolv.conf 文件
nameserver ::1
nameserver 127.0.0.1
options edns0 single-request-reopen
设置开机自启并立即启动
sudo systemctl start doh-client.service
sudo systemctl enable --now doh-client.service
sudo systemctl status doh-client.service # 服务的状态
sudo systemctl restart doh-client.service
sudo systemctl is-enabled doh-client.service #是否开机时启动
sudo systemctl list-units --type=service #查看系统中所有正在运行的服务以及它们的状态
查看是否生效
pacman -S dnsutils
nslookup www.baidu.com # 显示是本地IP则已经生效
Server: ::1
Address: ::1#53
pacman -Syu时,error: could not open file /var/lib/pacman/local/cemu-2.0.439-2/files: No such file or directory
ls查看此目录显示cannot access 'desc': Structure needs cleaning。
用一下方法:
sudo rm -r /var/lib/pacman/local/cemu-2.0.439-2
sudo pacman -S --dbonly cemu
不行再尝试以下:
$df -h
/dev/sdb3 12G 2.0G 9.2G 18% /var
## 备份sdb3
dd if=/dev/sdb3 of=/path/to/backup.img bs=1M
# 重启系统,进入命令界面
$umount /dev/sdb3 # 卸载
$fsck.ext4 /dev/sdb3 -y # 修复
# 重启查看,若进入系统有问题,需要恢复备份
$dd if=/path/to/backup.img of=/dev/sdb3 bs=1M
Linux备份与恢复的命令和使用方式:保障数据安全和业务连续性
[问题] Wifi连接时间长,wifi连接时断时连
由于iwd和NetworkManager连接网络产生了冲突,进行以下操作并重启
systemctl list-unit-files # 查看iw是否开启
# 下面显示都开启,需要关闭iwd
iwd.service enable disabled
NetworkManager.service enabled disabled
# 确保iwd开机处于关闭状态
sudo systemctl disable iwd
# 立即关闭iwd
sudo systemctl stop iwd
# 启动NetworkManager
sudo systemctl enable --now NetworkManager
[问题] wine启动某些应用,后台没报错,界面不显示
去WineHQ查看相关应用说明,查看是否需要安装组件或字体
$ winetricks mfc42
$ winetricks droid
[问题] wine报错winediag:ntlm_check_version ntlm_auth was not found. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
pacman -S samba
[问题]service:scmdatabase_autostart_services Auto-start service L"WineBus" failed to start: 105
How to prevent Wine from launching native mono apps?
$ xdg-mime query default application/x-ms-dos-executable
[问题]wine执行exe时报错误 [VGL] ERROR: Could not open display :8
使用以下命令执行
optirun bash -c "wine [your game] && wineserver -w"
[VGL] ERROR: Could not open display :8 if a program forks and exits optirun #42
[问题] ArchLinux下开启MagicSysRq组合键
用于系统完全死机时,重新启动计算机
Alt+SysRq+REISUB,简单记忆为「Reboot Even If System Utterly Broken」
开启方法:
以下代码写入文件:/etc/sysctl.d/99-sysctl.conf
kernel.sysrq = 1
然后重载系统所有配置或者仅重载 /etc/sysctl.d/99-sysctl.conf 配置文件:
sudo sysctl --system
sudo sysctl --load=/etc/sysctl.d/99-sysctl.conf
[问题]pacman 设置代理
export http_proxy="..."
export https_proxy="..."
sudo -E pacman -Syu
# 或者修改 /etc/sudoers
Defaults env_keep += "ftp_proxy http_proxy https_proxy no_proxy"
[问题]pacman 更新失败后,启动报错
大概率是连接服务器更新失败
1、 sudo pacman -Syu 更新时大量报错
==> ERROR: module not found: 'usbhid'
==> ERROR: module not found: xxxx
==> WARNING: No modules were added to the image. This is probably not what you want.
解决:不要重启,需要重新执行命令
sudo pacman -S linux #重装linux
sudo mkinitcpio -P linux #重新生成镜像
2、重启后报错
mount: /new_root:unknown filesystem type 'ext4'.
dmesg(1) may have more information after failed mount system call.
You are new being dropped into an emergency shell.
sh: can`t access tty; job control turned off
查看pacman日志
...
creating zstd-compressed initcpio image: '/boot/initramfs-linux-faillback.img'
WARNING: No modules were added to the image.This is probably not what you want.
Running build hook:[fsck]
ERROR: module not found: 'ps2mult'
ERROR: module not found: 'ps2_gpio'
...
解决:
若已经进不去系统,则用Live CD启动linux
# 1.连接网络
iwctl #执行iwctl命令,进入交互式命令行
device list #列出设备名,比如无线网卡看到叫 wlan0
station wlan0 scan #扫描网络
station wlan0 get-networks #列出网络 比如想连接YOUR-WIRELESS-NAME这个无线
station wlan0 connect YOUR-WIRELESS-NAME #进行连接 输入密码即可
exit #成功后exit退出
# 2.根据系统情况挂在目录
mount /dev/sdb2 /mnt
mount /dev/sda1 /mnt/efi
mount /dev/sda3 /mnt/var
mount /dev/sda4 /mnt/home
# 3.重新安装linux
arch-chroot /mnt
pacman -S linux
若不行可以降级系统,去/var/cache/pacman/pkg 寻找旧的安装包,命令例如:
># pacman -U linux-3.5.6-1-x86_64.pkg.tar.xz linux-headers-3.5.6-1-x86_64.pkg.tar.xz virtualbox-host-modules-4.2.0-5-x86_64.pkg.tar.xz
[问题]系统报 Failed to create sink input: sink is suspended 错误
应该是由于PulseAudio的问题导致,建议直接用新一代PipeWire替换掉PulseAudio和Jack即可解决。
# 1.关掉,禁用pulseaudio的服务和socket
$ systemctl --user stop pulseaudio.{service,socket}
$ systemctl --user disable pulseaudio.{service,socket}
# 2.安装
$ pacman -S pipewire pipewire-pulse pipewire-jack #选装 pipewire-alsa
$ pacman -S wireplumber # 会话管理器
# 3.启动
$ systemctl --user start pipewire pipewire-pulse
[问题]密码忘记或误修改文件导致无法登录系统
1,GNU GRUB version中选中Arch Linux
2,按e键进入修改界面
3,在linux /boot/vmlinuz-linux 一行末尾加入 init =/bin/bash
4,按ctrl+x或F10,进入单用户模式
5,此时已经可以修改文件,去将误修改的文件还原即可
6,重新以读写的方式挂载根文件系统
# mount -n -o remount,rw /
7,修改root密码
# passwd
‘password updated successfully’.
8,最后,运行下面的命令来保存更改并启动ArchLinux。
# exec /sbin/init
[问题]系统hibernate后唤醒时画面卡死,有时需要等待几分钟后才能操作,或一直卡死
lsblk -f # 查看根目录/的UUID
配置GRUB_CMDLINE_LINUX_DEFAULT,加入
root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3
/etc/default/grub完整如下:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=5 nowatchdog root=UUID=560a74f2-582b-45c8-99c7-5572e592e263 resume=UUID=560a74f2-582b-45c8-99c7-5572e592e263 resume_offset=745472"
Hibernate doesn't work after hibernate
Persistent block device naming
[问题]卸载optimus-manager后,无法进入kde
yay -Rns optimus-manager optimus-manager-qt # 卸载optimus-manager
将/etc/X11/xorg.conf删除
[问题] 睡眠后唤醒时卡死,显示以下信息
ata6.00: supports DRM functions and may not be fully accessible
ata1.00: ATA identify device log not supported
用lspci查看
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01)
...
ModuleNotFoundError: No module named 'optimus_manager'
/usr/lib/systemd/system-sleep/optimus-manager.py failed with exit status 1.
最后发现是因为optimus-manager导致,卸载optimus-manager,安装bumblebee后恢复正常
Trouble mounting microSD card
ArchLinux无法正常休眠或挂起
Realtech PCI Card Reader HOW TO
Card Reader RTL8411B
Startx - AddScreen/ScreenInit Faild - Asus N76V - GT 650M
[问题] 桌面崩溃,黑屏后重启
killall plasmashell # 杀死进程
kstart5 plasmashell # 开启进程
kquitapp5 plasmashell # 退出桌面
[问题] error while loading shared libraries: libpcap.so.0.8:cannot open shared object file: No such file or directory
$ locate libpcap
/usr/lib64/libpcap.so <-- was one among many results for me
$ cd /usr/lib64/ # go to that directory
$ sudo ln -s libpcap.so libpcap.so.0.8 # create a symlink to libpcap.so.0.8 from libpcap.so (or whatever you actually have instead)
$ cd - # go back to your bettercap directory
[问题]系统hibernate后休眠时无法切断电源的问题
修改/etc/systemd/sleep.conf文件,打开HibernateMode的注释,值设为shutdown
[Sleep]
# A fix for unable to poweroff after hibernation
# HibernateMode= plantform shutdown
HibernateMode=shutdown
解决 systemd 休眠时无法切断电源的问题
Arch Wiki - System does not power off when hibernating