本文用于记录在使用Fedora的过程中遇到的种种问题

Basic

sudo dnf install rpmfusion-nonfree-release
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install shttps://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin && sudo dnf groupupdate sound-and-video

右键 open in Terminal

open terminal in nautilus,该功能可以在nautilus中开启,或执行如下命令

sudo dnf install gnome-terminal-nautilus
nautilus -q

删除多余内核

Fedora更新比较频繁,这表示系统中会又多个内核,系统默认只保存3个版本内核,但也可以自己手动删除

# 查看当前内核 避免删除当前内核
uname -r
 
# 查看所有内核
rpm -qa kernel-core

# 删除指定内核
dnf remove kernel-core-4.15.17-200.fc26.x86_64

当删除多余的内核后,与之相关的启动项在重启后也会自动消失

修改启动项顺序

# 产看所有启动项完成名称,menuentry后跟着的就是完整名称
cat /boot/grub2/grub.cfg | grep menuentry

# 修改默认启动项()
grub2-set-default 'Fedora (4.16.3-301.fc28.x86_64) 28 (Workstation Edition)'

# 查看默认启动项(验证修改结果)
grub2-editenv list

# 生成配置文件使修改生效
grub2-mkconfig -o /boot/grub2/grub.cfg

update from 28 to 29

sudo dnf upgrade --refresh
sudo dnf install dnf-plugin-system-upgrade
sudo dnf system-upgrade download --refresh --releasever=29
sudo dnf system-upgrade reboot

升级后问题

  1. Nvidia驱动问题
# reinstalled nvidia driver
sudo dnf remove \*nvidia\*
sudo dnf install akmod-nvidia
  1. 更新tmux的Powerline
pip install --user powerline-status
pip show powerline-status

修改配置文件~/.tmux.conf

powerline_root="/home/root/.local/lib/python3/site-packages"
source "${powerline_root}/powerline/bindings/tmux/powerline.conf"

reference

shutdown too slow

A stop job is running for /etc/rc.d/rc.local Compatibility (3min 54s / no limit)

可能跟Docker有关,在关机时Docker的一个无法通过kill立即关闭,需要等待很长时间(20min左右)

解决:
/etc/systemd/system/multi-user.target.wants/rc-local.service文件中的[Service]项中添加TimeoutStopSec=10
TimeoutStopSec默认为0,则表示没有时间显示。设定值后,则在10s后如果仍有程序运行则会调用kill -9立即关闭

wifi 密码保存位置

/etc/sysconfig/network-scripts

安装Chrome

cat << EOF > /etc/yum.repos.d/google-chrome.repo
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
enabled=1
enabled_metadata=1
EOF
dnf install google-chrome

截屏

直接保存成图片

  • PrintScreen – Takes a screenshot of your entire desktop and saves it to the Pictures folder.
  • Alt + PrintScreen – Saves a screenshot of the focused window to the Pictures Folder
  • Shift + PrintScreen – Lets you select an area of the screen, and saves to the Pictures Folder

截屏到剪切板

  • Ctrl + PrintScreen – Takes a screenshot of your entire desktop and copies it to the clipboard.
  • Ctrl + Alt + PrintScreen – copies a screenshot of the focused window to the clipboard.
  • Ctrl + Shift + PrintScreen – Lets you select an area of the screen, and copies it to the clipboard.
  • Ctrl + Shift + Alt + R – Records a Screencast) of your entire desktop and saves it to your Videos folder.

制作启动图标

启动图标相当于Windows的开始菜单快捷方式,存放在/usr/share/applications/ or /usr/local/share/applications or ~/.local/share/applications目录下, 只需根据规定格式编写一个.desktop文件即可

# Create desktop entry
sudo touch /usr/share/applications/gitkraken.desktop

# copy the following contents into gitkraken.desktop file:
echo "
[Desktop Entry]
Name=GitKraken
Comment=Git Flow
Exec=/opt/gitkraken/gitkraken
Icon=/opt/gitkraken/icon.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;Development;" | sudo tee -a /usr/share/applications/gitkraken.desktop >/dev/null

DNF 安装时下载的package缓存位置

/var/cache/dnf文件夹下根据相应的repo子文件夹下

DNF 使用代理

/etc/dnf/dnf.conf

proxy=socks://127.0.0.1:1080

Python tkinter

随系统安装的Python不包含图形界面的内容需要手动安装

dnf install python3-tkinter

挂载windows共享文件

sudo mount -t cifs -o username=winUser,password=winPwd,gid=1000,uid=1000 //winPC-Name/share /home/fedoraUser/folder

兼容exFat格式U盘

dnf install fuse-exfat

启动时间

systemd-analyze blame

reference

Telegram

# replace 'X' with your fedora version number.
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-X.noarch.rpm
sudo dnf install telegram-desktop

Can’t use ssh key after upgrade to Fedora 33

ssh CloudServer -v
# debug1: send_pubkey_test: no mutual signature algorithm

Fedora修改了加密策略Changes/StrongCryptoSettings2, 默认不支持RSA的加密算法。两种解决方案:

  1. .ssh/config中添加PubkeyAcceptedKeyTypes=ssh-rsa手动指定加密算法
  2. 使用支持的加密算法(如: ECDSA)重新生成ssh key

Nvidia Driver

sudo dnf install akmod-nvidia
sudo akmods --force
sudo dracut --force

fedora nvidia kernel module missing falling back to nouveau错误

BIOS的Secure boot必须关闭,否则无法加载nvidia模块 注意视频线所插入的接口位置,必须是Nvidia显卡的接口,如果不是则会出错误

reference

I had to uninstall everything nvidia, then reinstall the nvidia modules. Nvidia is now working great on fedora 36.

sudo dnf remove *nvidia*

sudo dnf install akmod-nvidia

Trivia

# 检查libname是否被安装及安装位置
ldconfig -p | grep libname

log

dnf install libpcap-devel

bluetooth

Bluetooth无法打开,查看bluetooth.service状态

systemctl status bluetooth
# Failed to set mode: Blocked through rfkill (0x12)

使用rfkill查看状态,发现bluetoothblock了,解锁后重启bluetooth.service即可

sudo rfkill unblock bluetooth
sudo systemctl restart bluetooth

debug with root permission in vscode

  1. 将当前用户配置为无需密码执行sudo
sudo visudo
# add user_name ALL=(ALL) NOPASSWD:ALL in file
  1. run gdb with sudo
sudo vim gdbsudo
# #!/bin/sh
# sudo gdb "$@"
sudo chmod 0755 gdbsudo
  1. 使用制定路径的gdb

launch.json

"miDebuggerPath": "/usr/libexec/gdbsudo"