Skip to content

Instantly share code, notes, and snippets.

@dyejon
Created April 12, 2021 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyejon/8e78b97c4eba954ddbda7ae482821879 to your computer and use it in GitHub Desktop.
Save dyejon/8e78b97c4eba954ddbda7ae482821879 to your computer and use it in GitHub Desktop.
Debootstrap Ubuntu 20.04 with Plasma, without LiveUSB or netboot image

Ubuntu 20.04 LTS with minimal KDE

Netboot images are deprecated (not available at all for 20.10+) so debootstrap utility is used instead. I will install minimal Plasma desktop and enable OEM mode. Then I can create my user account from within OEM session.

Security notice

It seems like Chromium DEB is no longer updated, which is a huge security risk (v87 in repos, v89 upstream). "Sources list from 18.04" section is now removed, it is recommended to use Flatpak instead.

Known issues

  • Ubiquity will crash if you pick system language other than English. You can change language later using either KDE System Settings (already installed) or gnome-language-selector utility (from language-selector-gnome package).
  • If you get squares instead of valid fonts when using Flatpak application, try to clear font cache
    • Command line: flatpak run --command=fc-cache <APPLICATION_ID> -f

Partitions

Created with GParted

Partition Mount point Format Size Flags
/dev/sda1 /boot/efi VFAT 128MiB boot, esp
/dev/sda2 / EXT4 max (n/a)
/dev/sda3 (n/a) swap 8GiB swap

Required packages

apt install debootstrap

Mount points

mkdir /target
mount /dev/sda2 /target

mkdir -p /target/boot/efi
mount /dev/sda1 /target/boot/efi

swapon /dev/sda3

Operating system's barebones

debootstrap --variant=minbase --arch=amd64 focal /target

Mount points, again

for i in dev proc sys
do
mount --bind /$i /target/$i
done

Environment switch

chroot /target /bin/bash
export PS1="(chroot) $PS1"
export DEBIAN_FRONTEND=noninteractive

Sources list

cat << EOF > /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse 
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
EOF

Optional but highly recommended: disabled packages

cat << EOF > /etc/apt/preferences.d/99-disabled
Package: snapd
Pin: release *
Pin-Priority: -1

Package: unattended-upgrades
Pin: release *
Pin-Priority: -1

Package: apport
Pin: release *
Pin-Priority: -1
EOF

Package updates

apt update
apt dist-upgrade

Filesystem table

Warning: these are example UUID values, make sure you're using the correct ones!

cat << EOF > /etc/fstab
UUID=11111111-1111-1111-1111-111111111111 / ext4 errors=remount-ro 0 1
UUID=0000-0000 /boot/efi vfat umask=0077 0 1
UUID=22222222-2222-2222-2222-222222222222 none swap sw 0 0
EOF

Kernel and bootloader

apt install linux-generic grub-efi-amd64
grub-install /dev/sda

Minimal Plasma desktop

Plasma and Xorg will be installed as a dependency

apt install sddm sddm-theme-breeze

Extra packages

Absolute minimum IMO:

apt install plasma-nm konsole

Nice to have:

apt install ark dolphin fonts-noto-color-emoji gwenview kde-spectacle kwrite okular

Useful GNOME stuff:

apt install baobab gnome-calculator gnome-clocks gnome-disk-utility

Flatpak

Flatpak version available in Ubuntu repositories is out of date (confirmed with Chromium). Use PPA for the latest version:

add-apt-repository ppa:alexlarsson/flatpak
apt install flatpak plasma-discover-backend-flatpak

Flathub is the most popular app repository for Flatpak:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Installation example for Chromium:

flatpak install flathub org.chromium.Chromium

NetworkManager configuration

cat << EOF > /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=none
EOF

Hibernation

echo "RESUME=UUID=22222222-2222-2222-2222-222222222222" > /etc/initramfs-tools/conf.d/resume
update-initramfs -u -k all

sed -i 's/quiet splash/resume=UUID=22222222-2222-2222-2222-222222222222 hibernate=nocompress/g' /etc/default/grub
update-grub2

Optional: increased inotify limit

Might be necessary if you have multiple IDEs opened at the same time

echo "fs.inotify.max_user_watches=131072" >> /etc/sysctl.d/99-sysctl.conf

OEM mode

Ignore The unit files have no installation config errors

apt install oem-config-kde
oem-config-prepare

Housekeeping

exit
umount /target/{proc,sys,dev,boot/efi,}

Reboot

And follow the on-screen instructions :)

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