Table of Contents

Technical Information: Ubuntu Topics
If you're setting up DNS services on Ubuntu server ...

Installation

Minimal Server


Virtualization Server

Bridged Networking

LXC: Server Configuration

Limits

Official documentation: https://github.com/lxc/lxd/blob/master/doc/production-setup.md

In /etc/security/limits.conf:

*                soft    nofile          1048576
*                hard    nofile          1048576
root             -       nofile          8192000
*                soft    memlock         unlimited
*                hard    memlock         unlimited
root             soft    memlock         unlimited
root             hard    memlock         unlimited

Kernel

In /etc/sysctl.conf:

fs.aio-max-nr = 524288
fs.inotify.max_queued_events = 8192000
fs.inotify.max_user_instances = 8192000
fs.inotify.max_user_watches = 8192000
kernel.dmesg_restrict = 1
kernel.keys.maxbytes = 2000000
kernel.keys.maxkeys = 2048
net.core.bpf_jit_limit = 3000000000
net.ipv4.neigh.default.gc_thresh3 = 81920
net.ipv6.neigh.default.gc_thresh3 = 81920
vm.max_map_count = 262144
#net.ipv4.tcp_mem = 182757 243679 365514
net.core.netdev_max_backlog = 182757

Network

In /etc/udev/rules.d/90-net.rules:

SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="eth?" ATTR{tx_queue_len}="10000"
SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="br?" ATTR{tx_queue_len}="10000"

Basic Qemu

Advanced/Other Virtualization


Basic configuration ...

Extra packages

Audio Configuration

Default Audio Device

This should be in /etc/security/limits.d/audio.conf or /etc/security/limits.conf:

@audio   -  rtprio     95
@audio   -  memlock    unlimited

Replace 1 with ALSA card number /etc/asound.conf:

defaults.pcm.card 1
defaults.ctl.card 1

Disable PulseAudio auto-spawn

If you want to run Jack for low-latency high-performance audio, you'll need to make sure that Jack can grab your audio interface directly, which means you won't want PulseAudio to grab it on startup. Disabling PulseAudio auto-spawn is most likely necessary, so you can start it manually after Jack is running:

Route PulseAudio through Jack

On Debian-like systems, be sure to install pulseaudio-module-jack. Load with:

pacmd load-module module-native-protocol-unix
pacmd load-module module-jack-source channels=2
pacmd load-module module-jack-sink channels=2
pacmd set-default-sink jack_out
pacmd set-default-source jack_in

(TODO: Add information about Fedora, OpenSuSE and the lot)
Then, if you intend to run jackd all the time, in /etc/pulse/default.pa or ~/.pulse/default.pa:

load-module module-native-protocol-unix
load-module module-jack-sink channels=2
load-module module-jack-source channels=2
load-module module-null-sink
load-module module-stream-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-suspend-on-idle
set-default-sink jack_out
set-default-source jack_in

The following isn't strictly necessary but might be useful, in ~/.pulse/daemon.conf:

default-sample-format = float32le
default-sample-rate = 48000
realtime-scheduling = yes
exit-idle-time = -1

For mkusb:

As root:

add-apt-repository ppa:mkusb/ppa  # and press Enter
apt update
apt install mkusb

32-bit Compatibility

Skype for 16.04

add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
apt-get update
apt-get install skype

MicroK8s Node

LXC Ubuntu-specifics

https://help.ubuntu.com/lts/serverguide/lxc.html

Basic init steps for Ubuntu

Details to intialize for a new LXC container instance

Activate 32-bit compatibility

Distribution Trivia

Prevent Sleep/Hibernate

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

DNS Cache Purge

systemd-resolve --flush-caches

Gnome Desktop Topics

Reverting to console boot

Application Menu

Add an item

Upgrading

The /boot partition can fill up with old kernels unless periodically purged.
To see how many old kernels are present:

apt list --installed | grep 'linux-image'

There's little/no reason to keep more than one old kernel, so removing all but the most recent is advised.
After upgrading, if a new kernel is installed, keeping the most recent two is fine.

Disable IPv6

Put into /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Run to re-load: sysctl -p

Enable TCP listen for X

X TCP Listen in Gnome

In /etc/gdm3/custom.conf :

[security]
DisallowTCP=false

[xdmcp]
ServerArguments=-listen tcp

X TCP Listen in XFCE

Populate /etc/lightdm/lightdm.conf with:

[SeatDefaults]
greater-session=unity-greater
user-session=ubuntu
xserver-allow-tcp=true

[XDMCPServer]
enabled=true

Some details for lighttpd

Some Issues -> Solutions

Boot waiting for disconnected wired NIC

systemctl disable systemd-networkd-wait-online.service
systemctl mask systemd-networkd-wait-online.service

(second line prevents the wait-online service from starting if requested by another service)

Deja Dup backup in 16.04 (Unity)

Thunar (file manager) Network Browsing

Permission denied for apt

When installing a .deb package using apt, and the package file is placed under the root user's home directory (typically /root), permissions will usually not allow the _apt user to access the .deb file for everything it needs to. The error would show up something like this:

Download is performed unsandboxed as root as file <somepathtofile> couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

In this case, the /root directory is probably set to drwx—— for permissions, so changing it to allow the root group access fixes the problem:

chmod 775 /root

Some Hardware Trivia

Mouse lag on Raspberry Pi 4b

In /boot/firmware/cmdline.txt, add to end of line:

usbhid.mousepoll=8

ACEPC W5 Pro: wifi

cd /lib/firmware/brcm ; cp brcmfmac43455-sdio.raspberrypi,4-model-b.txt brcmfmac43455-sdio.txt

Tune CPU frequency scaling for low-latency audio

cpufreq-set -g performance

Disable auto-sleep/auto-suspend

(use unmask to re-enable)

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable screen blanking

… or, reactivate a deactivated display (happens with some HDMI)

xset -dpms s off s noblank s 0 0 s noexpose

EXFAT filesystem support

apt install exfat-utils exfat-fuse

This should resolve the issue:

modprobe -rv rt2800pci
modprobe -v rt2800pci nohwcrypt=Y

Put this in /etc/modprobe.d/rt2800pci.conf to make it permanent:

options rt2800pci nohwcrypt=Y

SecureBoot: Signed Kernel

https://blog.ubuntu.com/2017/08/11/how-to-sign-things-for-secure-boot

openssl req -config ./openssl.conf -new -x509 -newkey rsa:2048 -nodes -days 36500 -outform DER -keyout “MOK.priv” -out “MOK.der”

mokutil –import MOK.der

mv vmlinuz-4.18.20-041820-generic vmlinuz-4.18.20-041820-generic-unsigned

openssl x509 -in MOK.der -inform DER -outform PEM -out MOK.pem

sbsign –key MOK.priv –cert MOK.pem /boot/vmlinuz-4.18.20-041820-generic-unsigned –output /boot/vmlinuz-4.18.20-041820-generic

# This definition stops the following lines choking if HOME isn't
# defined.
HOME                    = .
RANDFILE                = $ENV::HOME/.rnd 
[ req ]
distinguished_name      = kernel_signing
x509_extensions         = v3
string_mask             = utf8only
prompt                  = no

[ kernel_signing ]
countryName             = US
stateOrProvinceName     = Minnesota
localityName            = Albert Lea
0.organizationName      = Albert Lea Data
commonName              = Secure Boot Signing
emailAddress            = kernelsigning@albertleadata.com

[ v3 ]
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer
basicConstraints        = critical,CA:FALSE
# Only include the second for module-signing
#extendedKeyUsage        = codeSigning,1.3.6.1.4.1.311.10.3.6,1.3.6.1.4.1.2312.16.1.2
extendedKeyUsage        = codeSigning,1.3.6.1.4.1.311.10.3.6
nsComment               = "OpenSSL Generated Certificate"


Links: Linux InfoTech Info