Upgraded to 1.8.3 and logins stopped working

What is the problem?

After upgrading to 1.8.3 from web ui logins stopped working. Octoprint.log says:

2022-09-21 00:54:30,166 - octoprint - ERROR - Exception on /api/login [POST]
Traceback (most recent call last):
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/flask_limiter/extension.py", line 1145, in __inner
    R, flask.current_app.ensure_sync(cast(Callable[P, R], obj))(*a, **k)
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/octoprint/server/api/__init__.py", line 312, in login
    if octoprint.server.userManager.check_password(username, password):
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/octoprint/access/users.py", line 157, in check_password
    if user.check_password(password):
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/octoprint/access/users.py", line 1173, in check_password
    return passwordhash.verify(password, self._passwordHash)
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/passlib/handlers/argon2.py", line 669, in verify
    cls._stub_requires_backend()
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/passlib/utils/handlers.py", line 2254, in _stub_requires_backend
    cls.set_backend()
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/passlib/utils/handlers.py", line 2176, in set_backend
    raise default_error
passlib.exc.MissingBackendError: argon2: no backends available -- recommend you install one (e.g. 'pip install argon2_cffi')

What did you already try to solve it?

Solved it my downgrading it back to 1.8.2 with ssh console

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No

I assume this is a custom install, rather than OctoPi?

We need more information about your setup to diagnose the problem.

Yes, it was installed by following manually on raspbian stretch. So following "OctoPrint.org - Download & Setup OctoPrint":

  1. Installing Python 3, including pip.
  2. Creating a virtual environment somewhere: python -m venv OctoPrint
  3. Installing OctoPrint into that virtual environment: OctoPrint/bin/pip install OctoPrint

argon2_cffi is listed as a dependency in OctoPrint 1.8.3, so I don't know right now how you managed to update to 1.8.3 without pulling that in.

yes that is mystery to me too, if I go to ssh shell into the venv environment and run pip install from there it says that "Requirement already satisfied: argon2_cffi in ./lib/python3.7/site-packages (21.3.0)", but it looks like octoprint is unable to find it as it says "passlib.exc.MissingBackendError: argon2: no backends available"

And second thing it seem that I also had trouble with remote connections. I have reverse haproxy setup (with added client certificate checking) with couple different dns names for couple of my different octoprint printers, and they also stopped working with wrong password redirect (when local ip accepted the same password). Most likely something to do the CORS or CSRF protection, so for the time beeing I've downgraded all my printers back to 1.8.2 until I figure out how to update haproxy settings to work also. One of my venv octoprint setups were also over Armbian 22.05.3 Jammy distro, and that one also runned into argon2: no backends available error after pressing update from the webui.

I can confirm this issue. After upgrade via the UI i ran into th same error.
I also manually installed the plugin "pip install argon2_cffi"

pi@prusa:~ $ cd OctoPrint/
pi@prusa:~/OctoPrint $ source venv/bin/activate
(venv) pi@prusa:~/OctoPrint $ pip install argon2_cffi
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: argon2_cffi in ./venv/lib/python3.9/site-packages (21.3.0)
Requirement already satisfied: argon2-cffi-bindings in ./venv/lib/python3.9/site-packages (from argon2_cffi) (21.2.0)
Requirement already satisfied: cffi>=1.0.1 in ./venv/lib/python3.9/site-packages (from argon2-cffi-bindings->argon2_cffi) (1.15.1)
Requirement already satisfied: pycparser in ./venv/lib/python3.9/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2_cffi) (2.21)
(venv) pi@prusa:~/OctoPrint $ octoprint user password admin
Password:
Repeat for confirmation:
Traceback (most recent call last):
  File "/home/pi/OctoPrint/venv/bin/octoprint", line 8, in <module>
    sys.exit(main())
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint/__init__.py", line 936, in main
    octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT")
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint/cli/common.py", line 37, in invoke
    return self._impl.invoke(ctx)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint/cli/user.py", line 155, in change_password_command
    ctx.obj.user_manager.change_user_password(username, password)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint/access/users.py", line 788, in change_user_password
    user._passwordHash = UserManager.create_password_hash(password)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/octoprint/access/users.py", line 144, in create_password_hash
    return passwordhash.hash(password)
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/passlib/handlers/argon2.py", line 664, in hash
    cls._stub_requires_backend()
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/passlib/utils/handlers.py", line 2254, in _stub_requires_backend
    cls.set_backend()
  File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/passlib/utils/handlers.py", line 2176, in set_backend
    raise default_error
passlib.exc.MissingBackendError: argon2: no backends available -- recommend you install one (e.g. 'pip install argon2_cffi')
(venv) pi@prusa:~/OctoPrint $

Also a manual install though, right?

Yes. Manual install.

What OS is this and what version? Which Python version, which pip version? What underlying hardware? I'm trying to get a picture here to figure out why this works fine on OctoPi and in my and the team's local testing, but not in now two manual installs. I'm guessing it might be some native library that's missing, or maybe something that cffi requires to do its magic, but currently that's really just blind guessing.

pi@prusa:~/OctoPrint $ source venv/bin/activate
(venv) pi@prusa:~/OctoPrint $ pip -V
pip 22.2.2 from /home/pi/OctoPrint/venv/lib/python3.9/site-packages/pip (python 3.9)
(venv) pi@prusa:~/OctoPrint $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Hardware:
Banana Pi PI BPI-Zero BPI-Zero 512 MB 4 x 1.2GHz

@rainisto The same from you as well please.

pi@raspberrypi:~/OctoPrint source venv/bin/activate (venv) pi@raspberrypi:~/OctoPrint pip -V
pip 22.2.2 from /home/pi/OctoPrint/venv/lib/python3.7/site-packages/pip (python 3.7)
(venv) pi@raspberrypi:~/OctoPrint $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="RaspbianForums - Raspbian"
BUG_REPORT_URL="RaspbianBugs - Raspbian"

uname -a

Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Hardware: Raspberry pi 3b, 1GB ram

And second one is:

jonni@pine64:~/OctoPrint$ source bin/activate
(OctoPrint) jonni@pine64:~/OctoPrint$ pip -V
pip 22.0.2 from /home/jonni/OctoPrint/lib/python3.10/site-packages/pip (python 3.10)
(OctoPrint) jonni@pine64:~/OctoPrint$ cat /etc/os-release
PRETTY_NAME="Armbian 22.05.3 Jammy"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="Data privacy | Ubuntu"
UBUNTU_CODENAME=jammy
(OctoPrint) jonni@pine64:~/OctoPrint$ uname -a
Linux pine64 5.15.48-sunxi64 #22.05.3 SMP Wed Jun 22 07:33:24 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
Hardware: pine64, 1GB RAM

same with me.

(octoprint2) root@Ph-3D-Druck:~# pip -V
pip 22.1.1 from /home/octoprint/python_venvs/octoprint2/lib/python3.8/site-packages/pip (python 3.8)

(octoprint2) root@Ph-3D-Druck:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-poli cy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Would a force reinstall fix it up maybe?

source venv/bin/activate
pip install --force-reinstall --no-cache-dir OctoPrint==1.8.3

No, don't work either. Same Issue.

Can somebody give me a hint how to rollback to 1.8.2. on my ubuntu installation ? I did

source /home/octoprint/python_venvs/octoprint2/bin/activate
pip install https://github.com/foosel/OctoPrint/archive/1.8.2.zip

but afterwards the service do not start

pkg_resources.DistributionNotFound: The 'OctoPrint==1.8.2' distribution was not found and is required by the application

Rollback instructions are here: How do I roll back from 1.8.3+ to a version prior without losing the ability to login?

1 Like

With what guide did you install OctoPrint on Ubuntu?

I used this one and there have been no update issues.

I followed that one:

but one of my 3 octoprint instances are broken now...

If you're using virtual environments (venv), are you sure you installed argon2_cffi into the same virtual environment? What happens if you run Octoprint server via the CLI (octoprint serve -v) instead of the daemon?