Problem Description:
I had a system crash due to power issues. I can’t boot my system. It goes to an “emergency CLI” which doesn’t work. I happened to have a backup system in which I messed up the Gnome when using the classic interface. I can read the damaged hard drive even though I can’t boot.
I have been trying to restore some Mariadb databases. I am using InnoDB and need to add “–innodb-force-recovery=1” to my systemd system file. I have done some Internet searches to try and understand how to do this but there is not enough information. I have a vague idea of what to do. I need to add a .conf file to /etc/systemd/system/mariadb.service.d . My problem is what goes in that .conf file to provide the command line option I need.
Before Posting: Please check if similar issues have already been reported and resolved.
You don’t add --innodb-force-recovery directly to the systemd unit. The clean way on Ubuntu 24.04 is to set it in MariaDB’s config, not by modifying mariadb.service.
You don’t need to touch /etc/systemd/system/mariadb.service.d unless you’re overriding the ExecStart command (not recommended here). MariaDB reads options from the .cnf files automatically.
Important: start with 1 only. If it doesn’t start, increase gradually (2 → 3 → 4, etc.). The higher the value, the more features are disabled, and at 4+ you risk data loss on writes. This mode is only for dumping data — don’t run production like this.
After dumping, remove the 99-recovery.cnf file and restart MariaDB normally.
If InnoDB still refuses to start even with force recovery, the tablespace may be heavily corrupted. In that case, you’d need to attempt file-level recovery from /var/lib/mysql, and if native recovery fails, try some third party tools like Stellar Repair for MySQL can sometimes extract data directly from damaged InnoDB files when the server cannot fully initialize.
But first try the proper .cnf method — that’s the correct approach on Ubuntu.