Debugging Linux#
Debian Linux is documented in a comprehensive wiki with descriptions for setting up the system, installing software (packages), and tutorials for trouble shooting. This page provides guidance for problems that may occur in particular when Debian Linux is installed on a Virtual Machine (VM).
Power management (battery life)#
Working with Linux on a laptop often drains the battery quickly, especially when working with pure Debian. To increase power efficiency, consider installing lightweight Ubuntu (derivatives), that is Mate editions. Also, the following tool can help improve battery life on Ubuntu (derivatives):
sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt install tlp tlp-rdw
Alternatively, Fedora or Arch are said to be power efficient. However, Arch can be difficult for Linux novices.
Particular Problems#
Root Drive Is Running Out of Disk Space#
Tip
Read this entire section before taking action. Otherwise, you risk to unnecessarily allocate disk space.
In general, keep the system clean after updating it through typing in Terminal:
sudo apt clean
sudo apt autoclean
sudo apt autoremove
sudo apt autoremove --purge
sudo apt autoremove
Subversion (SVN) repositories may also contain old and unnecessary chunks, which can be removed (e.g., from a local TELEMAC-MASCARET repository) with (the second argument is the SVN directory):
svn cleanup ~/telemac/v8p1 --non-interactive
If the root partition of the virtual disk is running out of space, Debian prompts a warning message Root drive is running out of disk space […]. There are many ways described for freeing up space through the deletion of obsolete or unnecessary packages, but this problem may occur even though only absolutely necessary packages are installed on a too small virtual disk.
In the case that the disk space limitation problem occurs on a virtual disk created with VirtualBox, open VirtualBox, highlight the VM subjected to the problem (e.g. Debian Linux). Make sure that the VM is off. In VirtualBox locate the File drop-down menu (top-left), click on it and open the Virtual Media Manager. Highlight the virtual disk where Debian Linux is installed and increase the Size. Click Apply and Close the Virtual Media Manager.
Increasing the virtual disk space alone is not sufficient, because the free disk space needs to be allocated to the root partition. To do so:
Start Debian Linux (e.g. in VirtualBox, click on Start). *Once Debian Linux started, go to Activities and type
gparted
in the search box. Find the Gparted software and click on it. If not yet installed, install and open Gparted.In Gparted look for the
ext4
partition (typically/dev/sda2
) and highlight the partition directly behind that partition (typically/dev/sda3
).Right-click on
/dev/sda3
(the partition behind the root partition) and click on Swapoff.Right-click again on
/dev/sda3
and click on Resize/Move.In the Free space preceding (MiB): box, enter a reasonable size to free up disk space for the root partition (e.g.,
2000
).Make sure that the New size and Free space following boxes are coherent with the available disk space, in particular if you just increased the size of the virtual disk.
Click on Resize/Move.
Right-click on the root partition (
/dev/sda2
) and click on Resize/Move.Increase the partition size by the amount of disk space free-ed up from the following partition (e.g. increase
6667
MiB to8667
MiB).Make sure that there is no Free space following and that the field are coherent with the available space after the root partition.
Click on Resize.
Find the green check mark in the top menu of Gparted and click on it. This action will apply the changes. Most likely, a warning message informs about possible problems when restarting the system with the new partition configuration (click OK - increasing the root disk is not problematic if it is at the cost of any empty partition).
After repartitioning successful finished, right-click on the partition after the root partition (
/dev/sda3
) and make sure that it is again in Swapoff mode. If this is not the case (i.e., you cannot find Swapoff in the context menu and only Swapon is visible), click on Swapon.
Tip
To revert undesired changes in the re-partitioning plan (before clicking on the apply-check mark), click on the yellow return arrow next to the green apply-check mark.
Keep System and Software up to Date#
Read more on the developer’s website.
Permission Denied Messages#
Permission denied messages may occur because of the fail-safe design of Debian, but denied read and write rights may quickly become annoying, in particular if you need to switch between normal and superuser accounts for installing software packages.
Potentially harmful operation
Never modify the access rights for folders in the ROOT/
directory. Modifying permissions for folders such as ROOT/etc/
or ROOT/root/
may cause unrepairable system damage.
This is how to unlock all read and write rights for a directory:
sudo chmod a+rwx /directory
Or for all subdirectories:
sudo chmod a+rwx /directory/*
Or for all files in a directory:
sudo chmod a+rwx /directory/*.*
Or for all sub-directories and files in these directories:
sudo chmod a+rwx /directory/*/*.*
This lifts all restrictions from a directory for all users, all its sub-folders and files contained (and sub-sub-folders and sub-sub-files contained, and so on) – this can be a very harmful irreversible operation when applied to system directories!:
sudo chmod -R 777 /directory/
Python#
tkinter Imports Fail (No Module Named Tkinter)#
tkinter
is sometimes still only installed for Python2 on Linux, while we want to use it with Python3. To ensure that tkinter
for Python3 is installed, install via Terminal:
sudo apt install python3-tk
orsudo apt install python3.X-tk
(replaceX
with your Python version) orsudo apt install tk8.6-dev
to install the library only (this should be sufficient).
If the above comments do not work, make sure that the tkinter
repository is available to your system: sudo add-apt-repository ppa:deadsnakes/ppa
(the repository address may change and depends on your Linux and Python versions).
Wine#
General wine issues#
If wine does not work as desired, remove the current installation via Terminal:
sudo apt remove wine wine32 wine64 libwine libwine:i386 fonts-wine
Then cd
to your Downloads folder, then pull the latest Wine packages, and add the repository to your /etc/apt/sources.list
(the following sequences of commands does all of that - consider to adapt the cd
to your Downloads folder):
cd $HOME/Downloads
sudo apt update
sudo apt -y install gnupg2 software-properties-common
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/debian/
Install wine stable and development (and staging) on Debian 10.x:
wget -O- -q https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/Release.key | sudo apt-key add -
echo "deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10 ./" | sudo tee /etc/apt/sources.list.d/wine-obs.list
sudo apt update
sudo apt install --install-recommends winehq-stable
sudo apt install --install-recommends winehq-devel
sudo apt install winehq-staging
Tip
Add the above commands line-by-line (do not copy-paste entire code blocks).
64-bit Application Not Working#
If a 64-bit msi or other installer / application is not working as desired, try to adapt the WINEPREFIX
for your user (note: this is not an elegant solution):
WINEARCH=win64 WINEPREFIX=/home/YOUR-USER-NAME/.wine64 wineboot -u
QGIS#
GPG error - public key not available (APT UPDATE)#
Occasionally (literally…), the GPG key of the QGIS repositories become invalid, which results in an error when using:
sudo apt update
[...]
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://ubuntugis.qgis.org/ubuntugis focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D155B8E6A419C5BE
W: Failed to fetch https://qgis.org/ubuntugis/dists/focal/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D155B8E6A419C5BE
[...]
To troubleshoot this error, note the unavailable key (i.e., D155B8E6A419C5BE
in the above example) and then update the unavailable key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D155B8E6A419C5BE
To test if the key update worked, tap sudo apt update
No module named OpenGL#
If QGIS throws the error message ModuleNotFoundError: No module named 'OpenGL'
, install Mesa as follows on Ubuntu (i.e., Debian Linux) based operating systems (including Mint and Lubuntu).
Bring apt
and pip
to up-to-date:
sudo apt update
python -m install --upgrade pip
Install the following system packages (if not yet done):
sudo apt install build-essential freeglut3 freeglut3-dev mesa-common-dev binutils-gold libglew-dev libglm-dev python-pyqt5
Install the following Python pip packages:
python -m pip install pyOpenGL
python -m pip install pyOpenGL_accelerate
python -m pip install PyQt5
python -m pip install PyQt5-sip
python -m pip install PyQtWebEngine
A system restart (or just reload the user environment with source ~/.bashsrc
) may be necessary for QGIS to work now without the OpenGL error.
LAStools#
To get LAStools working in QGIS on Ubuntu (make sure to have Windows Apps on Linux installed):
Download the LAStools (ZIP) from http://rapidlasso.com/LAStools and extract the ZIP file
In QGIS, edit the processing options (Providers > Tools for LiDAR data):
LasTools folder: enter here the path to the folder that where the extracted ZIP files live (
/dir/to/LAStools/
)Wine folder: enter the path to the Windows Apps on Linux binary (typically
/usr/bin/
). Alternatively, find where Wine lives with thewhereis wine
command
If required: edit
LidarToolsAlgorithmProvider.py
(two files may exist): line 145: if (True): line 168: if (True): line 188: if (True):
To troubleshoot a LAStools installation in QGIS read this proposition on rapidlasso.com.
Read more about running LAStools on Ubuntu.
3d Graphics Drivers#
GPU intense software requiring strong graphics performance, such as the Unreal Engine, will require newest graphics cards and drivers. The default graphics drivers may not be able to satisfy the needs for such appliances. Latest releases of graphics drivers can be installed through proprietary drivers (e.g., nVidia’s proprietary drivers to replace nouveau drivers).
Here is one option to update nVidia graphic drivers, though be aware that this action can substantially harm your system (it may not reboot) if you are not running an Ubuntu Linux (derivative) with an appropriate nVidia graphics card. So if you are OK with this warning:
Open Terminal
Find the appropriate driver for your system with
sudo apt search nvidia-driver
(OR search for a driver package:apt-cache search nvidia-driver
)Check latest driver releases
in nvidia drivers:
sudo apt-cache search 'nvidia-driver-' | grep '^nvidia-driver-[[:digit:]]*'
in dkms:
sudo apt-cache search 'nvidia-dkms-' | grep '^nvidia-dkms-[[:digit:]]*'
[...]
nvidia-dkms-470 - NVIDIA DKMS package
nvidia-dkms-470-server - NVIDIA DKMS package
nvidia-dkms-495 - Transitional package for nvidia-dkms-510
nvidia-dkms-510 - NVIDIA DKMS package
nvidia-dkms-510-server - NVIDIA DKMS package
nvidia-dkms-515 - NVIDIA DKMS package
nvidia-dkms-515-server - NVIDIA DKMS package
in this example, the newest driver is
nvidia-driver-515
(withnvidia-dkms-515
), which we note down to install them two steps laterUpdate package information and your system:
sudo apt update
sudo apt full-upgrade
Install the latest driver with:
sudo apt install nvidia-driver-515 nvidia-dkms-515
Reboot your system:
sudo shutdown -r now
Verify the installation in Terminal:
nvidia-smi