039 Log of migrating to Linux

发布于

Newbie


Boot Failed: Failed to start Remount Root and Kernel File Systems

Terminal window
# ls all drivers info
$ blkid
# check `fstab` file, find a wrong value
$ cat /etc/fstab
# I don't know how to copy and paste in terminal...
# So, edit driver's id to `/dev/sda1`
$ vi /etc/fstab
# reboot machine
# edit `/etc/fstab` <file system> value to UUID of each driver

ref:
Boot Failed: Failed to start Remount Root and Kernel File Systems


Set custom resolution

System Setting ->> Hardware Configuraion ->> Display controller ->> video-modesetting & video-vesa
After these 2 driver installed, my monitor display in a wrong resolution or just go black after reboot

Terminal window
# list ports of your video card
$ xrandr --props
# generate a "modeline" with cvt
# eg. 4k monitor in 60FPS
$ cvt 3840 2160 60
# 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
# edit Xsetup file
$ sudo vim /usr/share/sddm/scripts/Xsetup
# add following
xrandr --newmode "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
xrandr --addmode DisplayPort-1 3840x2160_60
xrandr --output DisplayPort-1 --mode 3840x2160_60

ref:
Vega 64 installation problems
amdgpu displayport
xrandr - How to set a custom resolution?


Restart X-windows service

Ctrl Alt Backspace
But usually doesn’t work

Ctrl Alt F6
Switch to tty6(any other tty is ok), login and systemctl restart display-manager

ref:
How to restart X Window Server from command line?


Set Wacom tablet, scrolling pages with middle mouse button

Terminal window
# list devices
$ xsetwacom --list devices
Wacom Intuos BT M Pen stylus id: 10 type: STYLUS
Wacom Intuos BT M Pad pad id: 11 type: PAD
Wacom Intuos BT M Pen eraser id: 13 type: ERASER
Wacom Intuos BT M Pen cursor id: 14 type: CURSOR
# change feature of button 2 to pan
$ xsetwacom --set "Wacom Intuos BT M Pen stylus" Button 2 "pan"
# increase the sensitivity of panning action
$ xsetwacom --set "Wacom Intuos BT M Pen stylus" "PanScrollThreshold" 40

But I need to set these parameters every login, therefore add following lines to .bashrc

Terminal window
# Wacom tablet, pan with middle mouse button
xsetwacom --set "Wacom Intuos BT M Pen stylus" Button 2 "pan"
xsetwacom --set "Wacom Intuos BT M Pen stylus" "PanScrollThreshold" 40

ref:
Wacom tablet middle mouse button scrolling
man xsetwacom in terminal

2020/07/28 update

Terminal window
# Wcaom tablet, press&click to work
xsetwacom --set "Wacom Intuos BT M Pen stylus" TabletPCButton "on"

Access to SMB share folder

eg. input smb://win/e to address bar of folder manager

win/e is the share link of SMB folder


cd to custom directory

ref:
Use CDPATH to define the base directory for cd command

2020/07/05 update
Chris Titus Tech provide a solution that set alias for custom directory in his video 16 Linux Tips in 10 Minutes
eg. alias ctt=‘cd /media/backups/SynologyDrive/ctt’
Work on VPS.
But on my desktop, it’ll always crash bash shell (misleading me for a long time…)


Network problem

System Setting ->> Hardware Configuraion ->> Network controller
this driver doesn’t work well on my computer
No connetion with the wired cable, connection only succeed after reboot.

cat /etc/resolv.conf no nameserver
ip route output nothing
ip addr output a lot, but I can’t find bugs

uninstall this driver will solve the problem
(maybe it’s not the correct driver


Return to last edit position in Vim

Solution from /usr/share/vim/vim82/defaults.vim

Terminal window
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif

Ubuntu Boot Partition Full

Terminal window
# 1. check drive useage
$ df -h
# 2. check current kernel version
$ uname -r
# 3. list all the installed kernel packages
$ dpkg -l | grep linux-image
# 4. remove useless kernel packages
$ apt remove --purge linux-image-*.**.*-**-generic
# 5. clean up the dependencies of removed kernel packages
$ apt autoremove --purge

Ref: Ubuntu Boot Partition Full


2020/11/28 update

Telegram Desktop can’t input Chinese characters

[Desktop Entry]
Version=1.0
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
TryExec=telegram-desktop
Exec=env QT_IM_MODULE=ibus telegram-desktop -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
X-GNOME-UsesNotifications=true

(only QT_IM_MODULE=ibus is also ok)

  • but other applications can’t input Chinese too

    在 Linux 上用 Telegram Desktop 打不到中文?
    思前想後,決定去報告問題。然後在 ilya-fedin 大大的協助下,發現較新版本的 iBus 會參考 $WAYLAND_DISPLAY 參數決定 socket 的名稱,而 Qt 暫時還未適應這個轉變,而引用了錯誤的 iBus socket,導致無法收到任何 iBus 的輸入,而只能顯示英文字母。
    同樣的問題應該適用於 .deb / .rpm / tarball 安裝的任何 Qt 軟件。

Soution from above article:

Terminal window
mkdir -p $HOME/.config/environment.d
echo "IBUS_USE_PORTAL=1" > $HOME/.config/environment.d/99-ibus-use-portal.conf

and reboot

But above solution don’t work on my manjaro kde 20.1.2

  • Finally
Terminal window
echo "IBUS_USE_PORTAL=1" > $HOME/.pam_environment

and log out, log in again, work on every application (except telegram…

Ref: Telegram Desktop does not recognize IBus switch between Japanese and English input


Firefox hardware acceleration

ArchWiki - Firefox
ArchWiki - Hardware video acceleration
mpv.io - options hwdec
mozilla wiki - Blocklisting/Blocked Graphics Drivers

input about:support at address bar of firefox to check info
input about:config at address bar of firefox to edit advance options


AMD gpu fan control

pacman -S fancontrol-gui


Pacman Mirrors

ArchWiki - Mirrors
ArchWiki - Mirrors Status
ArchWiki - Pacman Mirrorlist Generator

After creating/editing /etc/pacman.d/mirrorlist, issue the following command:
pacman -Syyu


2020/12/16 update

Search function

The search function of Dlophin which is the default file manager in Manjaro KDE is tooooooooooo weak to use.

FSearch and ANGRYsearch are good search tools with GUI, fzf is a choice in command line.

Ref: Linux下快速搜索文件(类似Everything)


2021/02/24 update

Reinstall system aaaaaagain

Breaking my Linux system one/two/three/…etc time(s)
:(

Terminal window
# 1. :(
[FAILED] Failed to start Load Kernel Modules.
[FAILED] Failed to mount /boot/efi.
[DEPEND] Dependency failed for Local File Systems.
# 2. "journalctl -xb"
mount: /boot/efi: unknown filesystem type 'vfat'.
boot-efi.mount: Mount process exited, code=exited, status=32/n/a
boot-efi.mount: Fialed with result 'exit-code'.
Failed to mount /boot/efi.
Dependency failed for Local File Systems.
Failed to look up module alias 'crypto_user': Function not implemented
Failed to look up module alias 'sg': Function not implemented
Failed to look up module alias 'msr': Function not implemented
Failed to look up module alias 'vboxdrv': Function not implemented
Failed to look up module alias 'vboxnetadp': Function not implemented
Failed to look up module alias 'vboxnetflt': Function not implemented
Failed to look up module alias 'uinput': Function not implemented
Failed to look up module alias 'vboxguest': Function not implemented
Failed to look up module alias 'vboxsf': Function not implemented
Failed to look up module alias 'vboxvideo': Function not implemented
systemcd-modules-load.service: Failed with result 'exit-code'.
Failed to start Load Kernel Modules.

try to fix, but failed :(

A similar post: Error = ‘FAILED. Failed to start Load Kernel Modules’


2021/03/06 update

Enable BBR in Ubuntu

  1. check if BBR in use
Terminal window
# output nothing shows that BBR is off
lsmod | grep bbr

or

Terminal window
# By default, Linux uses the Reno and CUBIC congestion control algorithm. To check available congestion control algorithms, run the following command:
sysctl net.ipv4.tcp_available_congestion_control
# Output:
net.ipv4.tcp_available_congestion_control = cubic reno
# To check the current congestion control algorithm in use, run:
sysctl net.ipv4.tcp_congestion_control
# Output:
net.ipv4.tcp_congestion_control = cubic
  1. enable BBR
Terminal window
vim /etc/sysctl.d/local-bbr.conf
# add following two lines
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
# apply change by
deb-systemd-invoke restart procps.service

Ref:


2021/03/14 update

Install nvidia driver

Terminal window
# install packages
sudo pacman -S nvidia-utils lib32-nvidia-utils linux59-nvidia
# block nouveau
vim /etc/modprobe.d/blacklist-nvidia-nouveau.conf
# add following lines
blacklist nouveau
options nouveau modeset=0
# reboot

Ref:
NVIDIA - ArchWiki
Nouveau - ArchWiki
How to disable/blacklist Nouveau nvidia driver on Ubuntu 20.04 Focal Fossa Linux


2021/03/14 update

Downgrade a package

  • Search the old package in “Arch Linux Historical Archive” on archive.org

  • For example, install qbittorrent-4.1.9
    sudo pacman -U https://archive.org/download/archlinux_pkg_qbittorrent/qbittorrent-4.1.9-1-x86_64.pkg.tar.xz

  • install telegram-desktop
    sudo pacman -U https://archive.org/download/archlinux_pkg_telegram-desktop/telegram-desktop-2.7.4-2-x86_64.pkg.tar.zst

Ref: ArchWiki - Arch Linux Archive: How to downgrade one package


2021/03/22 update

Creat Disk Partition with parted

Terminal window
# 1. creat partition
parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart
File system type? ext4
Start? 1
End? 5000
# the Unit of End is "MB"
# 2. build filesystem
mkfs.ext4 /dev/sdb1
# 3. mount it

Ref:
How to Create Disk Partitions with Parted Command in Linux
How to properly automount a drive in Ubuntu Linux


2021/04/09 update

Update Pacman Mirrorlist

Terminal window
pacman-mirrors -id

After creating/editing /etc/pacman.d/mirrorlist, issue the following command:
pacman -Syyu


2021/05/01 update

Automated Backup

ArchWiki - Rsync: Automated backup


2021/05/05 update

[In-prograss] Automated Empty Clipboard Content

Use ‘KDE klipper actions’ with ‘qdbus org.kde.klipper /klipper clearClipboardContents’ command.
But not perfect, need another method.

klipper has these commands:

Terminal window
org.kde.klipper.klipper.clearClipboardContents
org.kde.klipper.klipper.clearClipboardHistory
org.kde.klipper.klipper.getClipboardContents
org.kde.klipper.klipper.getClipboardHistoryItem
org.kde.klipper.klipper.getClipboardHistoryMenu
org.kde.klipper.klipper.saveClipboardHistory
org.kde.klipper.klipper.setClipboardContents
org.kde.klipper.klipper.showKlipperManuallyInvokeActionMenu
org.kde.klipper.klipper.showKlipperPopupMenu

clearClipboardContents sometimes don’t work, ‘clearClipboardHistory’ work normally

Ref:
KDE UserBase Wiki - Klipper
Command line access to Plasma clipboard
Clear clipboard in Konsole


2021/08/18 update

Firefox smoothScroll (maybe useful?)

input about:config in address bar, edit general.smoothScroll.mouseWheel.migrationPercent to 0

Ref: I can’t remember…


2021/10/01 update

Do Not Disturb a server which running normally(

Update and reboot 2 servers, then can’t SSH to them, 100 percentage lost…

Server 1

VNC to it, a mounted driver bugged.

ls get ls: reading directory XXX Input/output error
dmesg get Buffer I/O error on dev sda1, logical block 0, lost sync page write

Reboot the server, mount get mount: XXX : can't read superblock on /dev/sda.

First comment this bugged driver in /etc/fstab, I just want to boot and SSH normally.

Open a support ticket, get a reply power/off and power on (not a reboot) your server and try again
It working, fine ~

Server 2

VNC to it, found server’s network is down.

  • When boot, it said Failed to start Raise network interfaces
  • journalctl -u networking get /etc/network/if-pre-up.d/iptables: line 2: /sbin/iptables-restore: No such file or directory

touch /sbin/iptables-restore && chmod 744 /sbin/iptables-restore
systemctl start networking
Ref: Iptables if-pre-up blocking my network interfaces - Debian

Network interfaces is up, but IP changed…

Open a support ticket, want to change the IP back.


In one word, Do Not Disturb a server which running normally(


2022/03/01 update

Batch rename

Ref: The 7 Best Ways to Batch Rename Files in Linux

Terminal window
# replace "file" with "photo"
rename file photo *.png
# rename multi files within Vim
qmv -e vim

2022/08/10 update

“Failed to mount /boot/efi” after update

Ref:
HowTo - Restore an unbootable system after an interrupted kernel update
Mkinitcpio tries to work on uninstalled kernels

Terminal window
# chroot
manjaro-chroot -a
# The first updates the system.
# Second command rebuilds initramfs for all installed kernels.
# Third command updates grub, so that entries for all the kernels are up to date.
pacman -Syu
mkinitcpio -P
update-grub
# remove a not valid kernel module
# Check what you got under /use/lib/modules. If no linux57-58 folders there, then you can remove related files in /boot and /etc/mkinitcpio.d manually. Otherwise, you need to uninstall linux57-58 with pacman.

2022/09/18 update

Wired Connetion Disconnects, journalctl display “carrier-changed”

Ref:
Network Manager Stops Working Every 30 Minutes or So
Ethernet connection randomly disconnects, “reason: ‘carrier-changed”

Terminal window
journalctl -b --no-hostname --no-pager -u NetworkManager
# Check journalctl
# NetworkManager: <info> device (enp): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
# As this post "Ethernet connection randomly disconnects, “reason: ‘carrier-changed”"
# The reaseon is my wired cable...
# And that's right, really a hardware problem...
# Try another port on switch, restart NetworkManager, and everything OK...
systemctl restart NetworkManager.service

2023/08/26 update

gpg: [don’t know]: invalid packet (ctb=00)

Keyring Errors

Terminal window
# First, remove local cached keyring files
sudo rm -r /etc/pacman.d/gnupg
# Then initialize the pacman keyring
sudo pacman-key --init
# Populate the keyrings (not sure whether necessary)
sudo pacman-key --populate manjaro archlinux

Ref:
Manjaro Wiki - Errors_about_Keys


2024/01/13 update

Hangs after login

/usr/lib/Xorg -nolisten tcp -background none -seat seat0 vt* -auth /run/sddm/xauth_ADBaYx -noreset -displayfd ** 100% CPU useage

Arch Wiki - SDDM: Hangs after login

Try removing ~/.Xauthority and logging in again without rebooting. Rebooting without logging in creates the file again and the problem will persist.

Maybe VS Code resulte a memory leak(1000 GB+ virtual memory useage)…

KDE Applications Launcher not work

After updated to KDE 6, Applications Launcher doesn’t show any installed packages.(Open from command line is working.)
Maybe ~/.local/share/applications folder disappearring is the reason.

Terminal window
update-desktop-database ~/.local/share/applications -v
Terminal window
sudo update-desktop-database /usr/share/applications -v

(note: the second command will likely return a number of KDE apps lacking MimeType, which is fine)

Ref:
Manjaro Forum - KDE Launcher no longer displays hardly any installed apps