2022-02-12

Acer SPIN 5 (SP513-55N, SP513-41N)安裝Ubuntu/Linux MINT Cinnamon 20.3

想要支援平版型筆電, MINT裝Cinnamon版本會友善一點,MATE/XFCE的支援度差一點,但後面會講解法。 

1.開機時按F2進BIOS,
在Main頁面按ctrl+s呼叫出隱藏選項,
將SATA Mode=> AHCI, trackpad => PS2(待會會再改回來),
在Security將TPM關閉,
在Boot頁面將Secure Boot關閉(要先在Security頁面設Supervisor Password才能改),
Boot priority order 設為要用來安裝Ubuntu/Mint的USB。

2.開始安裝Mint,安裝時個人是分成三個分割區:
EFI => 550mb (UEFI開機載入需要此分割區)
SWAP=> 5120mb
剩下的都格式化為ext4並 mount 給 /

3.裝完後,修改 /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nocrs" #加入pci=nocrs
GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
GRUB_TIMEOUT=3

修改完執行 sudo update-grub

3.打開更新管理員執行更新,若是intel版本,AX210網卡需5.10+ kernel,AX200需5.1+ kernel。若是amd版本,附的應該是都MT7921聯發科網卡,需要5.12+ kernel,但我建議把聯發科卡換成intel網卡,就算弄到能上網一樣是真心爛(掉包降速斷線等)。

重開機,進BIOS把trackpad改回IC2,開機時在選單選擇用最新的kernel開機。

4.調整自動旋轉
= 若是Cinnamon =:
進 管理/顯示器/設定,選擇Hi-DPI啟用fractional scaling,fractional scaling選150%
安裝touchscreen旋轉時的xinput修正:
sudo apt-get install x11-touchscreen-calibrator

Cinnamon其中有一個"自動螢幕旋轉",請保持停用狀態,不然啟用的話,螢幕設定不知怎的都無法正常保存。

= 若是MATE/XFCE =:
桌面設定一樣改 Hi-DPI
sudo apt-get install x11-touchscreen-calibrator
xrandr --output eDP --scale 1.5x1.5
sudo apt install autorandr
autorandr --save work

不管哪個版本,自動旋轉請改用自動偵測script (https://askubuntu.com/a/1375561),可放到開機自動啟動:

sudo apt install iio-sensor-proxy inotify-tools

==================================
#!/bin/bash
# Auto rotate screen based on device orientation
monitor-sensor | \
while IFS= read -r str; do
  if [[ $str =~ orientation\ changed:\ (.*)$ ]]; then
    case "${BASH_REMATCH[1]}" in
    normal)
      xrandr --output eDP --rotate normal ;;
    bottom-up)
      xrandr --output eDP --rotate inverted ;;
    right-up)
      xrandr --output eDP --rotate right ;;
    left-up)
      xrandr --output eDP --rotate left ;;
    esac
  fi
done
=================================

5.調整firefox滑動及steam縮放,修改/etc/environment,加入:
MOZ_USE_XINPUT2=1 #firefox,並把firefox設定中的平滑捲動取消
# GDK_SCALE=2 #steam,不過建議在啟動steam時加在指令前面就好

6.調整java介面縮放,修改 ~/.profile,加入:
#java ui scale
export _JAVA_OPTIONS='-Dsun.java2d.uiScale.enabled=true  -Dsun.java2d.uiScale=2'

7.fcitx輸入文字時,候選字(preedit)視窗(fcitx-qimpanel)過小:

譬如用的是ubutnu-grey主題,那麼就修改:
sudo vi /usr/share/fcitx-qimpanel/skin/ubuntu-grey/fcitx_skin.conf

FontSize=36
CandFontSize=36

若是用default佈景,那就修改:
sudo vi /usr/share/fcitx/skin/default/fcitx_skin.conf

8.觸控板多指手勢支援:
X11(後面指令以X11為主):
https://github.com/bulletmark/libinput-gestures
https://gitlab.com/cunidev/gestures

sudo apt install python3 python3-pip python3-venv python3-gi python-gobject meson wmctrl xdotool libinput-tools gettext appstream-util

sudo gpasswd -a $USER input
git clone https://github.com/bulletmark/libinput-gestures.git
cd libinput-gestures
sudo make install (or sudo ./libinput-gestures-setup install)
cp /etc/libinput-gestures.conf ~/.config/libinput-gestures.conf
newgrp input
libinput-gestures-setup autostart start


git clone https://gitlab.com/cunidev/gestures
cd gestures
meson build --prefix=/usr
ninja -C build
sudo ninja -C build install

之後再執行gestures程式調整要的多指手勢

若display server是Wayland的話,可參考:
https://extensions.gnome.org/extension/1253/extended-gestures/

9.指紋辨識(Fingerprint Reader),因為我用不到,而且加入方式也挺麻煩,跳過。

10. 修正外接麥克風(內建麥克風正常)無法收音問題:
修改 /etc/modprobe.d/alsa-base.conf
加入:
options snd-hda-intel model=alc255-acer,dell-headset-multi
(https://askubuntu.com/a/1307107)

11.取消進入休眠HIBERNATE (按F1似乎還是會進待機SUSPEND,但不會叫不醒了,也行…)
修改 /etc/systemd/logind.conf:
HandleSuspendKey=ignore

ref:
https://sciactive.com/2020/12/04/how-to-install-ubuntu-on-acer-spin-5-sp513-54n-for-the-perfect-linux-2-in-1/
https://wiki.archlinux.org/title/HiDPI