VenusOS on RPi, How to install additional 'stuff'?

I’m running VenusOS on an old RPi2B and want to install a PiJuice UPS on it. There is no apt-get function that I can see so is there an alternate method to install a 3rd party package on my Venus RPi?

The package manager on Venus-OS is opkg. Which is a wrapper around ipkg which is a minimal version of debian’s dpkg. You can only install packages that are in the upstream repo, which in itself only contains the most commonly used things. The repos are defined in /etc/opkg, you will for example see a venus.conf file in there.

You can access such available packages with opkg, eg to install python3 support you’d do:

opkg update
opkg install python3-modules

The package you mentioned is almost certainly not there. So you will have to manually install it the old way. Which could be quite extensive. For example, I note it has a hardware watchdog… that might require recompiling a kernel, which is not for the faint of heart.

Doh! :man_facepalming: I don’t want to delve that deep into the VenusOS to get a small UPS going. I hope the default behavior will be to shut the RPi down once the battery runs low in which case I don’t need the install files. I’ll have to test it obviously.

Just a quick update. Doing an opkg update I see the native search is directed to the ‘zeus’ directory as per below:

Downloading https://updates.victronenergy.com/feeds/venus/release/packages/zeus/all/Packages.gz.
Downloading https://updates.victronenergy.com/feeds/venus/release/packages/zeus/cortexa7hf-neon-vfpv4/Packages.gz.
Downloading https://updates.victronenergy.com/feeds/venus/release/packages/zeus/raspberrypi2/Packages.gz.

Nowhere in this repository can I find python3, which the PiJuice is based on. I did however find it under Candidate and Cortexa7hf but none under raspberrypi2.

Any suggestions how I can get python3 loaded just to see if some of the scripts will work? I am running VenusOS 2.70~5 Large 18 to test some Node-Red stuff for future implementation on my actual VenusGX.

Well, first you need to switch feeds. The zeus feed is not in release yet. So you do:

/opt/victronenergy/swupdate-scripts/set-feed.sh candidate
opkg update

That changes the urls to point to the candidate package feeds, and that will help opkg find the packages.

After that, you can install python3-modules as indicated. That brings in almost a full python3 installation.

1 Like

Thanks @plonkster It installed perfectly. Now to start fiddling to see if I can get some kind of management going with the PiJuice CLI.

I think I am stuck where the I need the python3-urwid package on my Venus RPi2 but it does not exist in the repository. When trying a manual install it complains about architecture - armhf not supported even thou it installs fine on my stock RPi4. This might be it for me so I now rely just on the small battery to keep my Pi going (UPS) if the main supply is interrupted. No graceful shutdown unfortunately.

mmmh interesting. You should be able to compile it from source, I would expect. I see urwid has a native component, which probably explains the complaint about armhf. You will probably need a C compiler if you want to install it using setup.py.

I see it also has support for a number of other libraries, eg you could try also installing python3-pygobject and probably also the -dev package to give you geventloop capability.

Also, maybe someone has made a OpenEmbedded recipe for urwid. You can also look in the Yocto Project for a recipe (which is another distro building on top of OE). But by this point, it gets pretty technical… you are about one step away from setting up your own Venus build tree just so you have a platform to build the stuff you are missing :slight_smile:

1 Like

Thanks for the info but this is out of my league. I’ve got a better chance of winning the lotto than making urwid install and workable on my VenusRPi.

Ok, ok. I said I wasn’t going to fiddle anymore, but i did. I got the urwid package to load just to hit the next hurdle. Inside the pijuice.py file they import a few smbus stuff and you guessed it, it’s not available.

Trying to manually load the smbus library gives me a strange format error.

  • open_outer: Failed to open package ‘smbus.cpython-37m-arm-linux-gnueabihf.so’: Unrecognized archive format
  • open_outer: Failed to open package ‘smbus.cpython-37m-arm-linux-gnueabihf.so’: Unrecognized archive format
  • pkg_extract_control_file_to_stream: Failed to extract control.tar.* from package ‘smbus.cpython-37m-arm-linux-gnueabihf.so’.
  • pkg_init_from_file: Failed to extract control file from smbus.cpython-37m-arm-linux-gnueabihf.so.

What I’ve also done is to load it on my RPi4 and configured my unit as per all the required settings and then plugged it back on the RPi2. The RPi2, with VenusOS, doesn’t shut the system down on power interruptions, or have any of the enhancements, but at least it’s a small UPS so the PI can be manually shut IF I disconnect main power without shutting it down first. The goal is to prevent any flash card corruption and provide a clean power down. Natively on the RPi4 it works like a charm - nice little UPS but expensive.

*and I realized it’s not a package but a library but it’s still not loading.

I was about to say that. .so is a shared object, like a DLL in windows.

You can sometimes run ldd on it to see what it is trying to link to. Eg:

# ldd /usr/lib/libglib-2.0.so.0.6000.7 
	linux-vdso.so.1 (0xbeb0b000)
	libpcre.so.1 => /usr/lib/libpcre.so.1 (0x47110000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x47030000)
	libc.so.6 => /lib/libc.so.6 (0x46ee0000)
	/lib/ld-linux-armhf.so.3 (0xb6f4c000)

And then if anything is not found, it will show not found. Except when it is linked with the completely wrong libc, then it cannot even load ld.so properly and you just get a generic format error. Usually all of this means that library needs to be compiled specifically for this system, but in a few lucky cases, you may just be missing something that can be installed with opkg.

Ok, ldd luckily shows no errors. One question: Where should these modules reside in the VenusOS implementation? Or is there something I need to ‘tell’ the OS where to find this shared object?

root@raspberrypi2:/usr/lib/python3.7/site-packages# ldd smbus.cpython-37m-arm-linux-gnueabihf.so 
        linux-vdso.so.1 (0x7ec95000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x76f1f000)
        libc.so.6 => /lib/libc.so.6 (0x76ddd000)
        /lib/ld-linux-armhf.so.3 (0x76f5d000)
root@raspberrypi2:/usr/lib/python3.7/site-packages#

A command line python3 action doesn’t find it.

>>> from smbus import SMBus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'smbus'
>>> 

Maybe it can be modified to use smbus2?

Ok, with smbus2 it runs the text interface albeit a bit screwy but I think this is as far as it’s going to go. Once I select one of the options it crashes so I think the i2c stuff is causing this. Reading the author comments it looks like a service runs on the RPi that interacts with the pijuice MCU and I think because the proper installer didn’t work there are ‘housekeeping and i2c stuff’ that is not working causing the crashes in the main loop.

Thanks for all the help.