Skip to main content
Topic: Trying to enable MariaDB and also PostgreSQL on Artix Runit (Read 1579 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Trying to enable MariaDB and also PostgreSQL on Artix Runit

Hi all!  This is my first post here on The Artix Linux Forums!
I've migrated here from Manjaro as I'm interested in getting away from systemd.

So far I'm liking my experience, I installed Artix with Runit yesterday and it runs very fast and smoothly, but I'm trying to get both postgresql and mariadb to start up at boot, and am having some strange behavior.  For now I'd just like to address getting mariadb up and running as I believe the solution is similar as it has to do with my not understanding how to set up services with runit.

I have already created a symlink using the ln -s syntax.  Specifically I ran:

`ln -s /etc/runit/sv/mariadb /run/runit/service`

I guess I had created it last night (sorry, setting up was a bit of a blur and I spent some time customizing things the way I wanted, but basically I got this message today when I went back in to troubleshoot):

`ln: failed to create symbolic link 'run/runit/service/mariadb': File exists`

So great, thanks past me!  I then tried a series of sv commands from the artix runit pdf to try and get it up and running, but it doesn't exactly work...

`sv start mariadb
ok: run: mariadb: (pid 12961) 0s`

Cool, but then...

`sv status mariadb
down: mariadb: 1s, normally up, want up`

Ok, so...

`sv up mariadb`
returns no message

And then...
`sv status mariadb
down: mariadb: 1s, normally up, want up`

I'm at a loss here, I was only able to find sparse documentation on these forums regarding setting up mariadb with runit, which was helpful, but I still can't connect.  In addition to that, I've followed this link's guidance, including installing mariadb-runit from a little over a year ago:

https://forum.artixlinux.org/index.php/topic,1879.0.html

I also am having issues with just starting mariadb, as it can't find the .sock to connect:

`mariadb -u mysql`
`ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)`

So I'm at a loss, I'm having similar issues with postgresql, but I was able to get it running initially when first installed, afterwards though I needed to do a reboot and of course, there was no persistence because I didn't know how to set that up via runit, and now postgres is also giving me a similar 'normally up, want up' message.

Any help would be greatly appreciated here!  I'm certain this is not too difficult of  a fix but because of my lack of experience with other init systems, I'm not sure how to proceed.

Thanks for taking the time to read this, and I humbly ask for any advice/recommendations.  Again, thank you!


Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #2
Interestingly enough the mariadb is showing as a running process under runsv in btop, but I still get the ok: down: mariadb: 1s, normally up, want up message

When trying to do anything with postgres, it says the server is not running, any ideas?

And yes, the mariadb wiki is helpful, but it can't connect to loca server through socket '/run/mysqld/mysqld.sock'

From what I've read on stackoverflow, the mysqld.sock file is supposed to be created at some point in the installation process, but it simply wasn't, any ideas on how to proceed?

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #3
Did you try to run commands from scripts manually for both DBs? In general you need to install DB at certain path and only start server after that
ARMtix

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #4
Did you try to run commands from scripts manually for both DBs? In general you need to install DB at certain path and only start server after that

I followed the arch wiki's guidelines for installing mariadb and postgresql respectively.  Postgres, as I said before was up and running after the initial installation, but after reboot runit would no longer start the service, the server at port 5432 is apparently not running.

MariaDB is simply throwing me the .sock file not found error (ERROR 2002).

I've also tried running sv restart mariadb, which gives me an ok code and a pid number, but btop shows that that pid isn't found, and when i run sv start or sv status, both messages tell me that it is not up, wants up.  I have also tried the sv up command, but it gives me no output and doesn't seem to change anything.

Thank you, truly.

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #5
Before starting mariadb service, run this command,

Code: [Select]
$sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql

It got my service up in OpenRC. Also make sure you don't have anything like SELinux or Apparmor running in your system.






Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #6
Before starting mariadb service, run this command,

Code: [Select]
$sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql

It got my service up in OpenRC. Also make sure you don't have anything like SELinux or Apparmor running in your system.

Yes, I recall actually running this command as well, it gives me this error message:

`mysql.user table already exists!
Run mysql_upgrade, not mysql_install_db`

It appears I already created that table but I still get the error.

Thanks for the recommendation though, I ran it again just in case, but yeah, same problem.

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #7
I don't have runit installed. Can you post the runit version of mariadb service file?

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #8
I don't have runit installed. Can you post the runit version of mariadb service file?

Yes, they are written in bash and somewhat straight forward, here you go:

#!/bin/sh
[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
chown mysql:mysql /run/mysqld
exec chpst -u mysql:mysql mysqld --user=mysql 2>&1

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #9
In an attempt to see if the mysqld.sock file exists elsewhere, I troubleshooted by using the find command like so:

`find / -type s`

Which returned this output:

`/tmp/dbus-OUYziBvaIt
/tmp/.ICE-unix/1322
/tmp/ssh-XXXXXXEW3HjH/agent.1390
/tmp/.X11-unix/X0
/run/nvidia-xdriver-6259e1fe
/run/acpid.socket
/run/syslog-ng.ctl
/run/cups/cups.sock
/run/dbus/system_bus_socket
/run/user/1000/pulse/native
/run/user/1000/pulse/dbus-socket
/run/user/1000/gnupg/S.gpg-agent.ssh
/run/user/1000/gnupg/S.gpg-agent.browser
/run/user/1000/gnupg/S.gpg-agent.extra
/run/user/1000/gnupg/S.gpg-agent
find: ‘/run/user/1000/gvfs’: Permission denied
/run/udev/control
/dev/log`

So the mysqld.sock definitely isn't anywhere, otherwise I could have simply pointed to it in the my.cnf file.

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #10
Yes, they are written in bash and somewhat straight forward, here you go:

#!/bin/sh
[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
chown mysql:mysql /run/mysqld
exec chpst -u mysql:mysql mysqld --user=mysql 2>&1

Run the following command should give you more info why the process doesn't come up.

Code: [Select]
$sudo chpst -u mysql:mysql mysqld --user=mysql


Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #11
Run the following command should give you more info why the process doesn't come up.

Code: [Select]
$sudo chpst -u mysql:mysql mysqld --user=mysql

Yes sir, and thanks for taking a look! Here's my output:

2021-11-12  7:34:16 0 [Note] mysqld (server 10.6.5-MariaDB) starting as process 15365 ...
2021-11-12  7:34:16 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 32194)
2021-11-12  7:34:16 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)
2021-11-12  7:34:16 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
2021-11-12  7:34:16 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2021-11-12  7:34:16 0 [ERROR] Plugin 'Aria' init function returned error.
2021-11-12  7:34:16 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2021-11-12  7:34:16 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2021-11-12  7:34:16 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2021-11-12  7:34:16 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-11-12  7:34:16 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-11-12  7:34:16 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2021-11-12  7:34:16 0 [ERROR] Failed to initialize plugins.
2021-11-12  7:34:16 0 [ERROR] Aborting

 

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #12
Yes sir, and thanks for taking a look! Here's my output:

2021-11-12  7:34:16 0 [Note] mysqld (server 10.6.5-MariaDB) starting as process 15365 ...
2021-11-12  7:34:16 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 32194)
2021-11-12  7:34:16 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)
2021-11-12  7:34:16 0 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
2021-11-12  7:34:16 0 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2021-11-12  7:34:16 0 [ERROR] Plugin 'Aria' init function returned error.
2021-11-12  7:34:16 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2021-11-12  7:34:16 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2021-11-12  7:34:16 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2021-11-12  7:34:16 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-11-12  7:34:16 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-11-12  7:34:16 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2021-11-12  7:34:16 0 [ERROR] Failed to initialize plugins.
2021-11-12  7:34:16 0 [ERROR] Aborting

I'm not an expert in database area. The first part (warnning) is easy to fix by ulimit. The second part (error) looks like related to permission settings. Did you check the user/passwd in the database?

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #13
I'm not an expert in database area. The first part (warnning) is easy to fix by ulimit. The second part (error) looks like related to permission settings. Did you check the user/passwd in the database?

Thanks for helping me troubleshoot a bit here!  I was looking into the man pages of ulimit (and also the tldr), but am unsure how to utilize it to open up more memory/users?

The permissions probably just needs to be changed using chown to mysql since that is the default user I set up.

I can chown the aria folder and see if that gives different results, but could you advise on the best way to use ulimit for this?

Again, thanks so much!

Re: Trying to enable MariaDB and also PostgreSQL on Artix Runit

Reply #14
Ok, looks like after

`chown root /var/lib/mysql`

I re entered chpst command as above and got this (still includes a permission denied error, but different):

`2021-11-12  8:00:08 0 [Note] mysqld (server 10.6.5-MariaDB) starting as process 25452 ...
2021-11-12  8:00:08 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 32194)
2021-11-12  8:00:08 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)
2021-11-12  8:00:08 0 [Warning] Can't create test file /var/lib/mysql/artix.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
2021-11-12  8:00:08 0 [ERROR] Aborting`

Any ideas how to proceed?