Mysqld "Segmentation Fault" after reboot

I needed to power down my pi, so I went to ssh and typed “sudo shutdown now”. I waited a minute or so. Then I took away the power.
After reboot I went to emoncms webpage and got this: “Can’t connect to local MySQL server”. So I did some analysis, and I found out that the mysqld process wouldn’t start, it says “Segmentation Fault”.

Earlier I had already something weird after a reboot, but then it was php not working anymore. It complained about incorrect php.ini. When I checked php.ini it had strange characters in a certain part of the file, so it was basically corrupted. I managed to recover this file and it worked again.

Is this SD card corruption? I’m only running it for 3 months or so in “low write mode”. Am I doing something else wrong? Would it be a good idea to re-install everything and move the filesystem to a HDD?

Extra info: it is a raspberry pi 3 with a RFM69PI board. On the pi there is also “weewx” running, which is connected to a weather station and every 5 minutes writes data to the mysql DB.

edit: it is getting even worse, I tried installing a node red module:
[email protected](ro):.node-red$ npm install node-red-node-mysql

/usr/lib/nodejs/request/index.js:841
res0onse.on("data", gunction(chunk) {
^
SyntaxError: Unexpected token ILLEGAL

there suddenly is a “0” character in that file, when it should probably be a “p”…

The mysqld segmentation fault after a reboot is usually caused by a lack of disc space. What size SDcard are you using? Have you expanded the filesystem? What does this return?

df -h

It’s difficult to say whether it is sdcard corruption or not, although we rarely experience sd failures since making emoncms “low-write” and the os read-only, but it is still possible to corrupt a sdcard even with those measures if a file write is interrupted, eg a power failure.

If it is a lack of disc space, trying to install more, will make it worse. Plus if mysql isn’t functional, installing a mysql connector to node-red might not be succesful.

Also I see you are trying to install the module whilst the filesystem is “ro” that could also cause an issue.

[email protected](ro):~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.4G  2.1G  1.2G  64% /
devtmpfs        481M     0  481M   0% /dev
tmpfs           486M     0  486M   0% /dev/shm
tmpfs           486M  6.6M  479M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           486M     0  486M   0% /sys/fs/cgroup
tmpfs            40M  6.1M   34M  16% /var/lib/openhab
tmpfs           1.0M  4.0K 1020K   1% /var/lib/dhcpcd5
tmpfs           1.0M     0  1.0M   0% /var/lib/dhcp
tmpfs            50M  316K   50M   1% /var/log
tmpfs            30M   32K   30M   1% /tmp
/dev/mmcblk0p1   60M   22M   39M  37% /boot
/dev/mmcblk0p3   11G   71M   10G   1% /home/pi/data

Not looking like diskspace is the problem.
I have an external HDD, so I’m going for the reinstall and move to the HDD. I have a backup of a week ago. I’ll let you know if it pops up again.

1 Like