NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
176 stars 94 forks source link

Raspberry Pi Bookworm - Fatal Python error: init_fs_encoding #1177

Closed aluminum-ice closed 1 week ago

aluminum-ice commented 3 months ago

I compiled ncpa from source into a debian package. No issues with the compilation. Installed the deb pacakge ncpa_3.1.0-1_arm64.deb without issue:

pi@raspberrypi:~/github/ncpa/build $ sudo dpkg -i ./ncpa_3.1.0-1_arm64.deb

Selecting previously unselected package ncpa.
(Reading database ... 124238 files and directories currently installed.)
Preparing to unpack ./ncpa_3.1.0-1_arm64.deb ...
Try to stop services with systemctl
Try to stop services with service
Unpacking ncpa (3.1.0-1) ...
Setting up ncpa (3.1.0-1) ...
Processing triggers for libc-bin (2.36-9+rpt2+deb12u7) ...

Every attempt to start, stop or restart the ncpa service results in a python error:

pi@raspberrypi:~/github/ncpa/build $ sudo /etc/init.d/ncpa start

Started NCPA
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/local/ncpa/ncpa'
  isolated = 0
  environment = 0
  user site = 1
  safe_path = 0
  import site = 0
  is in build tree = 0
  stdlib dir = ''
  sys._base_executable = '/usr/local/ncpa/ncpa'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.platlibdir = 'lib'
  sys.executable = '/usr/local/ncpa/ncpa'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    '/usr/local/ncpa/lib',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fffb953cb00 (most recent call first):
  <no Python frame>

I think the issue is with the (new) managed python package environment but every attempt to fix it fails. Any help or ideas?

MrPippin66 commented 3 months ago

Which specific python do you have? Primary issue above is the PYTHONHOME isn't defined. Could be a "cx freeze" issue, though. Which specific cx freeze version is installed?

aluminum-ice commented 2 months ago

Hi, this is what I see:

cx_freeze in /usr/local/lib/python3.11/site-packages (7.1.1)

I tried export PYTHONHOME=/usr/local/ but NCPA still reports the env variable as blank.