Linux Guides & Tips

This is a collection of guides and tips I've used/currently use.

Most of this was written with Manjaro Linux (KDE) in mind (Arch based distro) so keep that in mind when following the code (substitute pacman/yaourt for your package manager and change packages to the equivalent ones provided by your distro). Otherwise, this is pretty universal stuff.

Proxmox Hypervisor Install

Proxmox is a free to use, open source debian based type 1 hypervisor. Installing is just like any other distro but there's some things I do post-install that you may find useful.


## Fix swap - default (60) too aggressive ##
sysctl vm.swappiness=10
swapoff -a
swapon -a

## Proxmox Fixes for non-enterprise (free) users ##
echo 'deb http://download.proxmox.com/debian/pve buster pve-no-subscription' >> /etc/apt/sources.list
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak
apt update
sed -Ezi.bak "s/(Ext.Msg.show\(\{\s+title: gettext\('No valid sub)/void\(\{ \/\/\1/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy.service

### Install useful packages - sets glances to automatically open when ssh'ing in
apt install ifupdown2 lm-sensors htop glances -y
echo 'glances -1' >> ~/.profile

## PCI Passthrough Notes, read official documentation ##
sed -i 's/LINUX_DEFAULT="quiet"/LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream video=efifb:off"/' /etc/default/grub # This is for intel, note the video_efifb:off argument fixes BAR 3 errors
update-grub
echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" >> /etc/modules
echo "options vfio-pci ids=10b5:8605" > /etc/modprobe.d/vfio.conf # Change to whatever devices you want to passthrough - note that these will NOT be accessible to proxmox host, only guests you assign them to
echo -e "blacklist radeon\nblacklist nouveau\nblacklist nvidia" >> /etc/modprobe.d/pve-blacklist.conf # blacklist gpu drivers - remove any you need for proxmox host
update-initramfs -u

## Realtek r8125b driver install - for 2.5gbe realtek nics##
apt install pve-headers ethtool
wget https://github.com/awesometic/realtek-r8125-dkms/releases/download/9.005.01-1/realtek-r8125-dkms_9.005.01-1_amd64.deb
dpkg -i realtek-r8125-dkms_9.005.01-1_amd64.deb
apt install --fix-broken -y
echo "blacklist r8169" >> /etc/modprobe.d/pve-blacklist.conf
update-initramfs -u
# Can verify module is loaded by running: lspci -s  -vvv
# And by running: ethtool 

## UPS Battery setup - Slave Config (QNAP is master) ##
# Note that QNAP uses an older version of apcuspd so current versions don't work with it - we need to use nut instead
apt install nut
echo "MONITOR [email protected] 1 upsmon 123456 slave" >> /etc/nut/upsmon.conf # Change IP to your QNAP IP
sed -i "s/MODE=.*/MODE=netclient/" /etc/nut/nut.conf
systemctl enable nut-client.service
service nut-client start
# Run: upsc [email protected] # to check if it's working

## Windows Guest Notes ( see here for more details) ##
# Make sure you check the "Qemu Agent" in system tab
# For hard disk, use SCSI and Write back as cache option
# Add audio device - default is fine
# If you change display to spice, be sure to uncheck tablet pointer option or cursor will be screwy
# During setup, load SCSI, NetKVM, and balloon drivers
# After installing, in virtio iso, run the qguest-agent\qemu-ga-x86_64.msi, virtio-win-gt-x64.msi, and the other setup at root of iso
# Enable Remote Desktop (RDP), install passthorugh GPU drivers over rdp or before plugging in card if applicable

## Upgrade Notes
# Reboot needed if kernel is upgraded, otherwise you're fine
# If qemu updates - Stop/Start all VMs
									

My main VM is pfsense (freebsd based) which I use as my main router. Some important notes/quirks here:

  • Realtek drivers for pfsense (freebsd) appear to be rather unstable and so I opted to NOT passthrough my nics, I just use virtio
  • Make sure you check 'Disable hardware checksun offload' in System -> Advanced -> Networking IF you're using virtio for yout network devices like me
  • Proxmox should have a static ip set - make sure you change it to be in the subnet you set pfsense to (change the ip in /etc/hosts and /etc/network/interfaces). Then also reserve the static ip in pfsense
  • It's also a good idea to set static ip for one pc on your lan as well so if pfsense goes down, you can still access proxmox - ne nice to future you

Install Manjaro on HyperV

It's easier than you'd think. Check out my guide here.
Note that this is eol by microsoft in favor of WSL2. Check out Manjaro for WSL2 here.

Tweaks

Some useful tweaks I use or have used at some point

  • SSD Tweaks:
    # Move trim from a weekly task to a daily one
    sudo mv -v /etc/cron.weekly/fstrim /etc/cron.daily
    
    # Decrease swappiness (so system favors using ram over swap more (0=keep in ram as much as possilble, 100=use swap as much as possible)
    sudo nano /etc/sysctl.conf
    # Add: 'vm.swappniess=1' at end of file
  • Disable IPv6 (Useful for OpenVPN):
    sudo nano /etc/sysctl.d/99-sysctl.conf
    # Copy/paste these to bottom of file:
    
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    
    # Close file
    sudo sysctl -p
  • Sandbox Web Browser:
    # Install firejail package
    # Change web browser command so it has 'firejail ' in front of it
    # If having issues with sound:
    mkdir -p ~/.config/pulse
    cd ~/.config/pulse
    cp -v /etc/pulse/client.conf ~/.config/pulse
    echo "enable-shm = no" >> client.conf
    
    # Close any programs that have been firejailed
    # To confirm it's working, open firejailed program and type in terminal:
    firejail --tree
    
    # Note: Firejail blocks acccess to all folders/files in user directory except Downloads
    # This can be changed by modifiying corresponding file in /etc/firejail

Troubleshooting

These are applicable to all Arch based distros only (except the first one which is obviously for arch based distros using KDE desktop environment only)

  • If KDE System Monitor (KSysGuard) isn't working right (like graphs not showing up):
    # Replace 'username' with your username
    rm /home/username/.local/share/ksysguard/ProcessTable.sgrd
    rm /home/username/.local/share/ksysguard/SystemLoad2.sgrd
    rm /home/username/.config/ksysguardrc
  • If having issues with dolphin-root not installing due to packages being dependent on dolphin:
    sudo nano /var/lib/pacman/local/packagename/desc # Where packagename is the problem package
    # Change the 'DEPENDS' section from 'dolphin' to 'dolphin-root'
  • If having issues with updating due to dependencies (such as dolphin-plugins in this example), just ignore them:
    sudo pacman -Sdd dolphin-plugins

Microsoft Office 365 Wine Install Instructions

Wine version used for this was 3.7-1

This was pretty huge for me. WineHQ is the place to find this stuff by the way, I modified it slightly so it'd work for me (and added/changed regedits based on what Crossover did)

# Install needed components:
sudo pacman -Sy wine wine-mono wine_gecko winetricks samba smbclient libwbclient alsa-lib alsa-plugins gnutls libpng libpulse libglvnd libxcomposite libxinerama libxml2 lib32-alsa-lib lib32-alsa-plugins lib32-gnutls lib32-libpng lib32-libpulse lib32-libglvnd lib32-libxcomposite lib32-libxinerama lib32-libxml2 gconf gst-plugins-base gst-plugins-base-libs gst-plugins-good gstreamer lcms2 libcanberra libcanberra-pulse libva libva-intel-driver libva-vdpau-driver libvdpau libx11 libxmu libxrandr libxslt libxss libxt libxtst libxv mesa mesa-vdpau mpg123 p11-kit vulkan-intel lib32-gconf lib32-gst-plugins-base lib32-gst-plugins-base-libs lib32-gst-plugins-good lib32-gstreamer lib32-lcms2 lib32-libcanberra lib32-libcanberra-pulse lib32-libva lib32-libva-intel-driver lib32-libva-vdpau-driver lib32-libvdpau lib32-libx11 lib32-libxmu lib32-libxrandr lib32-libxslt lib32-libxss lib32-libxt lib32-libxtst lib32-libxv lib32-mesa lib32-mesa-vdpau lib32-mpg123 lib32-p11-kit lib32-vulkan-intel
yaourt -S lib32-nss-mdns

# Get installer from office365 in school email or whatever (will need to spoof browser user agent as windows)
# Note that only 32bit office is working with wine at the moment. Don't even bother with 64bit.
export WINEARCH=win32
export WINEPREFIX=~/.msoffice
wineboot -i
winetricks winecfg
# Change to Windows
winetricks corefonts
winetricks winecfg # Check for windows 7 again
winetricks dotnet20 gdiplus msxml6 riched20
winetricks regedit
# In [HKEY_CURRENT_USER\Software\Wine]:
# Make a Direct2D, Direct3D, and X11 Driver keys
# Make a new DWORD in Direct2D: max_version_factory=0
# Make a new DWORD in Direct3D: MaxVersionGL=30002
# Make a new String value in X11 Driver: ScreenDepth=32
winetricks winecfg
# Make sure these overrides are present: gdiplus (native), msxml6 (native,builtin), riched20 (native,builtin)
# Make sure it's still Windows 7
wine ~/Desktop/SetupFile.exe # Replace this with the full path to your setup exe file
# Installer won't exit automatically, will need to close manually in system monitor or whatever
cp ~/.msoffice/drive_c/Program\ Files/Common\ Files/Microsoft\ Shared/ClickToRun/{AppvIsvSubsystems32.dll,C2R32.dll} ~/.msoffice/drive_c/Program\ Files/Microsoft\ Office/root/Office16/
# In KDE, go to System Settings -> Window Management -> Window Rules, then import this kwinrule file to fix windows resizing issues
# To fix powerpoint hanging on open: force quit it in whatever task manager you have, then reopen it. It'll prompt for safe mode, say "Yes". Then go to File -> Options -> Addins -> Manage (at bottom), delete the onenote addin
                  

Misc Programs

These are install instructions and helpful tips for various programs

  • Thunderbird not showing all of your subfolders?
    Go to Preferences -> Account settings -> Server settings (for target email accounnt) -> Advanced - uncheck 'show only subscribed folders'