Ubuntu
Introduction
Ubuntu is a Linux distribution with excellent support and a broad user community. Many technical projects use this distribution as their target platform. Ubuntu is based on Debian Linux. The package management tools are therefore dpkg and apt-get.
Determining the Version of Ubuntu Running
Use the lsb_release command to view version information about the running LSB-compliant Linux system.
sudo apt install lsb-release lsb_release -a
generates the example output
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy
Upgrading To A New Release
First of all, check you current version by typing
lsb_release -a
To upgrade to a new major release (for example, 16.04 to 16.10) type the command
do-release-upgrade
If there is no major release available but a point release has been issued, you can upgrade by typing
sudo apt-get update sudo apt-get dist-upgrade
Working With Repositories
Repository Sources
Third-party repositories can be added to the list of source repositories with the command
sudo apt-add-repository <repository URL>
Source repositories that are provided by Ubuntu can be found in the file /etc/apt/sources.list. Third-party repositories that have been added afterwards can be found in the directory /etc/apt/sources.list.d/.
Querying Installed Packages
To find out which package a given file belongs to:
apt contains <file path>
To find out which files are included in a package use the Debian utility dpgk:
dpkg -L <package name>
NFS (Network File System)
Setting up an NFS Server
sudo apt install nfs-kernel-server
then edit /etc/exports to add lines in the following format:
<directory> <hostname>(<options>) [<hostname>(<options>)]*
where <directory> is the directory that you want to make available over NFS, followed by one or more pairs of client host names and access options. <hostname> can be an IP address, a domain name with wildcards, or a subnet. of the allowed client machine, <options> is a list of options that determine whether the directory is, e.g., writable. The file format is better explained in this article. Examples are
/home/james/photos 192.168.178.62(r,async) 192.168.178.55(r, async) /mnt/storage2 192.168.178.0/24(rw,sync,no_subtree_check)
After editing /etc/exports, apply the NFS configuration via /usr/sbin/exportfs:
sudo exportfs -ar
Query the allowed NFS protocol versions for the clients via
sudo cat /proc/fs/nfsd/versions
Mounting an NFS Drive
sudo apt install nfs-common
and mount the NFS with the usual /usr/bin/mount command using the -t nfs option like in this example:
sudo mount -t nfs -o vers=4 192.168.178.8:/storage /backups
where vers=4 indicates the NFS protocol version, 192.168.178.8 is the address of the NFS server, /storage is the path of the served directory on the NFS server (in NFS version 4 the path is relative to the served NFS root directory), and /backups is the mount point on the client machine
Installing NVIDIA Drivers
Follow the instructions from Ubuntu to install device drivers for NVIDIA graphics cards and configure for your system. There are also instructions for manually installing a driver downloaded from NVIDIA, which is not recommended.
Alternative packages with newer drivers are available via Launchpad after adding the graphics-drivers repository by typing
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update
If your monitor cable (HDMI, DisplayPort, etc.) is connected to the output of the integrated graphics solution of your computer (e.g., Intel Skylake Graphics) you should shut down your computer and your monitor, unplug the monitor cable from the integrated graphics port and plug it into one of the ports of the NVIDIA card. Restart your computer, boot into the BIOS utility provided by your motherboard and check that Secure Boot is disabled, otherwise it will prevent kernel modules from being loaded.
Make sure nvidia-prime is installed and use it to select the NVIDIA card as the prime graphics output:
sudo apt install nvidia-prime sudo prime-select nvidia
This modifies /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf and /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf to use the latest installed nvidia driver. To check the status of the graphics card and the driver assigned to it you can enter
inxi -G
The output should look like this:
Graphics: Card: NVIDIA Device 1b81 Display Server: X.Org 1.18.4 drivers: nvidia (unloaded: fbdev,vesa,nouveau) Resolution: 3840x2160@60.00hz GLX Renderer: GeForce GTX 1070/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 370.28
Note that nvidia is the selected driver in the line that starts with Display Server:.
You may have to add the string nomodeset to the line that starts with GRUB_CMDLINE_LINUX_DEFAULT= in the file /etc/default/grub. For example,
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
where quiet and splash were the default options on my system. Be sure to run
sudo update-grub
so that the change to /etc/default/grub has an effect on /boot/grub/grub.cfg. Beware, however, that adding nomodeset will also prevent your display mode from being detected and set automatically if anything should go wrong. Finally, if your boot disk contains multiple bootable Linux system partitions, make sure that the bootloader that you just updated is the one installed in the Master Boot Record (MBR). You can install a Grub bootloader in the MBR via
$ sudo grub-install --boot-directory=/boot /dev/sda $ sudo update-grub
where /dev/sda is an example and needs to be replaced with your specific boot disk device file.
Other useful commands to check the device status are:
ubuntu-drivers devices
for showing a list of packages from the Ubuntu repository that are drivers for the installed hardware,
sudo lshw -c display
for showing information about installed hardware in the display category,
lspci -nnk | grep -iA3 vga
for showing information about graphics cards connected to the PCI bus, and
xrandr
for showing a list of possible display modes in which the connected screen can operate.