Poller error. Could not connect to MySQL database. Packet Sequence wrong got 1 expected 0

Apologies for my lack of knowledge, but I’m still new to Linux. I came in and our Librenms was not polling.

Validate.php says the DB schema is wrong and suggests the following:

  • SET TIME_ZONE=’+00:00’;
  • ALTER TABLE notifications CHANGE datetime datetime timestamp NOT NULL DEFAULT ‘1970-01-02 00:00:00’ ;
  • ALTER TABLE users CHANGE created_at created_at timestamp NOT NULL DEFAULT ‘1970-01-02 00:00:01’ ;

I can restore the system to a point, but the issue is already started apparently. I can run ./poller-wrapper.py manually and it works, but shortly after the restore this issue crops up. After it does running ./poller-wrapper.py fails unless I add the <amount_of_workers> and even when I do it fails with the following:

2021-10-04 09:14:09,966 :: INFO :: Using pure python SQL client
2021-10-04 09:14:09,972 :: CRITICAL :: ERROR: Could not connect to MySQL database! Packet sequence number wrong - got 1 expected 0
Traceback (most recent call last):
File “./poller-wrapper.py”, line 57, in
wrapper.wrapper(
File “/opt/librenms/LibreNMS/wrapper.py”, line 463, in wrapper
db_connection = LibreNMS.DB(sconfig)
File “/opt/librenms/LibreNMS/init.py”, line 218, in init
self.connect()
File “/opt/librenms/LibreNMS/init.py”, line 249, in connect
conn = MySQLdb.connect(**args)
File “/usr/lib/python3/dist-packages/pymysql/init.py”, line 94, in Connect
return Connection(*args, **kwargs)
File “/usr/lib/python3/dist-packages/pymysql/connections.py”, line 325, in init
self.connect()
File “/usr/lib/python3/dist-packages/pymysql/connections.py”, line 598, in connect
self._get_server_information()
File “/usr/lib/python3/dist-packages/pymysql/connections.py”, line 975, in _get_server_information
packet = self._read_packet()
File “/usr/lib/python3/dist-packages/pymysql/connections.py”, line 669, in _read_packet
raise err.InternalError(
pymysql.err.InternalError: Packet sequence number wrong - got 1 expected 0

Quick update. It occurs after manually running daily.sh it seems.

I think you got too old python deps.
Try running

pip3 install -U -r requirements.txt

Thanks for that!. It updated those, but showed that I’m missing testresources. I manually installed that as well and tested the daily.sh again. The poller is still giving the: CRITICAL :: ERROR: Could not connect to MySQL database! Packet sequence number wrong - got 1 expected 0

I do show a new validation error that I can’t clear prior to running daily.sh now though. I manually change ownership of this file and it reverts back to www-data each time.

Fail: We have found some files that are owned by a different user than ‘librenms’, this will stop you updating automatically and / or rrd files being updated causing graphs to fail.

Fix:sudo chown -R librenms:librenms /opt/librenmssudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

  • Files
  • /opt/librenms/.composer/cache/composer-temp.phar

Cleared the validation errors. Still stuck at the main error after running daily.sh.

While poking around I had found some PHP errors so I reinstalled php 7.4.3, but still have the same issue.

For reference I’m daily.sh says I’m updating from 7857dab98 to 7fe8ddfb2.

do you have skip-name-resolve setup in your my.cnf / mysqld.conf ? if yes, remove it, restart mysql/mariadb and that should fix it :slight_smile:

I had the same issue a couple of days ago and that was pretty much the fix that fixed mine.

This cleared it! Mine was hiding in 50-server.cnf. Everything seems to be running great now so thank you so much! Heh I never would have caught that one!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.