# Ubuntu Setup Here's my personal Ubuntu 23.04 setup. (Make sure to use Wayland on Nvidia!) ## Packages - Must haves: - `sudo apt install curl ddcutil deja-dup earlyoom endeavour ffmpeg flatpak git gnome-boxes gnome-clocks gnome-software-plugin-flatpak gnome-sound-recorder gnome-weather goldendict gparted keepassxc mpv needrestart obs-studio ripgrep shadowsocks-libev sshfs synaptic tmux trash-cli ufw vim-gtk3 wl-clipboard linux-tools-generic build-essential` - Optional: - `sudo apt install arp-scan asciinema bookworm foliate gimp gnome-firmware gnome-games gnome-nettool gnome-packagekit gnome-passwordsafe gnome-shell-pomodoro gnome-usage gthumb heif-gdk-pixbuf heif-thumbnailer mkvtoolnix-gui openjdk-17-jdk pulseeffectsqpdf ranger syncplay virtualbox-qt vlc audacity f3 prusa-slicer cmake` - Remove all snaps: - ``` # if this command fails, do the following then try again: # sudo umount /var/snap/firefox/common/host-hunspell sudo apt autoremove --purge snapd sudo apt-mark hold snapd trash ~/snap ``` - Enable FlatHub: - `flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo` - `earlyoom` 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` for monitor brightness shortcuts: - `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` - Virtualbox - `sudo usermod -aG vboxusers $(whoami)` - Birdtray - `$ sudo apt install birdtray` - Configure it by running `birdtray` and clicking on the tray icon - In Startup Applications Preference: - Name: `Birdtray` - Command: `sh -c "sleep 20 && /usr/bin/birdtray"` - Comment: `Minimize to tray for Thunderbird` - Wait for bugs to be fixed before removing sleep: - - - Hiding: check all except hide/show by clicking icon ## Apps - gnome-tweaks - `sudo apt install gnome-tweaks` - Extensions - `sudo apt install gnome-shell-extensions` - Go to settings -> `Region & Language` and install `Chinese (simplified)`. - GSConnect - `sudo apt install gnome-shell-extension-gsconnect` - UFW: - `sudo ufw allow 1716:1764/tcp` - `sudo ufw allow 1716:1764/udp` - Flatseal - `flatpak install flathub com.github.tchx84.Flatseal` - Firefox - `flatpak install flathub org.mozilla.firefox` - Use Wayland for correct fractional scaling and less bugginess `sudo flatpak override --socket=wayland --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox` - Xournal++ - `sudo apt install xournalpp texlive-latex-extra` - cameractrls - `flatpak install hu.irl.cameractrls` - Minecraft - `flatpak install flathub org.prismlauncher.PrismLauncher` - To host servers: `sudo ufw allow 25565/tcp` - Bottles - `flatpak install flathub com.usebottles.bottles` - Discord - `flatpak install flathub com.discordapp.Discord` - Slack - `flatpak install flathub com.slack.Slack` - Denaro - `flatpak install flathub org.nickvision.money` ## Optional Apps - Zoom - `flatpak install flathub us.zoom.Zoom` - Impatience (adjust Gnome animation speed) - `sudo apt install gnome-shell-extension-impatience` - Enable in extensions and set speed to 0.7 - Wobbly Windows (?) - From - Turn off maximize effect - Increase restore factor to 5 - 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 - VS Codium - `flatpak install flathub com.vscodium.codium` - Birdtray - `$ sudo apt install birdtray` - Configure it by running `birdtray` and clicking on the tray icon - In Startup Applications Preference: - Name: `Birdtray` - Command: `sh -c "sleep 20 && /usr/bin/birdtray"` - Comment: `Minimize to tray for Thunderbird` - Wait for bugs to be fixed before removing sleep: - - - Hiding: check all except hide/show by clicking icon - Broken on Wayland - 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` ## Services & System configs ### Swap partition/file - Allocate 16 GiB for LVM swap partition (if not set during installation): ``` sudo lvcreate -n lvswap-ubuntu-23.04 -L 16G -C y vgroot # note down UUID: sudo mkswap /dev/mapper/vgroot-lvswap--ubuntu--23.04 echo 'UUID= none swap swap 0 0' | sudo tee -a /etc/fstab > /dev/null sudo swapon -a ``` - Or, allocate 8 GiB for swapfile: ``` # if /swapfile already exists sudo swapoff /swapfile sudo fallocate -l 8GiB /swapfile sudo chmod 0600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap defaults 0 0' | sudo tee -a /etc/fstab > /dev/null ``` ### UFW `$ sudo ufw enable` ### OpenSSH Server & Mosh Installation and configuration: ``` 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) sudo systemctl enable sshd --now sudo systemctl reload sshd ``` Firewall: ``` sudo ufw limit OpenSSH sudo ufw allow 60001:60999/udp ``` Per user: ``` mkdir -p ~/.ssh chmod 700 ~/.ssh # insert your SSH public keys into this file touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys ``` ### My system level dotfiles See the `system` folder and run each script as they apply to your installation. ### See logs as admin (if not yet in `adm` group) `sudo usermod -aG adm $(whoami)` ## Legacy ### For old Ubuntu versions - OBS Studio - On Ubuntu <= 22.10, fixed in 23.04: - `$ 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'` - Xournal++ - < 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. - OpenSSH server config deprecated alias for `KbdInteractiveAuthentication` - `ChallengeResponseAuthentication` - Mosh: trusted PPA from mosh developer for truecolor support - < Ubuntu 23.04 - `sudo add-apt-repository ppa:keithw/mosh-dev` - Firefox - < 23.04 - Forcing Wayland in Flatpak Firefox may consume more CPU in certain cases with gnome-shell taking close to 100% CPU - 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`. - Nvidia proprietary driver screen tearing fix - Ubuntu < 22.04 - `echo 'options nvidia-drm modeset=1' | sudo tee /etc/modprobe.d/nvidia-drm-nomodeset.conf > /dev/null` ## Dual booting with Windows ### 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 `` replaced: ``` /dev/nvme0n1p6 /mnt/dislocker fuse.dislocker nofail,nouser,umask=0077,bekfile=/opt/dislocker/.bek 0 0 /mnt/dislocker/dislocker-file /media/ auto nofail,umask=0077,gid=,uid= 0 0 ``` Mount manually with: ``` $ sudo dislocker /dev/nvmen1p6 -p -- /mnt/dislocker $ sudo mount -o loop /mnt/dislocker/dislocker-file /media/"$(whoami)" ``` ### Unused #### 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) #### Razer mouse ``` sudo add-apt-repository ppa:polychromatic/stable sudo apt install openrazer-meta polychromatic ``` #### 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` #### Proton black screen fix Source: ``` 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` #### Blank screen workaround [Blanked screen doesn't wake up after locking \[drmModeAtomicCommit: Argument invalide\] \[drmModeAtomicCommit: Invalid argument\]](https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1968040) - Put `MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0` in `/etc/environment`