gocryptfs: mariadb crashing since 2.5.0

I’m running the mariadb data directory (/var/lib/mysql/) inside a gocryptfs mount. After upgrading to 2.5.0 I’m experiencing frequent crashes of the maridb process: Process 39501 (mariadbd) crashed in page_cur_tuple_insert(page_cur_t*, dtuple_t const*,...

There might be an underlying problem with permissions or such since I’m getting errors for cronjobs which are calling php scripts inside a gocryptfs directory since 2.5.0, too. Failed to open stream: Permission denied in ... But these are way more rare than the crashes of the mariadb daemon.

Going back to 2.4.0 fixes both problems.

The gocryptfs mount is mounted throught the root account using the -allow_other flag. System is a Fedora 41 with the static binaries on ext4. I’m not sure how to debug this futher, since gocryptfs does not log anything in normal mode.

It looks somewhat similar to #892 but for me older versions are working.

Edit: Startet the mount with --debug. Waiting now for a crash to happen. Edit2: It seems (as mentioned in the issue above, too) as if --debug stops the crashes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

That did the trick. I got a crash, and also some mkdir: Operation not permitted @glhughes123

So this show be fixed for now, thanks to @johnassel for helping with tracking this down.

To fix this quickly I downgraded golang.org/x/sys to what it was in v2.4.0.

In the mid-term I will have to copy pre-https://github.com/golang/sys/commit/d0df966e6959f00dc1c74363e537872647352d51 Setreuid() into gocryptfs. Ugly, but I also cannot stay on an old version of golang.org/x/sys forever.

@johnassel if you need a workaround I have set up my gocryptfs mounts to use a script that calls runuser. This allows the system to mount as the owner (instead of root) with the allow_other flag set (so other users can read/write) and seems to avoid the permission errors for me.

For example:

[greg@selene:~] cat bin/mount_crypt_ares_backups.sh 
#!/bin/sh
/usr/sbin/runuser -u greg -- /usr/bin/gocryptfs --passfile=/home/greg/.keys/ares.key $*

and the fstab entry looks like:

/home/greg/bin/mount_crypt_ares_backups.sh#/backups/ares/home/.greg.crypt /backups/ares/home/greg fuse rw,user,auto,allow_other,x-systemd.requires=/mnt/storage0 0 0

Here we go. Same “Operation not permitted” issue.

2025-01-19 21:11:48 0 [ERROR] mariadbd: File './mysqld-bin.~rec~' not found (Errcode: 1 "Operation not permitted")
2025-01-19 21:11:48 0 [ERROR] MYSQL_BIN_LOG::open_purge_index_file failed to open register  file.
2025-01-19 21:11:48 0 [ERROR] MYSQL_BIN_LOG::open_index_file failed to sync the index file.
2025-01-19 21:11:48 0 [ERROR] Aborting