Skip to content

Instantly share code, notes, and snippets.

@JanGalek
Last active August 18, 2024 09:52
Show Gist options
  • Save JanGalek/a531d094025480afc03a6b995f804a50 to your computer and use it in GitHub Desktop.
Save JanGalek/a531d094025480afc03a6b995f804a50 to your computer and use it in GitHub Desktop.
UbuntuSetup

.ssh Permisions

  • .ssh directory 700 (drwx------)
  • public key (.pub file) 644 (-rw-r--r--)
  • private key (id_rsa) 600 (-rw-------)
  • lastly your home directory should not be writeable by the group or others (at most 755 (drwxr-xr-x)).

zsh fix for snap, ...

write to /etc/zsh/zprofile

emulate sh -c 'source /etc/profile'

logout/reboot

Memory info

sudo dmidecode --type memory

Apt-key deprecated

wget -O - <somelink>
file <nameOfDownloadedFile> // it should be PGP public key block Public-Key (old)
gpg --no-default-keyring --keyring ./<name>_keyring.gpg --import <nameOfDownloadedFile>
gpg --no-default-keyring --keyring ./<name>_keyring.gpg --export > ./<name>.gpg
sudo mv ./<name>.gpg /etc/apt/trusted.gpg.d/

Git

Change commit author

git rebase -i HEAD~1

set edit for commit, and than run

git commit --amend --author="username <[email protected]>" --no-edit
git rebase --continue

Oh my zsh

Insecure completion-dependent directories detected

compaudit | xargs chmod g-w

USB support (v1-3)

sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX="iommu=soft"
sudo update-grub

reboot

GPU drivers (my AMD Radeon R9 390) (development)

https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers

Install

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade
reboot

Uninstall

sudo apt install ppa-purge
sudo ppa-purge ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade
sudo apt autoremove
reboot

(AMD Radeon R9 390) need kernel 4.16 - 4.18

(optional) install https://support.amd.com/en-us/kb-articles/Pages/Radeon-Software-for-Linux-Release-Notes.aspx

sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.modeset=1 amdgpu.dpm=1 amdgpu.dc=1"

(AMD Radeon R9 390) kernel 4.19+

(optional) install https://support.amd.com/en-us/kb-articles/Pages/Radeon-Software-for-Linux-Release-Notes.aspx

sudo ./amdgpu-install --opencl=pal,legacy --no-dkms -y
sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.modeset=1 amdgpu.dc=1 iommu=soft"

or

GRUB_CMDLINE_LINUX_DEFAULT='radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.modeset=1 amdgpu.dc=1 amd-iommu=on iommu=pt pci=nommconf quiet splash'

update-grub
sudo cp -r /lib/firmware/radeon /lib/firmware/radeon.backup
sudo cp -r /lib/firmware/amdgpu /lib/firmware/amdgpu.backup
sudo cp /lib/firmware/radeon/* /lib/firmware/amdgpu

sudo update-initramfs -u
lsinitramfs /boot/initrd.img-<YOUR_KERNEL>-generic | grep hawaii

additional info: https://askubuntu.com/questions/1094443/ubuntu-18-04-1-lts-r9-390x-amdgpu-guide-testing-summary

Spotify + other app listen

sudo vim /etc/pulse/default.pa

comment line with load-module module-role-cork

reboot

Automatic mount disc

To make the partition auto-mount, first find out the UUID of /dev/sda3 by doing:

sudo blkid

I'll assume you're using ext4 on /dev/sda3. Open up gedit like so:

sudo -H vim /etc/fstab

Now you want to add a line to the bottom of that file. It should look something like this (UUID will be different):

UUID=03ec5dd3-45c0-4f95-a363-61ff321a09ff /works ext4 defaults  0      2

For more info on fstab, this is a good resource - https://wiki.archlinux.org/index.php/Fstab.

Thunderbird large emoji

sudo add-apt-repository ppa:mozillateam/thunderbird-next
sudo apt-get update
sudo apt-get upgrade

Windows Fonts

sudo apt install msttcorefonts

or

sudo apt install ttf-mscorefonts-installer

Steam

install missing libs

Ubuntu 20.04

sudo apt-get install libgamemodeauto0 

Ubuntu 18.04

sudo apt-get install libgamemodeauto0 
sudo dpkg --add-architecture i386
sudo apt-get update 
sudo apt-get install libgamemodeauto0:i386

test run

LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so steam

Crash on startup

steam --reset

Steam Library-Must be on a filesystem mounted with execute permissions

Deleting Windows hibernate metadata As an alternative to above clean shutdown method, there is a way to completely destroy NTFS metadata that was saved after hibernating. This method is only feasible if you are not able or unwilling to boot into Windows and shut it down completely. This is by placing remove_hiberfile option when you are mounting your NTFS file system using ntfs-3g.

mount -t ntfs-3g -o remove_hiberfile /dev/your_NTFS_partition /mount/point

Proton-tricks

https://github.com/Matoking/protontricks

Proton - Sound

I tried the WINEPREFIX solution mentioned above to no avail, ended up finding protontricks that stratus mentioned on github soon after.

Here is what worked for me:

Fetch protontricks from github and mark executable wget https://raw.githubusercontent.com/Sirmentio/protontricks/master/protontricks && chmod +x protontricks

move protontricks to /usr/bin so it can be ran from terminal sudo mv protontricks /usr/bin/protontricks

setup xact for banished on steam protontricks 242920 xact

run winecfg for banished prefix using protontricks protontricks 242920 winecfg

click on libraries and add xact and xaudio2_7, leave them with native, builtin https://i.imgur.com/lvguBoG.png

this is with Ubuntu 18.04, WINEPREFIX solutions did not work for me in this case, but this did.

Video memory size

env WINEPREFIX="/home/warfacez/Games/SteamLibrary/steamapps/common/Proton 4.11/dist/share/default_pfx" WINEPATH="/home/warfacez/Games/SteamLibrary/steamapps/common/Proton 4.11/dist/bin/wine64" winetricks videomemorysize=2048

WINE & Lutris

sudo dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' # Ubuntu 20.04
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ hirsute main' # Ubuntu 21.04
sudo add-apt-repository ppa:lutris-team/lutris
sudo apt update
sudo apt install --install-recommends winehq-staging
sudo apt install libgnutls30:i386 libldap-2.4-2:i386 libgpg-error0:i386 libxml2:i386 libasound2-plugins:i386 libsdl2-2.0-0:i386 libfreetype6:i386 libdbus-1-3:i386 libsqlite3-0:i386
sudo apt install lutris

Game performance

mesa_glthred

https://www.gamingonlinux.com/wiki/Performance_impact_of_Mesa_glthread

CpuFreqUtils

Install cpufrequtils:

sudo apt-get install cpufrequtils

Then edit the following file (if it doesn't exist, create it):

sudo vim /etc/default/cpufrequtils

And add the following line to it:

GOVERNOR="performance"

Save and exit.

Now you need to disable ondemand daemon, otherwise after you reboot the settings will be overwritten.

sudo update-rc.d ondemand disable

And you are done!

You can check your settings with:

cpufreq-info

GameMode

https://github.com/FeralInteractive/gamemode

ARK

put this into console (tab)

r.bloomquality 0
r.lightshafts 0

Boot failing

ALERT! /dev/mapper/ubuntu-vg-root does not exist. Dropping to shell!

Gave up waiting for root device. Common problems:
  — Boot args (cat /proc/cmdline)
    — Check rootdelay= (did the system wait long enough?)
    — Check root= (did the system wait for the right device?)
  — Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/ubuntu--vg-root does not exist. Dropping to a shell! 

BusyBox v.1.21.1 (Ubuntu 1:1.21.1-1ubuntu1) built-in shell (ash)   
Enter 'help' for list of built-in commands.  

(initramfs)

In certain Ubuntu versions (e.g. Xubuntu 18.10) this issue might be caused by an apt autoremove. Due to this bug apt will suggest to remove

cryptsetup cryptsetup-bin cryptsetup-initramfs cryptsetup-run dmeventd libdevmapper-event1.02.1 liblvm2app2.2 liblvm2cmd2.02 libreadline5 lvm2

Fix (in liveCD/liveUSB):

# find root partition
sudo fdisk -l

# unencrypt partition
#   Note: replace /dev/nvme0n1p3 with your disk
#         replace "nvme0n1p3_crypt" with the correct name 
#         check by running this in chroot:
#         $ cat /etc/crypttab | cut -f1 -d " "
#         nvme0n1p3_crypt
sudo cryptsetup luksOpen /dev/nvme0n1p3 nvme0n1p3_crypt

# mount root partition
sudo vgscan 
sudo vgchange -ay
sudo mount /dev/mapper/ubuntu--vg-root /mnt

# prepare chroot environment
sudo mount /dev/nvme0n1p2 /mnt/boot/   # replace nvme0n1p2 with your boot partition!
sudo mount -o rbind /dev/ /mnt/dev/
sudo mount -t proc proc /mnt/proc/
sudo mount -t sysfs sys /mnt/sys/

# make dns available in chroot
sudo cp /etc/resolv.conf  /mnt/etc/resolv.conf 

# enter chroot
sudo chroot /mnt /bin/bash

# re-install missing packages
apt install cryptsetup lvm2

# re-generate  (this might be done also by apt in the step before, I'm not sure)
update-initramfs -u -k all

# Leave chroot environment - not sure if the following is really necessary...
exit
# Write buffers to disk
sudo sync
# Unmount file systems
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/boot

Docker

Permissions

sudo usermod -aG docker $USER

Git

whispering of branch after slash dont work

exec bash
source ~/.bashrc
exec zsh
source ~/.zshrc

Wine

Upgrading

if we get something like this:

The following packages have unmet dependencies:
 winehq-stable : Depends: wine-stable (= 5.0.0~bionic)

We do this:

# Add i386 architecture
sudo dpkg --add-architecture i386
sudo apt update

# remove old repository
sudo apt-add-repository -r 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' 

# Download key for new repository
wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key -O Release.key

# Add key
sudo apt-key add - < Release.key

# Add repository (opensuse)
sudo apt-add-repository 'deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./'

sudo apt-get update

# Stable branch     
sudo apt install --install-recommends winehq-stable

#Development branch     
#sudo apt install --install-recommends winehq-devel

#Staging branch     
#sudo apt install --install-recommends winehq-staging

Teamspeak3

sudo add-apt-repository ppa:beardoverflow/ts3client
sudo apt install ts3client

KDE

Hidden titlebar / borderbar

install again kde-plasma

sudo apt install kde-plasma-desktop

RPM package convert to deb

install convertor alien

sudo apt install alien

convert rpm to deb

sudo alien --scripts -d <application_package>.rpm

now just run deb package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment