Skip to content

Instantly share code, notes, and snippets.

@Postrediori
Last active March 27, 2025 18:09
Show Gist options
  • Save Postrediori/6627a379115da10cc423478f5cdd06bf to your computer and use it in GitHub Desktop.
Save Postrediori/6627a379115da10cc423478f5cdd06bf to your computer and use it in GitHub Desktop.
Ubuntu Tips&Tricks

Ubuntu HowTos

Contents

Enable VPN in Kubuntu

Install OpenVPN plugin:

apt install network-manager-openvpn

Dual-boot Kubuntu and Windows

Single passphrase for several LUKS encrypted disks

  1. Install keyutils
  2. Add keyscript=decrypt_keyctl to /etc/crypttab:
part1_crypt   /dev/disk/...    none    luks,discard,keyscript=decrypt_keyctl

Fix clock for dual-boot with Ubuntu and Windows

timedatectl set-local-rtc 1

Synchronize time and date from the internet

sudo timedatectl set-ntp off
sudo timedatectl set-ntp on

Source: https://askubuntu.com/a/998449

List installed kernels

dpkg --list | grep -E -i --color 'linux-image|linux-headers'

dpkg --list | grep -i -E --color 'linux-image|linux-kernel' | grep '^ii'

Reverse dependencies search

apt-cache rdepends perl

Fix "The following packages have been kept back" error message after apt upgrade

Run:

sudo apt-get --with-new-pkgs upgrade <list of packages kept back>

Source: https://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it/602#602

Fix "Can't locate Text/Iconv.pm in @INC" duruign apt install

Download libtext-iconv-perlpackage manually from https://packages.ubuntu.com (e.g. https://packages.ubuntu.com/mantic/libtext-iconv-perl) and install via dpkg:

sudo dpkg -i libtext-iconv-perl_1.7-8_amd64.deb 

Source: https://askubuntu.com/a/1166645

Enable VirtualBox driver with SecureBoot enabled

Sign the driver according to instructions at https://stackoverflow.com/a/59536913

Mirror on Gist: https://gist.github.com/Postrediori/a9e1f60e615163b76b427789c8a4653c#manually-sign-virtualbox-kernel-modules-on-linux-to-run-with-secuteboot

Clear all history (for example, before making .ova)

history -c && history -w

How to disable/enable GUI

Disable GUI on the next boot:

sudo systemctl set-default multi-user

End current Gnome session:

gnome-session-quit

Enable GUI on the next boot:

sudo systemctl set-default graphical

Run Gnome from console mode:

sudo systemctl start gdm3

Source: https://linuxconfig.org/how-to-disable-enable-gui-on-boot-in-ubuntu-20-04-focal-fossa-linux-desktop

Not able to change the Nvidia driver

Driver is stuck on Continue using a manually installed driver.

Reinstall drivers:

sudo ubuntu-drivers install

Source: https://askubuntu.com/a/1237598

Change screen resolution of Ubuntu guest in Hyper-V

Open grub file /etc/default/grub and change value GRUB_CMDLINE_LINUX_DEFAULT. Replace 1366x768 withthe desired resolution.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1366x768"

Update grub and install linux-image-extra-virtual package

sudo update-grub

sudo apt install linux-image-extra-virtual

Shutdown the VM and open PowerShell as administrator on host machine and run below. Replace "ubuntu" with your vm name. Change "1366" and "768" with the desired resolution.

set-vmvideo -vmname ubuntu -horizontalresolution:1366  -verticalresolution:768 -resolutiontype single

Start VM.

Source: https://superuser.com/a/1680613

Other links

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