[BUG] Empty environment variable PWN_RELEASE
jalxp opened this issue · 7 comments
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Allow auto-update to run.
- Try to connect to web-ui
Expected behavior
web-ui should be available.
Screenshots
N/A
Environment (please complete the following information):
- Pwnagotchi version — v1.8.2
- OS version — Debian 12
- Type of hardware — Raspberry Zero 2 w
Additional context
After having my Pwnagotchi automatically updated to v.1.8.2 I noticed I could no longer access my bt-tether/web ui, so I checked the output of systemctl status pwnagotchi
, which gives me this:
ExecStart=/usr/bin/pwnagotchi-launcher (code=exited, status=1/FAILURE)
I then launched the launcher manually with sudo /usr/bin/pwnagotchi-launcher
, where I got this error:
Traceback (most recent call last):
File "/usr/local/bin/pwnagotchi", line 9, in <module>
import pwnagotchi
File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/__init__.py", line 8, in <module>
from pwnagotchi._version import __version__
File "/usr/local/lib/python3.7/dist-packages/pwnagotchi/_version.py", line 3, in <module>
__version__ = os.environ["PWN_RELEASE"]
File "/usr/lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'PWN_RELEASE'
Not sure where PWN_RELEASE
environment variable should be defined, but echo $PWN_RELEASE
was empty.
As a quick workaround, I've hardcoded the version number on the _version.py
file, and all is good.
We never actually define the os.environ["PWN_VERSION"] = 1.8.2
anywhere. I also noticed that the regex only worked because it was actually finding a match in the commented line of the old version of _version.py file, not sure if this was expected or not.
I.e.
05fef28 made the changes in 1db620d stop working since the comment was gone so no match on the regex expression anymore.
Ah I made changes to enable the GitHub action to fully compile the image using just the input variable versus having to update _version.py to match the action input variable. That automated the build and release. I didn't consider that this would cause a problem at run-time where 1.8.2 isn't actually defined anywhere.
Thank you for the helpful bug report and for digging into the problem. I'll fix this and release 1.8.3.
It's a pleasure to help in the project, I already noticed I said something wrong tho! Because I confused the PWN_VERSION
& PWN_RELEASE
variables with each other. The Makefile change is also broken because of the removal of the comment in the _version.py file it seems.
Either way, I'm glad to help!
Hi,
Just went through the same issue... Took a while to land here and another while to understand how to fix it.
For those as dumb as I, here is the step by step instruction:
- ssh pi@10.0.0.2 -> password is "raspberry"
- cd /usr/local/lib/python3.7/dist-packages/pwnagotchi
- sudo nano _version.p
- edit the version line to be: version = "1.8.2"
- CTRL+X
- YES
- ENTER --> file is now saved
- sudo reboot now
- wait 1 minute or so
- ssh pi@10.0.0.2, enter password
- sudo reboot now
- wait 1 minute or so
--> open browser: 10.0.0.2:8080
Enjoy!
Thanks a lot for this fork!
Just in case someone sees this, there are a few mistakes in bicurico's instructions above. I have fixed them down here (all credit to him though, that fixed mine)
- ssh pi@10.0.0.2 -> password is "raspberry"
- cd /usr/local/lib/python3.7/dist-packages/pwnagotchi
- sudo nano _version.py
- edit the version line to be:
__version__ = "1.8.2"
- CTRL+X
- YES
- ENTER --> file is now saved
- sudo reboot now
- wait 1 minute or so
- ssh pi@10.0.0.2, enter password
- sudo reboot now
- wait 1 minute or so
--> open browser: 10.0.0.2:8080
Fixed in release v1.8.3