nRF Command Line Tools fails to install on new Ubuntu 20.04 system

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.

  • We have different behaviour. I can't say if it's due to Ubuntu vs. Debian or apt vs. dpkg. On my system, trying to install with dpkg, after the failure the /opt and /usr/local/bin folders are cleaned (unless nothing get extracted, I don't know) so I can't just ignore the error. That leaded me to manually rebuild the package with a correct(?) postinst.

    I wonder too if the bad packaging of the command line tools and the errors in VSCode are related, but I'm totally new in VSCode and in the Nordic world.

  • Likewise, V.Besse.  Thanks for your feedback and insight.  I too am totally new to VSCode.  It's become urgent for us to decide now whether we really want to continue after spending days spread over weeks trying to install a tool chain that works - both management and I are very displeased - they don't want to wait any time for fixes to what is supposedly an officially supported system and we may have to move away from Nordic for our next generation design.

    In a final act of desperation I now need to scrape the barrel and get a Windows machine up and running to see if even that works, but why should we have to stoop so low?

    Hope the next version works for us.  Not sure if we can still be developing on the Nordic platform though.

  • Hi, 

    The 10.17.2 update is now available on the website. This should fix the installation issues on Ubuntu. 

    www.nordicsemi.com/.../download

  • Thanks for getting that fix released quickly for all of us.  I especially appreciate it of all our team.  Unfortunately I can't test the Ubuntu version just now as we've abandoned Ubuntu and switched to Windows to have something demonstrated to our team, installing 10.17.0 in Windows 10, and got blinky working with it this morning.  The Nordic Windows experience was really smooth however given the choice I would rather be using Ubuntu/Linux where possible.  Might go back to Ubuntu at a later time to try it.  Seems we're happier keeping the nRF chipset in our spec then.

Related