Skip to content

Debian/Ubuntu notes

September 29, 2023
December 8, 2014

The Debian Administrator's Handbook
Ubuntu Desktop Guide
CommunityHelpWiki - Community Help Wiki

Trying To Make Ubuntu 18.10 Run As Fast As Intel's Clear Linux - Phoronix

Dist upgrade

Upgrade Ubuntu 16.04 LTS to Ubuntu 18.04 LTS Server
How To Upgrade To Ubuntu 18.04 LTS Bionic Beaver - LinuxConfig.org

Package managers

Ubuntu Repositories - pkgs.org

What is the difference between dpkg and aptitude/apt-get? - Ask Ubuntu
6.4. Frontends: aptitude, synaptic
How to Use APT and Say Goodbye to APT-GET in Debian and Ubuntu
APT Cheat Sheet - Packagecloud Blog
Apt-Cacher-NG User Manual
aptly - Debian repository management tool

list upgrades: apt-get -s upgrade

Ubuntu Apps Directory
APT Browse - Home

Good PPAs

AUR source

Pacstall - The AUR for Ubuntu
pacstall/pacstall: An AUR-inspired package manager for Ubuntu
pacstall Command Examples – The Geek Diary

AUR You Ready? » Linux Magazine

update packages

# update package cache
sudo apt update
# list upgradable packages
apt-get -s upgrade

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove

repo source

Wrapped with a Bow on Top » Linux Magazine

inxi -r
cat /etc/apt/sources.list
ls /etc/apt/sources.list.d

Packages info are cached at /var/cache/apt

# clean cache
sudo apt-get clean
# this fix "Hash Sum mismatch" issue
sudo rm -rf /var/lib/apt/lists/*

List available versions and origin repo

apt policy docker-ce
apt-cache madison docker-ce

apt - what is the file /var/lib/dpkg/status about and why do I need it - Ask Ubuntu
command line - What do the numbers in the output of apt-cache policy tell us? - Ask Ubuntu
Fixing APT Hash Sum Mismatch: Consistent APT Repositories - Packagecloud Blog

installed packages

apt list --installed

dpkg --get-selections
dpkg -l
# backup installed packages
dpkg --get-selections > /var/lib/backup/dpkg-state

apt - How to list all installed packages? - Ask Ubuntu
Apt get list installed packages | Ubuntu list installed packages | RoseHosting

The 'autoremove' option is used to remove packages that were installed as dependencies of another package that has since been removed (so long as no other package depends on them).

locally installed

apt - Why are packages listed as "installed", "installed,automatic", or "installed,local"? - Ask Ubuntu
These are packages not found in repos.

apt list --installed | grep ",local"
apt list --installed | awk -F/ '/local]/{print $1}' | xargs apt policy

# DANGEROUS, review before use
apt list --installed | awk -F/ '/local]/{print $1}' | sudo xargs apt purge -y

residual-config

apt list | grep residual-config
dpkg -l | grep '^rc'

# DANGEROUS, review before use
apt list | awk -F/ '/residual-config]/{print $1}' | sudo xargs apt purge -y
dpkg -l | grep '^rc' | awk '{print $2}' | sudo xargs dpkg --purge

If a package has "residual config", it means that the package was indeed uninstalled, but any configuration files were left behind, such that if you reinstall the package, it will be configured as it was. The 'purge' option uninstalls a package AND its configuration files, if any. This does NOT, BTW, include user's configuration data in their own home directory - it applies to system-wide configuration (e.g., stuff in /etc or /usr/share).

files in package

List files of a Debian or Ubuntu package | Slopjong

For installed packages:

dpkg -L vim

For not-yet-installed packages:

# (optional) download package from repo with:
apt-get --download-only vim
dpkg --contents vim_7.3.547-6ubuntu5_amd64.deb

list dependent package

offline install

sudo dpkg -i *.deb

example from Ubuntu - WineHQ Wiki

# add PPA for wine
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update

# clean cache and download to cache
sudo apt-get clean
sudo apt-get --download-only install winehq-devel
sudo apt-get --download-only dist-upgrade  # needed?

# copy to usb-drive
cp -R /var/cache/apt/archives/ /media/usb-drive/deb-pkgs/

# install from usb-drive
cd /media/usb-drive/deb-pkgs
sudo dpkg -i *.deb

outdated release

When you would like to keep using the release without upgrade

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

# for mint
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/official-package-repositories.list

How to fix Ubuntu/Debian apt-get 404 Not Found Package Repository Errors (Saucy, Raring, Quantal, Oneiric, Natty…) | sMyl.es

install old package

# list all versions
apt show -a libtiff5

apt install -y --allow-downgrades libtiff5=4.0.6-1 libtiff5-dev=4.0.6-1 libtiffxx5=4.0.6-1

apt mark libtiff5=4.0.6-1 libtiff5-dev=4.0.6-1 libtiffxx5=4.0.6-1

deb-get

wimpysworld/deb-get: apt-get functionality for .debs published in 3rd party repositories or via direct download 📦
Supported softwares
How To Install Third-Party Linux Applications with Deb-Get | Tom's Hardware

Building .deb Package

sbuild - Debian Wiki
Quickly build a Debian package with Docker | spkdev.net

Post-install

UbuntuUpdates - All package updates
Things To Do After Installing Ubuntu 18.04 (Bionic Beaver)
12 Easy Steps to Speed Up Ubuntu Linux

Netbook

eDongCity NB1000

sudo apt install xinput rfkill intel-microcode fonts-noto-cjk
# https://www.ubuntuupdates.org/ppa/google_chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt update
sudo apt install google-chrome-stable

add linux-installs.md here

Timezone

$ date
Thu Mar 21 18:02:49 MST 2012
$ more /etc/timezone
US/Arizona

$ sudo dpkg-reconfigure tzdata

http://www.christopherirish.com/2012/03/21/how-to-set-the-timezone-on-ubuntu-server/

Network

Netplan define network config with YAML

Static IP

Edit /etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# Configuration for enp0s5
auto enp0s5
allow-hotplug enp0s5

iface enp0s5 inet static
  address 10.6.64.26/24
  gateway 10.6.64.1
  dns-nameservers 1.1.1.1 8.8.8.8
sudo systemctl restart networking.service
sudo systemctl status networking.service

ip -c a show
ip -c a show enp0s5

man interfaces

update kernel

sudo apt-cache search linux-image-*
sudo apt-cache search linux-image-X.X.XX-generic

sudo apt-get install linux-image-X.X.XX-generic
# headers is optional
sudo apt-get install linux-headers-X.X.XX-generic
sudo update-initramfs -u -k all
# OR
sudo update-initramfs -u -k `uname -r`
sudo update-grub
sudo reboot

remove old kernel

# list kernels
dpkg --get-selections | grep linux-image
sudo apt-get purge linux-image-X.X.XX-XX-generic

# batch
sudo su
dpkg --get-selections | grep linux-image | grep deinstall | awk '{ print $1 }' | xargs dpkg --purge --force-all