Been trying for a couple of days to install emoncms on Debian 12 but it keeps getting an Uncaught mysqli_sql_exception while trying to update the db. Everything else appears to go fine during the installation.
PHP Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'emoncms'@'localhost' (using password: YES) in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php:11
Stack trace:
#0 /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php(11): mysqli->__construct()
#1 {main}
thrown in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php on line 11
I can login to the emoncms database with the config.ini supplied user and password and can see that it hasn’t been populated. This installation is running PHP8.2 and mariadb 10.11.6. Any ideas what might be going on?
Here’s the whole log.
Script output also stored in /home/hominoid/main.sh.log
Started: Thu May 16 01:53:13 PM EDT 2024
-------------------------------------------------------------
EmonSD Install
-------------------------------------------------------------
Warning: The default configuration of this script applies
significant modification to the underlying system!
Would you like to review the build script config before starting? (y/n) apt-get update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Get:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Hit:4 https://download.docker.com/linux/debian bookworm InRelease
Hit:5 http://ppa.linuxfactory.or.kr bookworm InRelease
Fetched 48.0 kB in 3s (14.7 kB/s)
Reading package lists...
-------------------------------------------------------------
apt-get upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-------------------------------------------------------------
apt-get dist-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-------------------------------------------------------------
apt-get clean
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Important: Did you get a request to reboot your machine, if so we recommend you do this now.
Would you like to exit installation to reboot your machine? (y/n) -------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.39.2-1.1).
build-essential is already the newest version (12.9).
python3-pip is already the newest version (23.0.1+dfsg-1).
python3-dev is already the newest version (3.11.2-1+b1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-------------------------------------------------------------
-------------------------------------------------------------
Apache configuration
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.59-1~deb12u1).
gettext is already the newest version (0.21-12).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-- emoncms www folder already installed
-- log folder already exists
Module rewrite already enabled
Conf emonsd already enabled
Site 000-default already disabled
Site emoncms already enabled
-------------------------------------------------------------
Setup the Mariadb server (MYSQL)
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
mariadb-server is already the newest version (1:10.11.6-0+deb12u1).
mariadb-client is already the newest version (1:10.11.6-0+deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-- Secure MYSQL
-- Create emoncms database
ERROR 1007 (HY000) at line 1: Can't create database 'emoncms'; database exists
-- Add user:emoncms and assign to database:emoncms
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'emoncms'@'localhost'
-------------------------------------------------------------
Install PHP
-------------------------------------------------------------
-- not ARMv6 architecture OK to use PHP8.1
Reading package lists...
Building dependency tree...
Reading state information...
php8.2 is already the newest version (8.2.18-1~deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
php8.2-mysql is already the newest version (8.2.18-1~deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
php8.2-gd is already the newest version (8.2.18-1~deb12u1).
php8.2-curl is already the newest version (8.2.18-1~deb12u1).
php-pear is already the newest version (1:1.10.13+submodules+notgz+2022032202-2).
php8.2-dev is already the newest version (8.2.18-1~deb12u1).
php8.2-common is already the newest version (8.2.18-1~deb12u1).
php8.2-mbstring is already the newest version (8.2.18-1~deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
-------------------------------------------------------------
Redis configuration
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
redis-server is already the newest version (5:7.0.15-1~deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-------------------------------------------------------------
fatal: destination path 'phpredis' already exists and is not an empty directory.
Configuring for:
PHP Api Version: 20220829
Zend Module Api No: 20220829
Zend Extension Api No: 420220829
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20220829
checking for PHP installed headers prefix... /usr/include/php/20220829
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking whether to enable redis support... yes, shared
checking whether to enable sessions... yes
checking whether to enable json serializer support... yes
checking whether to enable igbinary serializer support... no
checking whether to enable msgpack serializer support... no
checking whether to enable lzf compression... no
checking use system liblzf... no
checking whether to enable Zstd compression... no
checking use system libzstd... yes
checking whether to enable lz4 compression... no
checking use system liblz4... no
checking for hash includes... /usr/include/php/20220829
checking for json includes... /usr/include/php/20220829
checking for redis json support... enabled
checking for redis igbinary support... disabled
checking for pkg-config... /usr/bin/pkg-config
checking for git... yes
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert aarch64-unknown-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert aarch64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
/bin/bash /opt/openenergymonitor/EmonScripts/install/phpredis/libtool --tag=CC --mode=install cp ./redis.la /opt/openenergymonitor/EmonScripts/install/phpredis/modules
libtool: install: cp ./.libs/redis.so /opt/openenergymonitor/EmonScripts/install/phpredis/modules/redis.so
libtool: install: cp ./.libs/redis.lai /opt/openenergymonitor/EmonScripts/install/phpredis/modules/redis.la
libtool: finish: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin" ldconfig -n /opt/openenergymonitor/EmonScripts/install/phpredis/modules
----------------------------------------------------------------------
Libraries have been installed in:
/opt/openenergymonitor/EmonScripts/install/phpredis/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/lib/php/20220829/
-------------------------------------------------------------
extension=redis.soRequirement already satisfied: redis in /usr/local/lib/python3.11/dist-packages (5.0.4)
Requirement already satisfied: async-timeout>=4.0.3 in /usr/local/lib/python3.11/dist-packages (from redis) (4.0.3)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
-------------------------------------------------------------
Mosquitto Server installation and configuration
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
mosquitto is already the newest version (2.0.11-1.2+deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
libmosquitto-dev is already the newest version (2.0.11-1.2+deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-------------------------------------------------------------
Mosquitto Client installation and configuration
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
libmosquitto-dev is already the newest version (2.0.11-1.2+deb12u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
fatal: destination path 'Mosquitto-PHP' already exists and is not an empty directory.
Configuring for:
PHP Api Version: 20220829
Zend Module Api No: 20220829
Zend Extension Api No: 420220829
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20220829
checking for PHP installed headers prefix... /usr/include/php/20220829
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for mosquitto support... yes, shared
checking for mosquitto files in default path... checking /usr... found in /usr
checking for cc options needed to detect all undeclared functions... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking whether strerror_r returns char *... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert aarch64-unknown-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert aarch64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
/bin/bash /opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/libtool --tag=CC --mode=install cp ./mosquitto.la /opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/modules
libtool: install: cp ./.libs/mosquitto.so /opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/modules/mosquitto.so
libtool: install: cp ./.libs/mosquitto.lai /opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/modules/mosquitto.la
libtool: finish: PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin" ldconfig -n /opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/modules
----------------------------------------------------------------------
Libraries have been installed in:
/opt/openenergymonitor/EmonScripts/install/Mosquitto-PHP/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/lib/php/20220829/
-------------------------------------------------------------
extension=mosquitto.so-------------------------------------------------------------
Install Emoncms Core
-------------------------------------------------------------
-- emoncms already installed
-- log folder already exists
-- log file already exists
-- emoncms settings.ini already exists
-- datadir phpfina already exists
-- datadir phpfiwa already exists
-- datadir phptimeseries already exists
-------------------------------------------------------------
Install Emoncms Services
-------------------------------------------------------------
-- installing feedwriter to /var/www/emoncms/scripts/services/feedwriter/feedwriter.service
feedwriter.service already installed
-- installing service-runner to /var/www/emoncms/scripts/services/service-runner/service-runner.service
service-runner.service already installed
-- installing service-runner drop-in User=hominoid
-- installing feedwriter drop-in User=hominoid
-- installing service-runner to /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.service
emoncms_mqtt.service already installed
-- installing emoncms_mqtt drop-in User=hominoid
-------------------------------------------------------------
Install Emoncms Core Modules
-------------------------------------------------------------
-- Module dashboard already exists
-- Module app already exists
-- Module graph already exists
-- Module device already exists
-- Module backup already exists
-- Module usefulscripts already exists
-- Module network already exists
-- Module sync already exists
-- Module postprocess already exists
-- Update Emoncms database
PHP Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'emoncms'@'localhost' (using password: YES) in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php:11
Stack trace:
#0 /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php(11): mysqli->__construct()
#1 {main}
thrown in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php on line 11
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'emoncms'@'localhost' (using password: YES) in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php:11
Stack trace:
#0 /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php(11): mysqli->__construct()
#1 {main}
thrown in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php on line 11
Script output also stored in /home/hominoid/main.sh.log