Does this even work on a Raspberry Zero !?

Used 2 different boards with 2 different Sandisk 16g cards. The pre build SD card image did not work. Attaching to a screen showed some kernel panic messages. I then tried to install from the scripts manually after setting up the card correctly as per instructions. This process goes well until just before the end then I start to get errors that say Illegal instruction. At this point any linux commands given at the ssh prompt give an Illegal instruction error. This is the part of the log where things go wrong:

After this operation, 15.1 MB of additional disk space will be used.
Get:1 bullseye/main armhf libpcre2-8-0 armhf 10.40-1+0~20220713.16+debian11~1.gbpb6cec5 [225 kB]
Get:3 bullseye/main armhf php-common all 2:93+0~20221211.45+debian11~1.gbpdb4dcc [16.4 kB]
Get:4 bullseye/main armhf php8.1-common armhf 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [612 kB]
Get:2 bullseye/main armhf libsodium23 armhf 1.0.18-1 [143 kB]
Get:5 bullseye/main armhf php8.1-opcache armhf 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [58.9 kB]
Get:6 bullseye/main armhf php8.1-readline armhf 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [10.9 kB]
Get:7 bullseye/main armhf php8.1-cli armhf 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [1,403 kB]
Get:8 bullseye/main armhf libapache2-mod-php8.1 armhf 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [1,351 kB]
Get:9 bullseye/main armhf php8.1 all 8.1.15-1+0~20230203.33+debian11~1.gbp878288 [30.8 kB]
Fetched 3,852 kB in 3s (1,391 kB/s)
apt-listchanges: Reading changelogs...
(Reading database ... 47579 files and directories currently installed.)
Preparing to unpack .../libpcre2-8-0_10.40-1+0~20220713.16+debian11~1.gbpb6cec5_armhf.deb ...
Unpacking libpcre2-8-0:armhf (10.40-1+0~20220713.16+debian11~1.gbpb6cec5) over (10.36-2+deb11u1) ...
E: Sub-process /usr/bin/dpkg exited unexpectedly
/opt/openenergymonitor/EmonScripts/install/ line 21:  3798 Illegal instruction     sudo apt-get install -y php8.1-mysql
/opt/openenergymonitor/EmonScripts/install/ line 23:  3799 Illegal instruction     sudo apt-get install -y php8.1-gd php8.1-curl php-pear php8.1-dev php8.1-common php8.1-mbstring
/opt/openenergymonitor/EmonScripts/install/ line 25:  3800 Illegal instruction     sudo pecl channel-update
Redis configuration
/opt/openenergymonitor/EmonScripts/install/ line 7:  3804 Illegal instruction     sudo apt-get install -y redis-server

/opt/openenergymonitor/EmonScripts/install/ line 23:  3805 Illegal instruction     git clone
/opt/openenergymonitor/EmonScripts/install/ line 13: cd: phpredis: No such file or directory
/opt/openenergymonitor/EmonScripts/install/ line 14: phpize: command not found
/opt/openenergymonitor/EmonScripts/install/ line 15: ./configure: No such file or directory

After this operation, 15.1 MB of additional disk space will be used.

Hi and welcome.

What didn’t work?

Did you give the new card a good long while to do the updates? Can you try again and connect it to a monitor?

Pi Zero should work. Not loaded it for a while. I’m not sure I have a Zero around to test.

Mmmm. Looks like something may have changed in the backend packages.

However, this does occasionally happen when apt/dpkg is busy for an unknown reason. Try running the script again.


One of my early attempts to build a new system was on a zero and it failed for me as well. I got very similar output, illegal instructions etc. With the scripts.

I’ve run an old version for several years on a zero and as you know they’re more than capable of running emoncms, so was disappointed when I ran into these problems.

We’ve been DMing about other issues with the scripts. Can someone take a good look at the issues that have surfaced and find a way of ensuring that they work for all types of pi?


For the SD card image test I left it on for about an hour. It appeared dead and I could see on my router that it was not connected to wifi. I plugged it into a monitor but due to the fact of no way to control it I could not scroll the screen. I just saw the kernel panic error where it had stopped. Bothe boards and sd cards did the same.
For the manual install I have tried it about 6 times and always get the same results. It stops and will accept a very limited number of commands…

[email protected]:~ $ ver
-bash: ver: command not found
[email protected]:~ $ emoncms
-bash: emoncms: command not found
[email protected]:~ $ -bash
-bash: -bash: command not found
[email protected]:~ $ ?
-bash: ?: command not found
[email protected]:~ $ whoami
[email protected]:~ $ echo "$SHELL"
[email protected]:~ $ ps -p $$
  PID TTY          TIME CMD
  564 pts/0    00:00:00 bash
[email protected]:~ $ nano
[email protected]:~ $ ls
Illegal instruction
[email protected]:~ $ sudo ls
Illegal instruction
[email protected]:~ $

That looks to me like the initial boot was interrupted before it finished so the partitions have not setup correctly.

Can you try it again and leave it for half an hour (might be more on a zero).

At this stage if I remove the power it does not let me ssh back in. The router shows that it has connected to wifi but I have not been able to find a working web page. Perhaps I dont know what the page url is. I have tried the ip with /emoncms

I watched the entire process via ssh - there is an option where it says you need to reboot - I tried both rebooting and not rebooting - same result

Perhaps partitions are wrong. The problem is that the instructions of setting up the partitions does not seem to be possible from a windows pc. The instructions reference directories that dont exist

Also it is for and older version. So this does not even exist:
2. Open the SD card on your computer and edit the file /usr/lib/raspberrypi-sys-mods/firstboot. Comment out the lines:

# if check_variables; then
  # do_resize
# fi

Re the scripts install. I just tried these commands manually (on a Pi4) and they work fine, but they are slightly different to the commands in the script

sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
sudo apt update
sudo apt-get install -y php8.1-mysql

I need a clean setup to try the current commands manually.

Yes, this is an issue we cannot yet easily resolve.

So what I did was to use windows disk manager to create a 3rd partition before booting. I then booted and the and the original second partition does not expand because it finds a 3rd. Using ssh and did
sudo fdisk /dev/mmcblk0
I deleted the 3rd and 2nd partitions. I then created a new second about 5Gig and a 3rd with the rest of space. This seems to work OK.

1 Like

On an emonSD? After flashing?

That is an interesting idea!

I did manage to get this all working the first time I tried. But I was following these instructions:Installing emoncms on a raspberry pi - Blog | OpenEnergyMonitor

Which are old. The program rand but gave errors because it could not find directories because the partitions were not correct and ran out of space. I will try that again now that I know how to change the partitions. Although I was hoping that the modern method would work

There are some revisions to these docs I did. waiting on @TrystanLea to review.

i have also put in a number of scripting changes as well in the last week or so. Check you are pulling the master repo not the stable one.

I First added third partition using card reader before trying to boot. This causes the latest debian script to not expand the 2nd partition to take up the whole card. Then I boot using the card and use linux fdisk to do the rest

1 Like

I am not much of a linux guru so I just copied and pasted the instructions given here:

Was this on the PIZero?

On Pi Zero W - version1

Ok great. Did it then work? Remember, the updates start when you connect to the Internet for the first time unless you setup Wi-Fi from the initial boot sequence.

With the old instructions. Those instructions dont say anything amount the disk partitions and so on that attempt it ran but there were problems with writing logs etc. I think that the partition did not have enough space. I am about to try it again with a card with the partitions changes. Am doing it as we speak

1 Like

I set the wifi up before first boot

This is what card looks like at first boot:

[email protected]:~ $ df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       5.3G  1.3G  3.8G  26% /
devtmpfs         91M     0   91M   0% /dev
tmpfs           226M     0  226M   0% /dev/shm
tmpfs            91M  943k   90M   2% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk0p1  268M   53M  216M  20% /boot
tmpfs            46M     0   46M   0% /run/user/1000

[edit] - formatting
Use Ctl-E before posting code/bash output etc, please.