# Can not upgrade firmware - missing libcrypto

**URL:** https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566
**Category:** FIDO2 / Nitrokey 3
**Created:** [November 5, 2023, 9:21pm UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566 "2023-11-05T21:21:48Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![3c9fd7e3](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/3/bbe5ce/32.png) [@3c9fd7e3](https://support.nitrokey.com/u/3c9fd7e3)
#### Post date: [November 5, 2023, 9:21pm UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/1 "2023-11-05T21:21:48Z")

</div>

I just tried to update the firmware from my nitrokey 3 C

```auto
nitropy nk3 update --version v1.5.0-test.20231030

```

and get

```auto
Command line tool to interact with Nitrokey devices 0.4.36
Critical error:
An unhandled exception occurred
	Exception encountered: LibraryNotFoundError('Error detecting the version of libcrypto')

--------------------------------------------------------------------------------
Critical error occurred, exiting now
Unexpected? Is this a bug? Would you like to get support/help?
- You can report issues at: https://support.nitrokey.com/
- Writing an e-mail to support@nitrokey.com is also possible
- Please attach the log: '/tmp/user/2000/nitropy.log.djs_vp00' with any support/help request!
- Please check if you have udev rules installed: https://docs.nitrokey.com/nitrokey3/linux/firmware-update.html#troubleshooting

```

I have debian 12. Which package is missing?

```auto
$ dpkg -l|grep libcrypto
ii libcrypto++-dev:amd64 8.7.0+git220824-1 amd64 General purpose cryptographic library - C++ development
ii libcrypto++8:amd64 8.7.0+git220824-1 amd64 General purpose cryptographic library - shared library

```

---

<div class="post-metadata">

### Author: ![nku](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/n/2bfe46/32.png) [@nku](https://support.nitrokey.com/u/nku)
#### Post date: [November 6, 2023, 6:06am UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/2 "2023-11-06T06:06:04Z")

</div>

libssl-dev

---

<div class="post-metadata">

### Author: ![3c9fd7e3](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/3/bbe5ce/32.png) [@3c9fd7e3](https://support.nitrokey.com/u/3c9fd7e3)
#### Post date: [November 6, 2023, 7:39am UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/3 "2023-11-06T07:39:09Z")

</div>

Das ist es leider nicht.  
Denn die habe ich installiert.

```auto
$ dpkg -l|grep libssl
ii libssl-dev:amd64 3.0.11-1~deb12u2 amd64 Secure Sockets Layer toolkit - development files
ii libssl3:amd64 3.0.11-1~deb12u2 amd64 Secure Sockets Layer toolkit - shared libraries

```

---

<div class="post-metadata">

### Author: ![3c9fd7e3](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/3/bbe5ce/32.png) [@3c9fd7e3](https://support.nitrokey.com/u/3c9fd7e3)
#### Post date: [November 6, 2023, 7:45am UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/4 "2023-11-06T07:45:30Z")

</div>

[nitropy.log.zip](https://support.nitrokey.com/uploads/short-url/3FWx4es97nEXWAdMyE2DWEvHHtw.zip) (2.3 KB)

---

<div class="post-metadata">

### Author: ![nku](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/n/2bfe46/32.png) [@nku](https://support.nitrokey.com/u/nku)
#### Post date: [November 6, 2023, 7:03pm UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/5 "2023-11-06T19:03:30Z")

</div>

This is a bummer. Seems like nitrokey is [not supporting python 3.11](https://docs.nitrokey.com/software/nitropy/all-platforms/installation#wrong-python-version) that is shipped with Debian 12 Bookworm.

I could recreate the issue and found a fix by using Nix packages. **Using a VM for firmware update is not recommended!** I have done it many times but this might break anytime.

```auto
vagrant box add debian/bookworm64 --provider virtualbox
cat > Vagrantfile <<"eof"
Vagrant.configure("2") do |config|
  config.vm.box = "debian/bookworm64"
  config.vm.provider "virtualbox" do |vb|
    # We need more compile power
    vb.cpus = 16
    vb.memory = "16384"
    # Nitrokey 3 (20a0:42b2)
    vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "Nitrokey 3", "--vendorid", "20a0", "--productid", "42b2"]
    # Nitrokey 3 Bootloader (20a0:42e8)
    vb.customize ["usbfilter", "add", "1", "--target", :id, "--name", "Nitrokey 3 Bootloader", "--vendorid", "20a0", "--productid", "42e8"]
    # NXP Composite Device (20a0:42dd)
    vb.customize ["usbfilter", "add", "2", "--target", :id, "--name", "NXP Composite Device", "--vendorid", "20a0", "--productid", "42dd"]
    # Enable USB 3
    vb.customize ["modifyvm", :id, "--usbxhci", "on"]
  end
  config.vm.provision "shell", inline: <<-SHELL
    sudo apt update
    sudo apt upgrade -y
  SHELL
end
eof
vagrant up
vagrant ssh
############################################################################################################
# Now on Debian 12 Bookworm
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
sudo apt install -y curl
curl -L https://nixos.org/nix/install | sh
. /home/vagrant/.nix-profile/etc/profile.d/nix.sh
export NIXPKGS_ALLOW_UNFREE=1
nix-shell -p pynitrokey
sudo /nix/store/vqsk5296ivzynfp315iq8bsirg6l6g25-pynitrokey-0.4.40/bin/nitropy nk3 update
############################################################################################################

```

---

<div class="post-metadata">

### Author: ![borden](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@borden](https://support.nitrokey.com/u/borden)
#### Post date: [November 6, 2023, 8:44pm UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/6 "2023-11-06T20:44:37Z")

</div>

I don’t think you’re missing anything. There’s a known bug involving one of the libraries. See if these instructions help you: [pynitrokey is not working with openssl 3.0.10: Error detecting the version of libcrypto · Issue #431 · Nitrokey/pynitrokey · GitHub](https://github.com/Nitrokey/pynitrokey/issues/431)

---

<div class="post-metadata">

### Author: ![3c9fd7e3](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/3/bbe5ce/32.png) [@3c9fd7e3](https://support.nitrokey.com/u/3c9fd7e3)
#### Post date: [November 7, 2023, 7:14am UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/7 "2023-11-07T07:14:27Z")

</div>

i had to create a new python3 venv, install nitropy and oscrypt in it, change the regex in there and then i could update the firmware.

```auto
mkdir venvs/pynitrokey -p
python3 -m venv venvs/pynitrokey/
./venvs/pynitrokey/bin/python ./venvs/pynitrokey/bin/pip install pynitrokey
. venvs/pynitrokey/bin/activate
cd venvs/pynitrokey/
find -name _libcrypto_cffi.py
vi ./lib/python3.11/site-packages/oscrypto/_openssl/_libcrypto_cffi.py
./bin/nitropy nk3 update --version v1.5.0-test.20231030

```

---

<div class="post-metadata">

### Author: ![abc](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/a/2bfe46/32.png) [@abc](https://support.nitrokey.com/u/abc)
#### Post date: [December 15, 2023, 9:25am UTC](https://support.nitrokey.com/t/can-not-upgrade-firmware-missing-libcrypto/5566/8 "2023-12-15T09:25:37Z")

</div>

Perhaps the script will help.  
It works for me.

```auto
#!/bin/bash
#
# Script for "Linux Mint 21.2 Cinnamon" created!
# 

#NitropyVersion="v0.4.43" # Enter current version number
Terminal="gnome-terminal" # adapt if necessary
applications_path="$HOME/.local/share/applications" # adapt if necessary

rm -rf $HOME/.NITROKEY
rm -rf $HOME/.local/share/applications/nitropy.desktop
#sudo rm -rf /bin/nitropy
sudo rm -rf /etc/udev/rules.d/41-nitrokey.rules

mkdir -p $HOME/.NITROKEY/install
cd $HOME/.NITROKEY/install

#wget https://github.com/Nitrokey/pynitrokey/releases/download/$NitropyVersion/nitropy-$NitropyVersion-x64-linux-binary.tar.gz
#tar -xvzf nitropy-$NitropyVersion-x64-linux-binary.tar.gz
#chmod +x nitropy-$NitropyVersion-x64-linux-binary
#sudo cp nitropy-$NitropyVersion-x64-linux-binary /bin/nitropy

wget https://raw.githubusercontent.com/Nitrokey/libnitrokey/master/data/41-nitrokey.rules
sudo mv 41-nitrokey.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

#virtualenv

cd $HOME/.NITROKEY
wget -O 'NITROKEY_LOGO_152x152.png' 'https://www.nitrokey.com/touch-icon-ipad-retina.png'

sudo apt update
sudo apt install python3-venv -y

mkdir -p $HOME/.NITROKEY/venv_nitropy

python3 -m venv $HOME/.NITROKEY/venv_nitropy

$HOME/.NITROKEY/venv_nitropy/bin/python $HOME/.NITROKEY/venv_nitropy/bin/pip install pynitrokey

mkdir -p $HOME/.local/share/applications

echo "[Desktop Entry]
Name=Nitrokey Command-line
Comment=Nitrokey 3
Exec=$Terminal --window --geometry=110x30 -- bash -c 'python3 -m venv --upgrade $HOME/.NITROKEY/venv_nitropy; source $HOME/.NITROKEY/venv_nitropy/bin/activate; nitropy --help ; nitropy list; exec bash'
Icon=$HOME/.NITROKEY/NITROKEY_LOGO_152x152.png
Type=Application
Terminal=true" > $applications_path/nitropy.desktop

chmod +x $applications_path/nitropy.desktop

```
