Trying to get the entire set of v2.0.0 software development tools to install on our Ubuntu 20.04.4 LTS x86_64 system for my nRF9160-DK.
Following the [DevAcademy nRF Connect SDK Fundamentals course](https://academy.nordicsemi.com/topic/exercise-1-1/), the very first task in the very first exercise instructs to install the [nRF Command Line Tools](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools). The illustration in the course only demonstrates how to click the icon in Windows but not for Ubuntu. This failed for me when installing the Ubuntu .deb package:
```
$ sudo apt install ./Downloads/nrf-command-line-tools_10.17.0_amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'nrf-command-line-tools' instead of './Downloads/nrf-command-line-tools_10.17.0_amd64.deb'
nrf-command-line-tools is already the newest version (10.17.0).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up nrf-command-line-tools (10.17.0) ...
dpkg: error: dpkg database lock is locked by another process
dpkg: error processing package nrf-command-line-tools (--configure):
installed nrf-command-line-tools package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
nrf-command-line-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
$
```
Tried also clicking the .deb file in the graphical file manager with similar result.
I noticed the error mentions the post-installation script, but does not specify the line it failed on. The `postinst` file contained within the .deb archive is as follows:
```
#!/usr/bin/env bash
echo /opt/nrf-command-line-tools/lib > /etc/ld.so.conf.d/nrftools.conf
echo /opt/nrf-command-line-tools/bin >> /etc/ld.so.conf.d/nrftools.conf
echo /opt/nrf-command-line-tools/lib > /etc/ld.so.conf.d/nrfjprog.conf
echo /opt/nrf-command-line-tools/bin >> /etc/ld.so.conf.d/nrfjprog.conf
ln -sf "/opt/nrf-command-line-tools/bin/nrfjprog" "/usr/local/bin"
ln -sf "/opt/nrf-command-line-tools/bin/mergehex" "/usr/local/bin"
if command -v rpm &> /dev/null
then
rpm --upgrade /opt/nrf-command-line-tools/share/segger/*.rpm
exit
fi
if command -v dpkg &> /dev/null
then
dpkg --install /opt/nrf-command-line-tools/share/segger/*.deb
exit
fi
fi
if command -v rpm &> /dev/null
then
rpm --upgrade /opt/nrf-command-line-tools/share/segger/*.rpm
exit
fi
if command -v dpkg &> /dev/null
then
dpkg --install /opt/nrf-command-line-tools/share/segger/*.deb
exit
fi
```
with a suspicious extra `fi` statement. Moreover, I could not see a `segger` directory:
```
$ ls -l /opt/nrf-command-line-tools/share/
total 24
-rw-r--r-- 1 root root 5370 Jul 22 16:46 config.toml
drwxr-xr-x 2 root root 4096 Aug 2 16:39 firmware
drwxr-xr-x 2 root root 4096 Aug 2 16:39 NRFCommandLineTools
-rw-r--r-- 1 root root 753 Jul 21 10:03 nrfjprog.ini
-rw-r--r-- 1 root root 3052 Jul 21 10:03 QspiDefault.ini
$
```
So my guess is either the Ubuntu .deb package is simply broken, incomplete, the guide is missing a step or it's failing on the extra `fi` statement.
Not sure though. Any help to get past this stage would be appreciated.