# Arch Linux Setting **This is just my own installation note and some useful package. If there is something wrong or messy, you can comment or give me an email(seediqbale880212@gmail.com). Thanks!** ## Installation guide (2020/12/18) 1. Check boot mode and connect to the internet(I usually use wire network for convinience) ```bash ls /sys/firmware/efi/efivars timedatectl set-ntp true ``` ```bash wifi-menu ``` 2. Disk allocation and format ```bash fdisk -l cfdisk /dev/sda # Example mkfs.ext4 /dev/sda1 # For normal partition mkfs.fat -F32 /dev/sda2 # For EFI boot partition ``` 3. Mount the partition ```bash # Example mount /dev/sda1 /mnt mkdir /mnt/home mkdir /mnt/boot mount /dev/sda2 /mnt/home ``` 4. Edit pacman mirror list(`/etc/pacman.d/mirrorlist`), choose or add the following line into it if you are Taiwaneese also. You can generate on Arch offitial [generator](https://www.archlinux.org/mirrorlist/), too. ``` Server = http://archlinux.ccns.ncku.edu.tw/archlinux/$repo/os/$arch Server = http://archlinux.cs.nctu.edu.tw/$repo/os/$arch ``` 5. Integration the package list ```bash pacman -Syy ``` 6. Download the arch linux OS ```bash pacstrap /mnt base base-devel linux linux-firmware ``` 7. Generate fstab and check ```bash genfstab -p -U /mnt > /mnt/etc/fstab cat /mnt/etc/fstab ``` 8. Change root to new system and install vim first ```bash arch-chroot /mnt pacman -S vim ``` 9. Set host name and edit `/etc/hosts` ```bash echo Laxingyang > /etc/hostname ``` ```bash 127.0.0.1 localhost ::1 localhost 127.0.1.1 Laxingyang.localdomain Laxingyang ``` 10. Set timezone ```bash ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime hwclock --systohc ``` 11. Set system language. Choose language in `/etc/locale.gen` ```bash en_US.UTF-8 UTF-8 zh_TW.UTF-8 UTF-8 ``` And run, ```bash locale-gen ``` 12. Set English as system default language ```bash echo LANG=en_US.UTF-8 > /etc/locale.conf ``` 13. Generate booting image ```bash mkinitcpio -p linux ``` 14. Set root password ```bash passwd ``` 15. Install some nessesary package ```bash pacman -S sudo networkmanager konsole git plasma sddm openssh ttf-droid systemctl enable NetworkManager systemctl enable sddm ``` 16. Create User ```bash useradd -m -G wheel kehongying passwd kehongying ``` 17. Set sudoer in `/etc/sudoers` ```bash kehongying ALL=(ALL) ALL ``` 18. Install bootloader(GRUB) ```bash pacman -S grub efibootmgr os-prober grub-install --target=x86_64-efi --efi-direcotry=/boot --bootloader-id=arch_grub --recheck --debug grub-mkconfig -o /boot/grub/grub.cfg ``` 19. Checking ```bash vim /boot/grub/grub.cfg ls /boot ``` 20. Set make config file(`/etc/makepkg.conf`)(<a name="make_flag"></a>option) ```bash MAKEFLAGS="-j$(nproc)" ``` ## yay 1. `git clone https://aur.archlinux.org/yay-git.git` 2. `cd yay-git` 3. `makepkg -si` ## Chinese Input * fcitx(2020/12/16) 1. Install: `sudo pacman -S fcitx-im fcitx-configtool fcitx-rime rime-luna-pinyin rime-cangjie librime librime-data` 2. Autoboot: `cp /etc/xdg/autostart/fcitx-autostart.desktop ~/.config/autostart` 3. Use rime: https://wiki.archlinux.org/index.php/Rime_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87), set default as `luna_pinyin_tw` Add a cutom config file in `.config/fcitx/rime/default.custom.yaml` ``` patch: schema_list: - schema: luna_pinyin_tw - schema: cangjie5 ``` `.pam_environment` ``` GTK_IM_MODULE DEFAULT=fcitx QT_IM_MODULE DEFAULT=fcitx XMODIFIERS DEFAULT=@im=fcitx ``` I don't know why when I just set `luna_pinyin_tw` can't work. And Reboot the computer. 4. To show the chinese successfully, run `fc-cache -vf` before restart. If it still can't show it, try to install other fonts(noto-fonts-tc, adobe-source-han-sans-tw-fonts). ## Graphic Card * optimus-manager(2019/9/21) This is used to switch the grapic card in use(intel or nvidia). 1. Install: install by AUR(https://aur.archlinux.org/packages/optimus-manager/) 2. Enable optimus-manager: `sudo systemctl enable optimus-manager.service` 3. Disable the bumblebee: `sudo systemctl disable bumblebeed` 4. Copy the optimus-manager for backup: `sudo mkdir -p /etc/optimus-manager` 5. Set the optimus-manager: ```bash sudo cp /usr/share/optimus-manager.conf /etc/optimus-manager/optimus-manager.conf sudo vim /etc/optimus-manager/optimus-manager.conf #I change the switching from none to nouveau, pci_power_control to yes ``` 6. Operation: ```bash #change mode, either intel or nvidia optimus-manager --switch <mode> #print the current mode optimus-manager --print-mode #set the startup mode, it seems that default is intel optimus-manager --set-startup=<mode> ``` Reference: https://blog.edward-p.xyz/2019/04/optimus-manager/ ## Battery * TLP(2019/9/22) This is used to protect and manage battery for linux(useful?) There is an origin management, $KDE\ power\ devil$, in the system. If there is a conflict, don't install this. 1. Install: `sudo pacman -S tlp tlp-rdw smartmontools` 2. Enable the service: ```bash sudo systemctl enable tlp.service sudo systemctl enable tlp-sleep.service ``` 3. To avoid conflict: ```bash sudo systemctl mask systemd-rfkill.service sudo systemctl mask systemd-rfkill.socket ``` Reference: https://www.jishuwen.com/d/2783/zh-tw ## Wine - package: wine-staging winetricks - for audio: lib32-alsa-lib ## Bluetooth for airpods &emsp; After installing bluetooth, there are some problem make me can't use airpods. 1. `sudo pacman -S pulseaudio-bluetooth` 2. Modify `/etc/bluetooth/main.conf` $ControllerMode$ line to `ControllerMode = bredr` 3. To solve low volume(mention in arch wiki), run `systemctl edit --full bluetooth.service` and modify `ExecStart=/usr/lib/bluetooth/bluetoothd ` to `ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=avrcp` 4. After pairing successfully, $ControllerMode$ can reset back to original mode. Reference: 1. https://wiki.archlinux.org/index.php/Bluetooth_headset 2. https://www.reddit.com/r/archlinux/comments/er9mb2/have_any_of_you_guys_tried_to_use_airpods/ 3. https://bbs.archlinux.org/viewtopic.php?id=222083 ## Touchpad gesture - touchegg 1. `yay -S touchegg` 2. `mkdir -p .config/touchegg` 3. `cp -n /usr/share/touchegg/touchegg.conf ~/.config/touchegg/touchegg.conf` 4. modify the config file to set the gesture. 5. `sudo usermod -a -G input <username>` to add the user into input group, then reboot and run `sudo systemctl enable touchegg`, `sudo systemctl start touchegg` 6. Create and modify `~/.xprogile`, add `touchegg &` to make it start automatically on boot. Reference: 1. [config file introduction](https://github.com/JoseExposito/touchegg) - libinput-gestures (2020/12/3) 1. `yay -S libinput-gestures` 2. `pacman -S libinput xf86-input-libinput xdotool wmctrl` 3. `libinput-gestures-setup autostart; libinput-gestures-setup start` 4. `sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d` 5. Edit `$HOME/.config/libinput-gestures.conf` ``` # Switch to next desktop gesture swipe right 4 xdotool key ctrl+F1 # Switch to prev desktop gesture swipe left 4 xdotool key ctrl+F2 # Present windows (current desktop) gesture swipe down 3 xdotool key ctrl+F9 # Present windows (all desktop) gesture swipe down 4 xdotool key ctrl+F10 # Show desktop gesture swipe up 3 xdotool key super+d # Show desktops grid gesture swipe up 4 xdotool key ctrl+F8 # back history of chromium/chrome gesture swipe right 3 xdotool key alt+Left gesture swipe left 3 xdotool key alt+Right # pinch gesture pinch in 2 xdotool key ctrl+minus # 2指捏: 缩小 gesture pinch out 2 xdotool key ctrl+plus # 2指张: 放大 ``` Reference: 1. [libinput-gestures install](https://github.com/bulletmark/libinput-gestures) 2. [libinput-gestures configuration](https://segmentfault.com/a/1190000011327776) ## Messenger - caprine (2020/12/10) It seems that temporary broken(I can't use it). (2020/12/17) ## mail client - springmail (2020/12/10) ## archive - ark (2020/12/10) ## Wobbly effect & Magic lamp issue - kwin-effects-yet-another-magic-lamp (2020/12/17) 1. https://forum.kde.org/viewtopic.php?f=309&t=140986 2. https://www.reddit.com/r/kde/comments/ba7fio/blur_wobbly_windows_not_working/ **It seems that this problem only occur in VM. Real machine can set these effect successfully** ## VPN - pulse-secure 1. `yay -S pulse-secure webkitgtk` (remember to set [make config](#make_flag), or it would take very long time) But pulseUi broken frequently. There is another way to connect NTU VPN - openvpn (2020/12/19) 1. `sudo pacman -S openvpn` 2. Download the ovpn config file from [here](https://sites.google.com/a/csie.ntu.edu.tw/ta221/download). 3. Run the command `sudo openvpn --config <ovpn file path> --auth-nocache`. Or just set a function in `.bashrc` or `.zshrc` ```bash function vpn() { sudo openvpn --config ${1:=/home/kehongying/vpn/config.ovpn} --auth-nocache } ``` # Vim - YouCompleteMe - Linter 1. `sudo pacman -S vim-ale`