Some pathes are wrong -ZM from source

Forum for questions and support relating to the 1.30.x releases only.
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Some pathes are wrong -ZM from source

Post by MrDini »

Hi,

This is my first post, and I am not a ZoneMinder guru, So sorry for my noobness!

I installed the ZM to my Ubuntu desktop PC, and it works nicely, So I decided to make a try, to compile it to my ARMv5 NAS too. This isn't my first package, but that was really hard! The disclaimer, about the compiling at the git page, and at this Read before posting is true. :) But now, I Could compile the source successfully, and I Could package it.

But my NAS's root folder (the /) is read only and has outdated binaries. Everything is at /ffp prefix. I checked the pathes, before compiling at the ccmake, but when I try to start the ZM, it says this:

Code: Select all

ps: invalid option -- 'o'
BusyBox v1.17.2 (2016-01-15 10:55:21 CST) multi-call binary.

Usage: ps

Can't exec "sudo": No such file or directory at /ffp/lib/perl5/vendor_perl/5.14.2/ZoneMinder/General.pm line 110.
Use of uninitialized value $output in scalar chomp at /ffp/lib/perl5/vendor_perl/5.14.2/ZoneMinder/General.pm line 119.
Use of uninitialized value $output in concatenation (.) or string at /ffp/lib/perl5/vendor_perl/5.14.2/ZoneMinder/General.pm line 120.
su: unrecognized option '--shell=/bin/sh'
BusyBox v1.17.2 (2016-01-15 10:55:21 CST) multi-call binary.

Usage: su [OPTIONS] [-] [USERNAME]

su: can't chdir to home directory '/var/www'
su: can't execute '/sbin/nologin': No such file or directory
So, it looks like somewhere exist wrong pathes. Where are theese files? I tried to change all /sbin/nologin to /ffp/sbin/nologin for example via sed, but nothing happened.

How Can I solve that?

Many thanks!

Ps: sorry for my bad English.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Some pathes are wrong -ZM from source

Post by knight-of-ni »

You don't have the sudo command installed on your system or it is not in your path.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

Thanks for Your quick reply!

I have a sudo binary at /ffp/bin/ folder. And it is the part of the PATH.

If I manually execute 'whereis sudo', it gives me the following:

Code: Select all

sudo: /ffp/bin/sudo
:?
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Some pathes are wrong -ZM from source

Post by knight-of-ni »

Maybe so, but your Perl executable cannot find the sudo binary due to the environment it is running in.

ZoneMinder expects your binaries to be in standard (Linux) places. Every zoneminder perl script has this line:
https://github.com/ZoneMinder/ZoneMinde ... .pl.in#L55

You could try patching your build to add your /ffp/bin path to that line to every perl script. That might help.

However, I don't know how much success you are going to have running this from busybox as there appear to be other problems going on. For example, the ps binary does not appear to accept the "-o" option, nor does the su binary appear to accept the "--shell" parameter.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

Thanks, I think, that's what I am looking for. And it was opposite my eyes, and I Cannot recognize that...
knnniggett wrote: However, I don't know how much success you are going to have running this from busybox as there appear to be other problems going on.
Oh, that's our FFp magic! :D Yes, as You Can see from the output, there is some strange old busybox binaries at the /sbin and /bin pathes and it is a read only mount of a fw img file. So we Can't do anything with it. But the /ffp prefix is a symlink to a HDD where we Can insert anything. And here I have a complete FHS, and I am using it like a chroot. And of course, I have the latest ps, su and other binaries and theese binaries have theese flags.

Sorry for the off, I wrote it just to be clear in my situation. ;)

Will see the result! Thanks again man!
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Some pathes are wrong -ZM from source

Post by knight-of-ni »

No problem... I didn't want to sound too discouraging, but I also wanted to point out it looks like you may have more than one problem to work through.
Good luck.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

Wow, it worked! :o

Can I ask an another question too here?

What is that error:

Code: Select all

Unable to connect to ZM db.could not find driver
Fatal error: Uncaught Error: Call to a member function query() on null in /ffp/share/zoneminder/www/includes/config.php:151 Stack trace: #0 /ffp/share/zoneminder/www/includes/config.php(124): loadConfig() #1 /ffp/share/zoneminder/www/index.php(49): require_once('/ffp...') #2 {main} thrown in /ffp/share/zoneminder/www/includes/config.php on line 151
When I try to open the apache webGUI, it gave this...

Edit: Here is a 'php -m' output:

Code: Select all

~# php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysql
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

Segmentation fault (core dumped)
The segfault is a mistery at the end, will try to resolve, why... Can it cause the problem?

Edit: okay, will try to recompile the php package (the current is not mine), because the bt output was informative.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Some pathes are wrong -ZM from source

Post by knight-of-ni »

Similar situation as before. Despite your user account being able to find the php mysql with a "php -m", your web server cannot find it. Probably another path related thing.

You might want to try adding phpinfo() to a custom php file and then point your browser to it. Does phpinfo report the mysql driver?
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

I Can see a pdo-mysql at the phpinfo() yes...
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

Sorry for the delay. The project has been aborted, because I had a bad working PHP with external modules. But now I had time to compile a smooth PHP 7.1.11 and an Apache 2.4.29. :) ZoneMinder webGUI works so far.

But when I click on the webinterface's "Stopped" link, and try to start the ZoneMinder, nothing happens on the GUI side just loading endlessly. However in the top's output, I Can see a new proccess, uname (to be exact, "uname -m"), which is eating the CPU drastically. I took a look on the code, and found this. After I switched back to the old method by commenting the new version. And I manually killed the uname with a "kill -9" (the HANGUP does nothing).

After a restart, the webinteface behaves just the same like before... But now I Can see these processes(in this case the sh command is our CPU killer):

Code: Select all

nobody   18052  0.0  0.2   2712   540 ?        S    14:53   0:00 sh -c cd '/usr/local/zy-pkgs/ffproot/ffp/share/zoneminder/www' ; /ffp/bin/zmpkg.pl 'default' 2>/dev/null >&- <&- >/dev/null
root     18057 91.2  0.0    704    44 ?        R    14:53   0:31 sh -c ps -o comm="" -p 1
As I mentioned earlier, my whole system is under /ffp. So I changed the pathes...

What Can I do?

Thanks.
mikb
Posts: 601
Joined: Mon Mar 25, 2013 12:34 pm

Re: Some pathes are wrong -ZM from source

Post by mikb »

Don't forget that this NAS is a limited memory, limited CPU environment -- hence the use of Busybox: Which is an attempt to replace all/most of the commands you THINK you have installed with a single binary that pretends to be ALL of them. Hence you will find that the commands are stripped down versions that don't support every conceivable option -- just the important ones.

As to "uname" eating up all the processor time, that's very odd: "uname -m" should return the architecture of the processor, e.g. "i686". That's not a challenging thing. You do seem to be operating in an odd environment, so expect more trouble :(
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

mikb wrote: Sun Nov 19, 2017 8:06 pm Don't forget that this NAS is a limited memory, limited CPU environment -- hence the use of Busybox: Which is an attempt to replace all/most of the commands you THINK you have installed with a single binary that pretends to be ALL of them. Hence you will find that the commands are stripped down versions that don't support every conceivable option -- just the important ones.

As to "uname" eating up all the processor time, that's very odd: "uname -m" should return the architecture of the processor, e.g. "i686". That's not a challenging thing. You do seem to be operating in an odd environment, so expect more trouble :(
Thanks for your reply.

You will be surprised, there is no busybox at all inside the "/ffp" prefix. Because the NAS's FHS is on a NAND ROM chip, which is limited in writing, the /ffp is a symlink from an HDD. And there we compiled a lot of sources for FFp. Here is an uname catch:

Code: Select all

root@NAS:~# which uname
/ffp/bin/uname
root@NSA320S:~# ls -la /ffp/bin/uname
-rwxr-xr-x 1 root root 22172 Dec 22  2011 /ffp/bin/uname
root@NAS:~# file /ffp/bin/uname
/ffp/bin/uname: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
root@NAS:~# uname --help
Usage: uname [OPTION]...
Print certain system information.  With no OPTION, same as -s.

  -a, --all                print all information, in the following order,
                             except omit -p and -i if unknown:
  -s, --kernel-name        print the kernel name
  -n, --nodename           print the network node hostname
  -r, --kernel-release     print the kernel release
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type or "unknown"
  -i, --hardware-platform  print the hardware platform or "unknown"
  -o, --operating-system   print the operating system
      --help     display this help and exit
      --version  output version information and exit

Report uname bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report uname translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'uname invocation'
It's a bit old, but I am sure it's from coreutils, and not busybox.

The "uname -m" manualy returns this:

Code: Select all

armv5tel
Yes, it is a bit outdated configuration, but I Could use all the things, that I wanted on that (except the latest Plex, Node.js, Go and Qt4). And I am really interested on a ZoneMinder performance. The webGUI was slow, but after tons of apache & PHP optimalizations, the load time is approximately 0.1 sec for every page. And I am really satisfued with this. I know, the Perl Can be slow too, but will see if we Can figure out this issue somehow. :)

Bash version: 4.3.42
Perl version: 5.24.0
mikb
Posts: 601
Joined: Mon Mar 25, 2013 12:34 pm

Re: Some pathes are wrong -ZM from source

Post by mikb »

Oh right: I got distracted by your error report (1st post) which clearly said "BusyBox v1.17.2 (2016-01-15 10:55:21 CST) multi-call binary." in two places, which made me think that Zoneminder might be caught out by the lack of full Gnu/POSIX/Linux tools!

I suppose the other thing to check is that your PATH environment is set correctly for ZoneMinder. Just because one user can "which uname" and get the right answer, doesn't necessarily mean the ZoneMinder user will. If Zoneminder is also running as root, disregard this :)
MrDini
Posts: 9
Joined: Fri Dec 02, 2016 3:30 pm

Re: Some pathes are wrong -ZM from source

Post by MrDini »

mikb wrote: Mon Nov 20, 2017 6:33 pm Oh right: I got distracted by your error report (1st post) which clearly said "BusyBox v1.17.2 (2016-01-15 10:55:21 CST) multi-call binary." in two places, which made me think that Zoneminder might be caught out by the lack of full Gnu/POSIX/Linux tools!

I suppose the other thing to check is that your PATH environment is set correctly for ZoneMinder. Just because one user can "which uname" and get the right answer, doesn't necessarily mean the ZoneMinder user will. If Zoneminder is also running as root, disregard this :)
Yes, I grepped the ZoneMinder's perl folder, and changed all the PATH variables to /ffp/bin:/ffp/sbin:/bin:/sbin which is also the root user's PATH. So it should work. But it does not unfortunately.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Some pathes are wrong -ZM from source

Post by rockedge »

knnniggett wrote:
However, I don't know how much success you are going to have running this from busybox as there appear to be other problems going on.
I use busybox and have ZM from v 1.26.5 through to 1.31.16 running very well with Puppy Linux Xenial and Tahr both totally without SUDO .... some specs on the current setup:

Distro: xenialpup 7.0.6
Window Manager: JWM v2.3.5

Development:
Bash: 4.3.29
Geany: 1.29
Gtkdialog: 0.8.4
Perl: 5.22.1
Python: 2.7.12
Yad: 0.12.4
--
busybox: 1.24.2
dhcpcd: 6.7.1
GCC: 20160609
Glibc: 2.23
OpenSSL: 1.0.2g

I have installed ZM by package manager, also by installing each lib and ZM from .deb manually and also compiled from source with various hybrid installs combining all the methods. There were small fixes needed to convince ZM to start sometimes.......
Locked