Does this even work on a Raspberry Zero !?

This probably needs merging as well for a robust system.

1 Like

Thanks, merged!

1 Like

I have just pushed new docs re making the data partition.

Just ran the stable install, and it installs fine on an ARMv6 platform. Not tested it on an ARMv7, but hopefully that will be fine.

[edit]

  1. Donā€™t install the Wi-Fi module - configure Wi-Fi when flashing image.
  2. Do reboot at the end.

@borpin

Brian, when I run the instructions, something odd happens. When I run df -h, it reports the rootfs partition as being only as big as it was before making the new partition etc. But lsblk shows it being the size I was expecting. I did change 20 to 12 in the instruction to make the 3rd partition but thatā€™s the only change. This is on a 32G microSD.

See below.

Then when I run the script, it complains that there isnā€™t enough room in /var/cache/apt/archives/, so presumably based n what df -h is reporting?

Hereā€™s the console output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.5G  1.2G  153M  89% /
devtmpfs         87M     0   87M   0% /dev
tmpfs           215M     0  215M   0% /dev/shm
tmpfs            86M  988K   85M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            30M     0   30M   0% /tmp
tmpfs           1.0M     0  1.0M   0% /var/lib/php/sessions
tmpfs           1.0M     0  1.0M   0% /var/tmp
/dev/mmcblk0p1  255M   50M  206M  20% /boot
/dev/mmcblk0p3   18G   14K   17G   1% /var/opt/emoncms
tmpfs            43M     0   43M   0% /run/user/1000
pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 29.7G  0 disk
ā”œā”€mmcblk0p1 179:1    0  256M  0 part /boot
ā”œā”€mmcblk0p2 179:2    0 11.7G  0 part /
ā””ā”€mmcblk0p3 179:3    0 17.7G  0 part /var/opt/emoncms
pi@raspberrypi:~ $ blkid
pi@raspberrypi:~ $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="AE82-4BC1" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="c45f02f6-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6d2ff93e-eacd-415c-96d5-4611ad21e05f" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c45f02f6-02"
/dev/mmcblk0p3: UUID="a6442646-7702-45b0-906c-88d91bef8778" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="c45f02f6-03"

And hereā€™s the output from the install

After this operation, 72.9 MB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.

Have you rebooted?

Did you definitely run sudo resize2fs /dev/mmcblk0p2?

pi@emonpi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        14G  2.0G   11G  16% /
devtmpfs         87M     0   87M   0% /dev
tmpfs           215M     0  215M   0% /dev/shm
tmpfs            86M  9.6M   77M  12% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            30M     0   30M   0% /tmp
tmpfs           1.0M     0  1.0M   0% /var/lib/php/sessions
tmpfs           1.0M     0  1.0M   0% /var/tmp
/dev/mmcblk0p3  479M   19K  454M   1% /var/opt/emoncms
/dev/mmcblk0p1  255M   50M  206M  20% /boot
log2ram          50M  2.0M   49M   4% /var/log
tmpfs            43M     0   43M   0% /run/user/1000

Damn!! No!! Grrrrrrā€¦ Apologies for troubling you, I must have done this 20 times over the last few days - obviously getting instruction blindā€¦

Apologies again.

Simon

Edit PS - probably need a script for this as well.

No bother - we have all been there! Partly itā€™s understanding what each bit does.

Yes, possibly. Not tried scripting it yet :frowning:.

Unfortunately the microSD now looks as though it is bricked :frowning:

Re-installing raspbian fails the verify and when I put the card back in the windows PC, I canā€™t do anything to the partitions. 2nd one this year while Iā€™ve been messing around.

So maybe we do need a script to make sure that the instructions are followed - you can rely on idiots like me to idiot proof instructions!!

Simon

Try and clear the disk of all partitions before writing in Windows?

Never had one go bad on me like that.

Use this:

instead of the Windows native formatting tool.

Windows doesnā€™t always format flash media correctly. i.e. the partition start location may
be such that writes to flash memory end up getting done twice, which shortens the media life considerably.

The SD card formatter creates partitions that start in the correct location, thus avoiding that issue.

1 Like

Thanks Bill but Iā€™ve tried that and several 3rd party tools - non of them work.

The official tool you point to says it does a quick format - but it doesnā€™t. The full format bombs out saying formatting failed after a few seconds. Basically whatever you try, you canā€™t get rid of the partitions, Iā€™ve tried on Windows and on Raspbian.

Interestingly if you look at the SanDisk warranty page the High Endurance cards have about the lowest warranty period - 2 years - some Ultra cards are warranted for a lot longer, 5 or 10 years and the Extreme have a lifetime warranty ā†’ Warranty Table

Iā€™ve applied for a replacement under the scheme - weā€™ll see what happens.

Simon

1 Like

Thanks for posting about the warranty. Good/useful info!

Have you tried dd if=/dev/zero of=/dev/mmcblk0 bs=4k ?

Didnā€™t work Bill, thanks though for the idea.

I seem to remember reading somewhere that when microSDs are no longer functional, a flag is set and whatever you do, nothing works. Itā€™s weird that for example in Gparted, you can delete a partition, it doesnā€™t report any errors, the partition changes to unallocated on the display and then almost immediately changes back to showing the partition again.

Anyway, hopefully SanDisk will replace it.

Simon

Correct.

Essentially, they go into read only mode.

1 Like

Thatā€™s really useful info Bill, thanks.

Iā€™ve got 2 or 3 Micro SDs which say theyā€™re write-protected and Iā€™ve tried a number of platforms to read/format them but none work. I know why now :+1:

1 Like

Brain hi, new microSD :smiley: and done the install. DHCP failed to run on a reboot, so itā€™s nto working for me.

Like before, I noticed a number of errors and warnings, as follows:

Thereā€™s about 20 warnings like this

Processing triggers for php8.0-cli (8.0.1-1) ...

Warning: foreach() argument must be of type array|object, null given in Command.php on line 249
PHP Warning:  foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249

Warning: foreach() argument must be of type array|object, null given in Command.php on line 249
PHP Warning:  foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249

and the same of some other modules.

Then about 20 of these:

Warning: foreach() argument must be of type array|object, null given in PEAR/Command.php on line 249
PHP Warning:  foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249

Warning: foreach() argument must be of type array|object, null given in PEAR/Command.php on line 249
PHP Warning:  foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249


Then this:

libtool: compile:  cc -I. -I/opt/openenergymonitor/EmonScripts/install/phpredis -I/opt/openenergymonitor/EmonScripts/install/phpredis/include -I/opt/openenergymonitor/EmonScripts/install/phpredis/main -I/opt/openenergymonitor/EmonScripts/install/phpredis -I/usr/include/php/20200930 -I/usr/include/php/20200930/main -I/usr/include/php/20200930/TSRM -I/usr/include/php/20200930/Zend -I/usr/include/php/20200930/ext -I/usr/include/php/20200930/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/php/20200930/ext -DHAVE_CONFIG_H -g -O2 -c /opt/openenergymonitor/EmonScripts/install/phpredis/library.c  -fPIC -DPIC -o .libs/library.o
In file included from /opt/openenergymonitor/EmonScripts/install/phpredis/common.h:13,
                 from /opt/openenergymonitor/EmonScripts/install/phpredis/php_redis.h:20,
                 from /opt/openenergymonitor/EmonScripts/install/phpredis/library.c:1:
In function ā€˜smart_str_appendl_exā€™,
    inlined from ā€˜redis_hash_authā€™ at /opt/openenergymonitor/EmonScripts/install/phpredis/library.c:830:5,
    inlined from ā€˜append_auth_hashā€™ at /opt/openenergymonitor/EmonScripts/install/phpredis/library.c:858:14:
/usr/include/php/20200930/Zend/zend_smart_str.h:119:2: warning: writing 65 bytes into a region of size 1 [-Wstringop-overflow=]
  119 |  memcpy(ZSTR_VAL(dest->s) + ZSTR_LEN(dest->s), str, len);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then this one:

Installing collected packages: pyserial-asyncio, pymodbus, sdm-modbus, pybluez, py-sds011, paho-mqtt, minimalmodbus
  WARNING: The scripts pymodbus.console, pymodbus.server and pymodbus.simulator are installed in '/home/pi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed minimalmodbus-2.0.1 paho-mqtt-1.6.1 py-sds011-0.9 pybluez-0.23 pymodbus-3.1.3 pyserial-asyncio-0.6 sdm-modbus-0.6.1

Then these:

Created symlink /etc/systemd/system/[email protected] ā†’ /dev/null.
Creating /etc/emonhub directory
chown: cannot access '/var/log/emonhub': No such file or directory
No existing emonhub.conf configuration file found, installing default
emonhub.conf permissions adjusted to 666
sed: couldn't open temporary file /etc/emonhub/sedBRMDxd: Permission denied
Default emonhub.conf log level set to WARNING
Installing /usr/local/bin/emonhub symlink
Installing emonhub.service in /lib/systemd/system (creating symlink)
Created symlink /etc/systemd/system/multi-user.target.wants/emonhub.service ā†’ /opt/openenergymonitor/emonhub/service/emonhub.service.
Created symlink /etc/systemd/system/emonhub.service ā†’ /opt/openenergymonitor/emonhub/service/emonhub.service.
Failed to restart emonhub.service: Unit var-log.mount not found.
Failed to restart emonhub.service: Unit var-log.mount not found.

Then this lot:

Setting up hostapd (2:2.9.0-21) ...
Created symlink /etc/systemd/system/multi-user.target.wants/hostapd.service ā†’ /lib/systemd/system/hostapd.service.
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
Created symlink /etc/systemd/system/hostapd.service ā†’ /dev/null.
Setting up libisccfg-export163 (1:9.11.19+dfsg-2.1) ...
Setting up libirs-export161 (1:9.11.19+dfsg-2.1) ...
Setting up isc-dhcp-server (4.4.1-2.3+deb11u1) ...
Generating /etc/default/isc-dhcp-server...
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
ā— isc-dhcp-server.service - LSB: DHCP server
     Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
     Active: failed (Result: exit-code) since Sat 2023-02-18 08:46:03 GMT; 232ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 25100 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
        CPU: 360ms

Feb 18 08:46:01 raspberrypi dhcpd[25115]: before submitting a bug.  These pages explain the proper
Feb 18 08:46:01 raspberrypi dhcpd[25115]: process and the information we find helpful for debugging.
Feb 18 08:46:01 raspberrypi dhcpd[25115]:
Feb 18 08:46:01 raspberrypi dhcpd[25115]: exiting.
Feb 18 08:46:03 raspberrypi isc-dhcp-server[25100]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ...
Feb 18 08:46:03 raspberrypi isc-dhcp-server[25120]:  failed!
Feb 18 08:46:03 raspberrypi isc-dhcp-server[25121]:  failed!
Feb 18 08:46:03 raspberrypi systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Feb 18 08:46:03 raspberrypi systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Feb 18 08:46:04 raspberrypi systemd[1]: Failed to start LSB: DHCP server.

On a reboot, the DHCP server fails to start and the console output reports that there is no internet and of course I canā€™t log in via SSH.

This is on a PiZ W V1.3 with a brand new 32G microSD card. I didnā€™t edit the scripts and replied n to the reboot question. The only thing I did which Iā€™m sure wouldnā€™t have made a difference is that I did the update, upgrade before running the scripts.

Simon

I think I said elsewhere that I was not installing the Wi-Fi module as it broke the install. Itā€™s configured by initial OS flash for me. Perhaps raise an issue on the Wi-Fi app for @TrystanLea or @glyn.hudson to look at. Iā€™ve no idea what this does or why.

All the other errors (well warnings actually), yes, but it still works!

Just reboot and it is fine.

It is to do with var-log.mount running order. I couldnā€™t get a systemctl set of commands to get it to start.

Hi Brain, missed that one about the wifi module. One more goā€¦

On another point, Iā€™ve always thought that the script would be better in 2 parts. A two step process.

Firstly a script to load PHP etc. So the environment emoncms needs.

Then a script that can be edited with things like the lcd module, the wifi module, the rfm module etc. This could have some text to explain what each of them does, so that itā€™s clear which ones can be commented out. This would prevent someone doing what I did and would also be more user friendly in terms of what can missed out and why.

I guess it wouldnā€™t take a lot to split this out and write something in the instructions?

Simon