使用linux遇到的各种问题-总集篇

2023-03-27

更改内核后的GRUB提示

:: To use the new features provided in this GRUB update, it is recommended
  to install it to the MBR or UEFI. Due to potential configuration
  incompatibilities, it is advised to run both, installation and generation
  of configuration:
    $ grub-install ...
    $ grub-mkconfig -o /boot/grub/grub.cfg

解决QT系应用程序的缩放问题

QT_SCREEN_SCALE_FACTORS=1

在执行应用程序之前加上这个,可以让QT应用程序忽略系统缩放. 这对OpenToonz这样的软件很有用啊.

用Pacman查询、安装所有可选依赖

2023.1.28
查询所有的依赖项(使用 expac)

sudo pacman -S expac
expac -S '%o' wine-staging

安装所有可选的依赖项(作为依赖项 –asdeps)

sudo pacman -S --asdeps $(expac -S '%o' wine)

重要的是要注意,我们应该在此处使用 --asdeps 参数将这些软件包的安装原因标记为“依赖”(否则,这些软件包将被标记为“明确”安装)。这意味着,如果您卸载主软件包,则这些可选的依赖项将被孤立-不过您也可以通过一个命令安全地卸载它们(您可以经常运行该命令来清理任何孤立的孤儿包):

删除没用的组件:

pacman -Rsn $(pacman -Qdtq)

重新安装Arch后该做的事

  • 关闭pcspkr
  • 找到并启动 Clash For Windows
  • 想办法安装 yay
  • 添加源: archlinuxcnarch4edu, 启用 multilib
[archlinuxcn]
Server = https://mirrors.bfsu.edu.cn/archlinuxcn/$arch

[arch4edu]
Server = https://mirrors.bfsu.edu.cn/arch4edu/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/arch4edu/$arch

安装并配置 fcitx5. 部分需要的组件在第三方源里.记得看Wiki

安装 steam

安装并配置Flatpak

yay -S flatpak

RyuSak: 一个很适合搭配Ryujinx使用的工具.好东西啊

安装缺失固件和驱动程序

# 安装蓝牙驱动,

# 安装nvidia驱动
yay -S nvidia

yay -S mkinitcpio-firmware upd72020x-fw aic94xx-firmware wd719x-firmware
# 用于解决编译时的warning. 有一个warning是关于consolefont的,根据arch社区的回答,把/etc/mkinitcpio.conf文件中的HOOKS中的consolefont删掉就行,再编译就没有warning

yay -S libappindicator-gtk3, libappindicator-gtk2 appmenu-gtk-module   #解决appmenu全局菜单的问题.

KDE相关:

sudo pacman -S expac ark # Ark解压缩软件
sudo pacman -S --asdeps $(expac -S '%o' ark)
sudo pacman -S sshfs kimageformats qt5-imageformats # 依赖
sudo pacman -S gwenview kdeconnect yakuake # 常用KDE系

XBOX手柄驱动

yay -S xow-git
sudo systemctl enable xow.service

VSCODE相关

yay -S code code-features, code-marketplace

VirtualBox

yay -S virtualbox-host-modules-arch virtualbox

Arch和OpenWRT的源

Arch Linux 本体

挑一个顺眼的用吧:

## Arch Linux
Server = https://mirrors.163.com/archlinux/$repo/os/$arch
Server = https://mirrors.aliyun.com/archlinux/$repo/os/$arch
Server = https://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.hit.edu.cn/archlinux/$repo/os/$arch
Server = https://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.nju.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.njupt.edu.cn/archlinux/$repo/os/$arch
Server = https://mirror.redrock.team/archlinux/$repo/os/$arch
Server = https://mirrors.shanghaitech.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.wsyu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.zju.edu.cn/archlinux/$repo/os/$arch

OpenWRT

src/gz openwrt_base https://downloads.openwrt.org/releases/22.03.0/packages/aarch64_generic/base
src/gz openwrt_luci https://downloads.openwrt.org/releases/22.03.0/packages/aarch64_generic/luci
src/gz openwrt_packages https://downloads.openwrt.org/releases/22.03.0/packages/aarch64_generic/packages
src/gz openwrt_routing https://downloads.openwrt.org/releases/22.03.0/packages/aarch64_generic/routing
src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.0/packages/aarch64_generic/telephony
src/gz friendlywrt_packages file://opt/packages

clash_verge 权限问题

2024.12.31记:现在用上sing-box了,没这么多麻烦事了。但是还是得整理下。

群友建议我使用一个叫做 cgproxy的东西实现TUN.

sudo setcap cap_net_bind_service,cap_net_admin=+ep /usr/bin/clash
https://github.com/zzzgydi/clash-verge/issues/182
https://github.com/Dreamacro/clash/issues/2146
https://github.com/zzzgydi/clash-verge/releases/tag/v1.3.2

使用premium内核可避免鉴权问题?

Cockpit的第三方组件库:

官方:
cockpit-storaged
cockpit-networkmanager
cockpit-packagekit
cockpit-machines
cockpit-podman
cockpit-selinux
cockpit-kdump
cockpit-certificates
cockpit-sosreport

REDHEAT:
cockpit-389-ds
cockpit-session-recording
cockpit-ovirt-dashboard

第三方:
cockpit-zfs
cockpit-sensors

Dolphin的右侧播放器失效解决

Dolphin右侧播放媒体文件失败,可以安装 gst-plugins-good来解决.

Flatpak初始化,添加特殊的源

Flathub

# 官方源: https://dl.flathub.org/repo/ 

# Fedora
flatpak remote-add --user --if-not-exists fedora oci+https://registry.fedoraproject.org


# Flathub beta
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo


# Elementary
flatpak remote-add --user --if-not-exists appcenter https://flatpak.elementary.io/repo.flatpakrepo
Mi lista de repos flatpak

Flathub:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Gnome Stable:

flatpak remote-add --if-not-exists gnome https://sdk.gnome.org/gnome.flatpakrepo
flatpak remote-add gnome-apps https://sdk.gnome.org/gnome-apps.flatpakrepo

Gnome Development/Unstable

flatpak remote-add --gpg-import=nightly.gpg gnome-nightly http://sdk.gnome.org/nightly/repo
flatpak remote-add --if-not-exists gnome-nightly https://sdk.gnome.org/gnome-nightly.flatpakrepo
flatpak remote-add gnome-apps-nightly https://sdk.gnome.org/gnome-apps-nightly.flatpakrepo

KDE Plasma Flatpak

flatpak remote-add --if-not-exists kdeapps --from https://distribute.kde.org/kdeapps.flatpakrepo

Deepin Linux:

flatpak remote-add --no-gpg-verify --if-not-exists deepin http://proposed.packages.deepin.com/deepin-flatpak/deepin/ --system
flatpak remote-add --no-gpg-verify --if-not-exists deepin-apps http://proposed.packages.deepin.com/deepin-flatpak/apps/ --system
Instalar el Runtime necesario (Recomiendo los dos):
sudo flatpak install deepin com.deepin.Platform/x86_64/15.5.1
sudo flatpak install deepin com.deepin.Platform/x86_64/15.5.2

sudo flatpak remote-ls deepin-apps --user

Liri OS:

flatpak remote-add liri https://repo.liri.io/flatpak/liri.flatpakrepo
flatpak --user install liri io.liri.Platform
flatpak --user remote-ls

Install Browser:
flatpak --user install https://repo.liri.io/flatpak/io.liri.Browser.flatpakref
Install Calculator:
flatpak --user install https://repo.liri.io/flatpak/io.liri.Calculator.flatpakref
Install Files:
flatpak --user install https://repo.liri.io/flatpak/io.liri.Files.flatpakref
Install Text:
flatpak --user install https://repo.liri.io/flatpak/io.liri.Text.flatpakref

LibreOffice Version Flatpak (Tener pŕeviamente el repo de Gnome e instalar org.gnome.Platform)
flatpak install gnome org.gnome.Platform//3.24
flatpak install --user --from http://download.documentfoundation.org/libreoffice/flatpak/LibreOffice.flatpakref

Flatpak删去不用的东西的数据

删除没用的数据

flatpak uninstall --delete-data

删除无用依赖

flatpak uninstall --unused

JetBrains系软件Flatpak下的输出

https://www.flathub.org


Warning: You are running an unofficial Flatpak version of PyCharm !!!


Please open issues under: https://github.com/flathub/com.jetbrains.PyCharm-Community/issues

This version is running inside a container and is therefore not able
to access SDKs on your host system!

To execute commands on the host system, run inside the sandbox:

$ flatpak-spawn --host

To make the Integrated Terminal automatically use the host system's shell,
you can modify Settings > Tools > Terminal > Shell path to /usr/bin/env -- flatpak-spawn --host bash:

This flatpak provides a standard development environment (gcc, python, etc).
To see what's available:

$ flatpak run --command=sh com.jetbrains.PyCharm-Community
$ ls /usr/bin (shared runtime)
$ ls /app/bin (bundled with this flatpak)

To get support for additional languages, you have to install SDK extensions, e.g.

$ flatpak install flathub org.freedesktop.Sdk.Extension.php74
$ flatpak install flathub org.freedesktop.Sdk.Extension.golang
$ FLATPAK_ENABLE_SDK_EXT=php74,golang flatpak run com.jetbrains.PyCharm-Community
or to enable all of them:
$ FLATPAK_ENABLE_SDK_EXT="*" flatpak run com.jetbrains.PyCharm-Community

You can use

$ flatpak search TEXT

to find others.

https://www.flathub.org


Warning: You are running an unofficial Flatpak version of IntelliJ CLion !!!


Please open issues under: https://github.com/flathub/com.jetbrains.CLion/issues

This version is running inside a container and is therefore not able
to access SDKs on your host system!

To execute commands on the host system, run inside the sandbox:

$ flatpak-spawn --host

To make the Integrated Terminal automatically use the host system's shell,
you can modify Settings > Tools > Terminal > Shell path to /usr/bin/env -- flatpak-spawn --host bash:

This flatpak provides a standard development environment (gcc, python, etc).
To see what's available:

$ flatpak run --command=sh com.jetbrains.CLion
$ ls /usr/bin (shared runtime)
$ ls /app/bin (bundled with this flatpak)

To get support for additional languages, you have to install SDK extensions, e.g.

$ flatpak install flathub org.freedesktop.Sdk.Extension.php74
$ flatpak install flathub org.freedesktop.Sdk.Extension.golang

To enable selected extensions, set FLATPAK_ENABLE_SDK_EXT environment variable
to a comma-separated list of extension names (name is ID portion after the last dot):

$ FLATPAK_ENABLE_SDK_EXT=php74,golang flatpak run com.jetbrains.CLion

To make this persistent, set the variable via flatpak override:

$ flatpak override --user com.jetbrains.CLion --env=FLATPAK_ENABLE_SDK_EXT="dotnet,golang"

You can use

$ flatpak search TEXT

to find others.

Wayland无法载入,修改内核参数

检查我们的驱动程序是否在模式设置模式下运行:
cat /sys/module/nvidia_drm/parameters/modeset
它应该打印“Y”。如果没有,请修改内核命令行并添加行 。在您的发行版中搜索“内核参数”;https://wiki.archlinux.org/index.php/Kernel_parameters 是一个很好的起点。nvidia-drm.modeset=1

Docker部署

部署HatH

docker run -d \
  --restart=unless-stopped \
  --name hath \
  --user 1000:1000 \
  -v /home/zincles/hath/cache:/hath/cache \
  -v /home/zincles/hath/data:/hath/data \
  -v /home/zincles/hath/download:/hath/download \
  -v /home/zincles/hath/log:/hath/log \
  -v /home/zincles/hath/tmp:/hath/tmp \
  -e HATH_CLIENT_ID=YOUR_ID_HERE \
  -e HATH_CLIENT_KEY=YOUR_CLIENT_KEY_HERE \
  -e UMASK=000 \
  -e TZ=Asia/Shanghai \
  -p YOUR_PORT:YOUR_PORT \
  frosty5689/hath

搭建USBEAM_Lan_Party

sudo docker run -d --restart=always \
	--cap-add=NET_ADMIN \
	-v ./lan-party:/lan-party/data \
	-p 3075:3075/tcp \
	-p 3074:3074/udp \
	--name=lan-party \
	nouko61/usbeam-lan-party

sudo docker run -d --restart=always \
	--cap-add=NET_ADMIN \
	-v ./lan-party:/lan-party/data \
	-p 10745:3074/udp \
	-p 10746:3075/tcp \
	--name=lan-party \
	nouko61/usbeam-lan-party
# Podman运行Jellyfin实例:
podman run -d -p 8096:8096 -v 配置文件路径:/config -v 媒体文件路径:/media   docker.io/jellyfin/jellyfin
# Postgres
docker run -d --name postgres-on-podman -e POSTGRES_PASSWORD=1720 -p 5432:5432 docker.io/library/postgres
#psql -d postgres -U gaussdb -W'1720' -h 0.0.0.0 -p 15432
# 如此会创建一个名为postgres的用户,密码为1720

搭建LibreTranslate实例:
home/libretranslate/.local < -- volume: libretranslate

docker run -ti -p 5000:5000  -v libretranslate:/home/libretranslate/.local docker.io/libretranslate/libretranslate --update-models

Docker配置Mysql

配置Mysql:

# dockerhub上的提示
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag


docker run --name java-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql

# 我的方案:
docker run --name java-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest

Docker_Podman

Docker/podman相关

# 使用Podman安装Wordpress:

# 创建Pod,用于容纳WordPress和MySQL
podman pod create --name=wordpress --publish=18585:80 --hostname=mysql  


# 创建MySQL, 并设定初始用户和root用户
podman run -d --pod=wordpress       \ # 指定Pod
-e MYSQL_USER=user                  \ # 默认用户
-e MYSQL_PASSWORD=pass              \ # 默认用户密码
-e MYSQL_ROOT=redhat                \ # root用户
-e MYSQL_ROOT_PASSWORD=pass         \ # root用户密码
-e MYSQL_DATABASE=db mysql:latest


# 创建WordPress实例, 设定默认使用的数据库
podman run --name=wordpresscntr --pod=wordpress  \   # 指定Pod
-e WORDPRESS_DB_HOST=mysql                       \   # 啥意思?
-e WORDPRESS_DB_USER=user                        \   # 用户
-e WORDPRESS_DB_PASSWORD=pass                    \   # 密码
-e WORDPRESS_DB_NAME=db                          \   # 数据接口名称
-d docker.io/library/wordpress