No edit summary
No edit summary
Line 59: Line 59:
The copied file is renamed to '''authorized_keys''', which is the expected file name for the SSH server to look up the public keys of trusted clients.
The copied file is renamed to '''authorized_keys''', which is the expected file name for the SSH server to look up the public keys of trusted clients.
<br />
<br />
If ''authorized_keys'' is to hold multiple keys, you should use '''ssh-copy-id''' instead of ''scp'':
<pre class="terminal">
ssh-copy-id -i ~/.ssh/for-raspberry-pi_rsa.pub pi@192.168.1.10
</pre>
<br />
<br />
Now use ''ssh-agent'' on your local machine to start a special shell session that uses the new SSH key to automatically authenticate any SSH connection from your machine to the Raspberry Pi:
Now use ''ssh-agent'' on your local machine to start a special shell session that uses the new SSH key to automatically authenticate any SSH connection from your machine to the Raspberry Pi:

Revision as of 2019-04-11T18:54:06



Introduction

Ubuntu (http://ubuntu.com) is probably the best supported Linux distribution in the computer industry. Ubuntu is based on Debian Linux. The package management tools are therefore dpkg and apt-get.

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>



SSH Logins Without Typing The Password

If you connect to a remote computer via ssh or copy files via scp frequently, you should consider using ssh-agent, which saves you from typing your login password each time.

First, you create an RSA public/private key pair that identifies your local machine. You may already have created such a key in your SSH keychain. It is good security practice, however, to use a separate key for each device you want to connect to. Let us assume you want to connect to a Raspberry Pi. The command to create a new SSH key would be

ssh-keygen -t rsa -b 2048 -C "for Raspberry Pi"

where '-b 2048' specifies the key length in bits. You will be prompted to enter the path and name of the file in which the key will be saved. Choose a name that makes it clear that it was created for connecting to the Raspberry Pi. Next, you will be prompted for a password. Just press the Enter key for no password.

Now that the SSH key is created, you need to copy the generated key (public) into the folder /home/pi/.ssh/ on the Raspberry Pi:

scp ~/.ssh/for-raspberry-pi_rsa.pub pi@192.168.1.10:/home/pi/.ssh/authorized_keys

The copied file is renamed to authorized_keys, which is the expected file name for the SSH server to look up the public keys of trusted clients.
If authorized_keys is to hold multiple keys, you should use ssh-copy-id instead of scp:

ssh-copy-id -i ~/.ssh/for-raspberry-pi_rsa.pub pi@192.168.1.10


Now use ssh-agent on your local machine to start a special shell session that uses the new SSH key to automatically authenticate any SSH connection from your machine to the Raspberry Pi:

eval "$(ssh-agent -s)" # starting a new shell session
ssh-add ~/.ssh/for-raspberry-pi_rsa

Done! This was the last time you had to enter the password for user pi.

By the way, you can list all the keys that were added to the SSH agent by entering

ssh-add -l



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.

Workaround for libEGL.so.1 bug

There is a bug in the installation script for the recent Ubuntu NVIDIA drivers. The two files /usr/lib32/nvidia-375/libEGL.so.1 and /usr/lib/nvidia-375/libEGL.so.1 (assuming you are installing the NVIDIA drivers with major revision number 375) should not be real files but symbolic links to the actual library file libEGL.so.375.xx, where xx stands for the minor version number of the driver. This bug can prevent your Ubuntu from initializing the graphics system during booting, which makes the bug a critical error. The workaround is to manually create the symboling links:

cd /usr/lib32/nvidia-375/
sudo mv libEGL.so.1 libEGL.so.1.orig
sudo ln -s libEGL.so.375.66 libEGL.so.1
cd /usr/lib/nvidia-375/
sudo mv libEGL.so.1 libEGL.so.1.orig
sudo ln -s libEGL.so.375.66 libEGL.so.1
sudo ldconfig

See this forum discussion for more information.


Debug data: