Page 1 of 1

Building NCPA on Amazon Linux / arm64

Posted: Tue Jul 08, 2025 12:58 pm
by ChristopherSchultz
I'm looking at migrating some of my AWS EC2 instances to use Graviton (arm64) instance types. Since NCPA is only available via RPM repo in x86-64, I'm trying to build from scratch.

This is specifically on Amazon Linux 2023.

I've installed all of the prerequisites manually:

$ sudo yum install python3.11 python3.11-pip gcc gcc-c++ zlib zlib-devel openssl openssl-devel sqlite sqlite3-devel libffi-devel
$ sudo pip3.11 install cx_Freeze jinja2.ext idna gevent psutil
$ git https://github.com/NagiosEnterprises/ncpa
$ cd ncpa/build
$ ./build.sh -S -b

creating directory /home/ec2-user/ncpa/agent/build/exe.linux-aarch64-3.11
error: [Errno 13] Permission denied: '/home/ec2-user/ncpa/agent/build/exe.linux-aarch64-3.11'

Set up packaging dirs...
cp: cannot stat '/home/ec2-user/ncpa/agent/build/exe.*': No such file or directory

Sigh, okay, let's try "sudo build" which really should never be necessary, but I see "sudo" everywhere in the script, so...

$ sudo ./build.sh -S -b
...
...
Set up packaging dirs...
33027e5fa9284a1e60cc0e3470925faa5349fbfb

Building tarball...
***** Build tarball
ncpa-3.1.3/
...
ncpa-3.1.3/build_resources/default-plist
ncpa-3.1.3/build_resources/default-init

Cool, looks like it built. Let's try to run it.

$ cd ncpa
$ ./ncpa
Traceback (most recent call last):
File "__startup__.py", line 121, in run
File "console.py", line 25, in run
File "ncpa.py", line 43, in <module>
ModuleNotFoundError: No module named 'geventwebsocket'

I had this error before when I was manually-installing all of the Python modules via pip3.11. (It would be nice if the required modules were documented somewhere.) In order to get ncpa to not fail with an unsatisfied module "psutil", I had to do a completely clean build and then re-build after installing it. Simply installing it wasn't enough: it had to have been installed when the build was done.

But there is no pip module called "geventwebsocket". Instead, it's called "gevent-websocket".

I played this game for a while before I realized that resources/require.txt existed. :facepalm:

So:
$ sudo pip3.11 install -r resources/require.txt

Re-build, etc.

$ ./ncpa/ncpa
***** Starting NCPA version: 3.1.3
***** Starting NCPA version: 3.1.3
Traceback (most recent call last):
File "__startup__.py", line 124, in run
File "console.py", line 17, in run
File "ncpa.py", line 1242, in <module>
File "ncpa.py", line 1184, in main
File "ncpa.py", line 1066, in setup_logger
File "logging/handlers.py", line 155, in __init__
File "logging/handlers.py", line 58, in __init__
File "logging/__init__.py", line 1181, in __init__
File "logging/__init__.py", line 1213, in _open
PermissionError: [Errno 13] Permission denied: '/home/ec2-user/ncpa/build/ncpa/var/log/ncpa_listener.log'

This gets back to the "building as root" issue, which makes me feel icky. Without fixing all the permissions, you have to run ncpa as root :(

What's the justification for performing so many build steps using the root user?

I have tried to modify the script to remove the reliance on root privileges, but something is causing the script to stop early and I haven't discovered the cause, yet.

Re: Building NCPA on Amazon Linux / arm64

Posted: Mon Feb 23, 2026 12:10 pm
by mosinjack
You’re hitting permission issues because you built with sudo, which made parts of the directory root-owned. Fix it with sudo chown -R ec2-user:ec2-user ~/ncpa, then rebuild and run without sudo after installing dependencies from resources/require.txt. The script uses root mainly for packaging (RPM-style installs), not because NCPA itself requires it — for arm64 tarball builds, staying non-root is cleaner and avoids the logging permission errors.