dotfiles/setup/ubuntu-setup.md

10 KiB

Ubuntu Setup

Here's my personal Ubuntu 22.10 setup. (Make sure to enable Wayland on Nvidia!)

  • Set font size in Terminal to 15 and initial column count to 85
  • Must haves:
    • sudo apt install curl ddcutil deja-dup earlyoom ffmpeg flatpak git gnome-boxes gnome-clocks \ gnome-software-plugin-flatpak gnome-sound-recorder gnome-todo gnome-weather goldendict gparted \ keepassxc mosh mpv needrestart obs-studio shadowsocks-libev sshfs synaptic tmux trash-cli ufw \ vim-gtk3 vlc wl-clipboard
  • Optional:
    • sudo apt install gnome-firmware gnome-games gnome-nettool gnome-packagekit gnome-passwordsafe \ gnome-shell-pomodoro gnome-usage gthumb mkvtoolnix-gui openjdk-17-jdk pulseeffectsqpdf ranger \ syncplay virtualbox-qt
  • Remove all snaps:
    • # if this command fails, unmount the snap mounts as reported by `mount` and try again
      sudo apt autoremove --purge snapd
      sudo apt-mark hold snapd
      trash ~/snap
      
  • FlatHub:
    • flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  • Allocate 8GiB for swap
    sudo swapoff /swapfile
    sudo fallocate -l 8GiB /swapfile
    sudo chmod 0600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    
  • Early OOM config: edit /etc/default/earlyoom and add:
    • --avoid '(^|/)(systemd|sshd|mosh-server|ssh|vim|sudo|sudoedit|gnome-shell|gnome-terminal-)$' --prefer '(^|/)(Web Content|Isolated Web Co)$'
  • ddcutil:
    • sudo usermod -aG i2c $(whoami)
    • External Monitor Brightness Up: ddcutil setvcp 10 + 10
    • External Monitor Brightness Down: ddcutil setvcp 10 - 10

Optional packages

  • clangd for VSCodium C language server with llvm-vs-code-extensions.vscode-clangd (?)
  • imagemagick for convert, comment out with <!-- --> PDF policy in /etc/ImageMagick-6/policy.xml (?)
  • Cross compiling (?)
    • gcc-aarch64-linux-gnu
    • gcc-arm-linux-gnueabihf

UFW

$ sudo ufw enable

Wayland, if it doesn't show up

  • sudoedit /usr/lib/udev/rules.d/61-gdm.rules and comment the two uncommented lines
  • Reboot or restart gdm3 (didn't try)

Apps

  • gnome-tweaks
    • sudo apt install gnome-tweaks
    • Swap capslock and ESC in Keyboard & Mouse -> Additional Layout Options -> Caps Lock behavior
    • Change Mouse Click Emulation to Area
    • Turn on weekdays and battery percentage in Top Bar
    • Flat mouse acceleration profile
    • Turn off suspend when closing lid
  • Extensions
    • sudo apt install gnome-shell-extensions
    • Turn on:
      • Applications menu
      • Places status indicator
      • Windownavigator
      • Workspace Indicator
    • Note: to manually install Gnome extensions, unzip it and copy the uuid field in metadata.json and rename the directory to this name, then move to ~/.local/share/gnome-shell/extensions and logout and login.
  • GSConnect
    • sudo apt install gnome-shell-extension-gsconnect
    • Uncheck SFTP auto mount
    • Add commands:
      • Lock: loginctl lock-session
      • Quack: ffplay -v quiet -nodisp -autoexit ~/Music/'.Not Music'/Ringtones/Quack.mp3
    • UFW:
      • sudo ufw allow 1716:1764/tcp
      • sudo ufw allow 1716:1764/udp
  • Flatseal
    • flatpak install flathub com.github.tchx84.Flatseal
  • Firefox
    • Change default zoom to 110%
    • Enable HTTPS only
    • Proxy DNS when using SOCKS v5
    • Enable DNS over HTTPS
    • In about:config set browser.sessionstore.max_windows_undo to 10.
  • Go to settings -> Region & Language and install Chinese (simplified).
  • VSCodium
    • flatpak install flathub com.vscodium.codium
  • OBS Studio
    • $ sudo apt install qtwayland5
    • On Ubuntu <22.10, in /usr/share/applications/com.obsproject.Studio.desktop, replace Exec=obs with Exec=sh -c '[ "$XDG_SESSION_TYPE" = "wayland" ] && obs -platform wayland || obs'
  • Birdtray
  • Gnome Calendar
    • Add Google accounts in online accounts
    • On older versions of Ubuntu < 22.04, not tested for 22.04:
    • Wait for a bit, it's kinda buggy but it will work at the end (wait for ~2 days)
  • Golden Dict
  • Xournal++
    • sudo apt install xournalpp texlive-latex-extra
    • < Ubuntu 22.04
      • flatpak install flathub com.github.xournalpp.xournalpp
      • flatpak install flathub org.freedesktop.Sdk.Extension.texlive and choose newest (21.08 at time of writing) for LaTeX support.
  • cameractrls
    • flatpak install hu.irl.cameractrls
  • Minecraft
    • TODO: PolyMC just had some problems
    • To host servers: sudo ufw allow 25565/tcp
  • Bottles
    • flatpak install flathub com.usebottles.bottles
    • Check file system permission with Flatseal
  • Discord
    • flatpak install flathub com.discordapp.Discord
    • Check file system permission with Flatseal
  • Slack
    • flatpak install flathub com.slack.Slack
    • Check file system permission with Flatseal
  • Zoom
    • flatpak install flathub us.zoom.Zoom
    • Check file system permission with Flatseal

Optional Apps

  • Impatience (adjust Gnome animation speed)
    • sudo apt install gnome-shell-extension-impatience
    • Enable in extensions and set speed to 0.7
  • Wobbly Windows (?)
  • System monitor
    • $ sudo apt install gnome-shell-extension-system-monitor
    • Show only CPU (digit and graph) and memory (digit).
  • OpenWeatherMap
    • $ sudo apt install gnome-shell-extension-weather
    • On older systems (< 21.04), download and install from https://extensions.gnome.org/extension/750/openweather/
    • Set location to La Jolla
    • Switch to metric units
  • VSCodium
    • flatpak install flathub com.vscodium.codium
  • Birdtray
  • Android Studio
    • Move Ctrl+S from IdeaVim to IDE
    • Enabled Mark modified (*)
    • Disable both Save files on frame deactivation and Save files automatically if application is idle

Grub background

Tool

  • $ sudo apt install grub-customizer
  • Put in background manually

Manual Script

sudo mkdir /opt/grub
sudo cp -r background/ /boot/grub/
sudo chown -R root:root /opt/grub
sudo chmod -R 700 /opt/grub
  • Add the following lines to /opt/grub/cycle-backgrounds.sh:
    #!/bin/sh
    cd /boot/grub/background
    mv background.png tmp.png
    mv background-1.png background.png
    mv tmp.png background-1.png
    
  • $ sudo chown root:root /opt/grub/cycle-backgrounds.sh
  • $ sudo chmod 700 /opt/grub/cycle-backgrounds.sh
  • Add @reboot /opt/grub/cycle-backgrounds.sh to root crontab.
  • In /etc/default/grub:
    • Add GRUB_BACKGROUND=/boot/grub/background/background.png
    • Change GRUB_TIMEOUT=10 to GRUB_TIMEOUT=3
  • $ sudo update-grub

OpenSSH Server & Mosh

sudo apt install -y openssh-server mosh
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo cp ../system/sshd/sshd_config /etc/ssh/sshd_config
sudo groupadd --system ssh-users
sudo usermod -aG ssh-users $(whoami)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# insert your SSH public keys into the file
sudo ufw limit OpenSSH
sudo ufw allow 60001:60999/udp
sudo systemctl restart ssh

See logs as admin

sudo usermod -aG adm $(whoami)

Proton black screen fix (?)

Source: https://github.com/ValveSoftware/steam-runtime/issues/312#issuecomment-739441559

sudo mv /usr/share/vulkan/icd.d/intel_icd.x86_64.json \
	/usr/share/vulkan/icd.d/intel_icd.x86_64.json.disabled

Proprietary encodings (?)

  • $ sudo apt install ubuntu-restricted-extras

Dual boot

Dislocker

$ sudo apt install dislocker
$ sudo mkdir /media/"$(whoami)" /mnt/dislocker /opt/dislocker
$ sudo chmod 700 /media/"$(whoami)" /mnt/dislocker /opt/dislocker
$ sudo chown $user:$user /media/"$(whoami)"
$ sudo chown root:root /mnt/dislocker /opt/dislocker

Copy the .BEK file to /opt/dislocker/"$(whoami)".bek.

$ sudo chown root:root /opt/dislocker/"$(whoami)".bek
$ sudo chmod 700 /opt/dislocker/"$(whoami)".bek

Add the following lines to /etc/fstab with <user> replaced:

/dev/nvme0n1p6 /mnt/dislocker fuse.dislocker nofail,nouser,umask=0077,bekfile=/opt/dislocker/<user>.bek 0 0
/mnt/dislocker/dislocker-file /media/<user> auto nofail,umask=0077,gid=<user>,uid=<user> 0 0

Mount manually with:

$ sudo dislocker /dev/nvmen1p6 -p -- /mnt/dislocker
$ sudo mount -o loop /mnt/dislocker/dislocker-file /media/"$(whoami)"

Hardware specific

Nvidia proprietary driver screen tearing fix

For Ubuntu < 22.04: echo 'options nvidia-drm modeset=1' | sudo tee /etc/modprobe.d/nvidia-drm-nomodeset.conf > /dev/null

Digimend for Huion tablet (works with H640p)

  • >= 21.10 & using wayland: no longer necessary
  • = 21.04:
    • $ sudo apt install digimend-dkms
    • Reboot.
  • < 21.04:
    • Download and install from https://github.com/DIGImend/digimend-kernel-drivers.

Razer mouse

sudo add-apt-repository ppa:polychromatic/stable
sudo apt install openrazer-meta polychromatic

Workarounds