nextcloud / nextcloudpi

📦 Build code for NextcloudPi: Raspberry Pi, Odroid, Rock64, curl installer...
https://nextcloudpi.com
2.52k stars 295 forks source link

PHP7.2 binaries included by nextcloudpi do not support ARMv6 cpus #745

Closed Rode-Ven closed 5 years ago

Rode-Ven commented 5 years ago

I have tried to tinker with nextcloudpi on a Raspberry Pi Zero W, without successs. I did download the image from https://ownyourbits.com/downloads/NextCloudPi_RPi_11-22-18/ flashed that onto an SD card and then copied 2 required files ssh (to enable ssh on the Zero) and wpa_supplicant.conf (to link the Zero into my network) onto it.

Upon starting the Zero with the thus prepared SD card, I can ssh into it alright. However, accessing http://nextcloudpi via browser results in an error ERR_CONNECTION_REFUSED. I figured that I had to enable the WebUI first via ncp-config on the Zero. Afterwards, http://nextcloudpi brought up a login prompt that I filled with the standard credentials (ncp, ownyourbits). On submit, the browser presents the following message:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.

Several hours, attempts and SD card rewrites later, I came up with the following possible explanation: Apache was complaining that one of its mods wasn't operating and it needed a restart. Doing so resulted in an error blaming php-fpm7.2 for not being started.

systemctl status php7.2-fpm.service produced the following output:

● php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled) Active: failed (Result: signal) since Sat 2018-12-15 17:33:29 GMT; 10min ago Docs: man:php-fpm7.2(8) Process: 1125 ExecStart=/usr/sbin/php-fpm7.2 --nodaemonize --fpm-config /etc/php/7.2/fpm/php-fpm.conf (code= Main PID: 1125 (code=killed, signal=ILL)

Dec 15 17:33:29 nextcloudpi systemd[1]: Starting The PHP 7.2 FastCGI Process Manager... Dec 15 17:33:29 nextcloudpi systemd[1]: php7.2-fpm.service: Main process exited, code=killed, status=4/ILL Dec 15 17:33:29 nextcloudpi systemd[1]: Failed to start The PHP 7.2 FastCGI Process Manager. Dec 15 17:33:29 nextcloudpi systemd[1]: php7.2-fpm.service: Unit entered failed state. Dec 15 17:33:29 nextcloudpi systemd[1]: php7.2-fpm.service: Failed with result 'signal'.

Trying to run the offending command manually resulted in:

pi@nextcloudpi:~ $ sudo /usr/sbin/php-fpm7.2 --nodaemonize --fpm-config /etc/php/7.2/fpm/php-fpm.conf

Illegal instruction

I then checked the binary for its target architecture: pi@nextcloudpi:~ $ readelf -A /usr/sbin/php-fpm7.2 | egrep -i 'cpu_name|cpu_arch'

Tag_CPU_name: "7-A" Tag_CPU_arch: v7 Tag_CPU_arch_profile: Application

This seems to indicate that php-fpm7.2 was compiled for ARMv7-CPUs, whereas my Zero -of course- is utilizing an ARMv6-CPU: pi@nextcloudpi:~ $ egrep -i 'model|hardware' /proc/cpuinfo

model name : ARMv6-compatible processor rev 7 (v6l) Hardware : BCM2835

Since ARMv6 was the CPU for all the 1st generation Raspberry Pis, this means users of the following models should run into similar problems:

To my awareness, they are all based on a BCM2835, just like the Zero W I am running.

During my extensive trials, I observed the dreaded 'Illegal instruction' quite a few times (I think it was when trying to execute nc-init via ncp-config). I have not investigated this further, but it might very well be that other binaries are also not ARMv6-friendly, and this might be related to other issues (e.g. https://help.nextcloud.com/t/nextcloudpi-on-raspberry-pi-just-isnt-working/40137/8 ) as well.

On a side note: ncp-config's wifi setup is not operational on a Zero W that is connected by WLAN only. After enabling wifi, I presume it is trying to list all available WLAN-SSIDs for the user to choose from, but unfortunately disconnects from WLAN first. Since the existing WLAN connection was servicing the remote ssh session, the user never gets to see the list. What's worse is that even a hard restart doesn't allow the user to re-login, since both ssh and wpa_supplicant.conf have been removed. So its pulling that sd card off the Zero, writing the two files back via my workstation, then back into the Zero... This behaviour would affect all systems that are connected by WLAN only, not just the Zero W.

nachoparker commented 5 years ago

Hi,

You are certainly right, armv6 doesn't work anymore since the introduction of PHP7.2.

This is a duplicate of https://github.com/nextcloud/nextcloudpi/issues/722 and https://github.com/nextcloud/nextcloudpi/issues/667

As stated before, we chose PHP7.2 over armv6 support, because Raspbian messes up with what is considered armhf and because it is not worth it to stay in 7.0 just to support slow devices where NC doesn't work well anyway.

In any case, if there were somebody willing to help support this, the code modifications would be minimal, just change the PHPVER variable during build to 7.0, if armv6 Raspbian is detected.

This would have to be taken into account in possible update scripts.

Regarding Wifi, last time I tested this it was working fine in a RPi3, if this is any different in a Zero W PRs are accepted.

Cheers!

nachoparker commented 5 years ago

armv6 pi versions, like 1b and zero are supported again.

Also NCP can work with different PHP versions, even though PHP7.2 or greater is required for NC16