[MDEV-27823] mariadb-install-db --group fails Created: 2022-02-13  Updated: 2022-03-01  Resolved: 2022-03-01

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.6.7, 10.7.3, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.2.44, 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4

Type: Bug Priority: Blocker
Reporter: Brad Smith Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: regression
Environment:

OpenBSD


Issue Links:
Blocks

 Description   

Trying to update our package to 10.6.7 from 10.6.5 I noticed this new odd error when testing out mariadb-install-db.

humpty$ sudo /usr/local/bin/mariadb-install-db
Installing MariaDB/MySQL system tables in '/var/mysql' ...
2022-02-12 20:43:36 0 [ERROR] Unknown suffix '_' used for variable 'group_concat_max_len' (value '_mysql')
2022-02-12 20:43:36 0 [ERROR] /usr/local/libexec/mariadbd: Error while setting value '_mysql' to 'group_concat_max_len'



 Comments   
Comment by Elena Stepanova [ 2022-02-13 ]

What do you have in the cnf file(s)? Is it reproducible if you run with --no-defaults?
I don't have OpenBSD handy, I tried to run a clean installation of 10.6.7 on FreeBSD 13, didn't get an error, but of course there could be various system- or configuration-related differences.

Comment by Brad Smith [ 2022-02-20 ]

Nothing special in the default minimal config file that is installed.

[client-server]
#socket=/var/run/mysql/mysql.sock
#port=3306
 
# This will be passed to all MariaDB clients
[client]
#password=my_password
 
# The MariaDB server
[mysqld]
# To listen to all network addresses, use "bind-address = *"
bind-address=localhost
# Directory where you want to put your data
#data=/var/mysql
# This is the prefix name to be used for all log, error and replication files
#log-basename=mysqld
# Logging
#general-log
#slow_query_log

Yes, it is still reproducible with --no-defaults. That definitely won't be useful when it comes to trying to reproduce the issue.

I can provide you with an account on one of my build systems if you want to take a look around.

Comment by Elena Stepanova [ 2022-02-20 ]

> I can provide you with an account on one of my build systems if you want to take a look around
Yes, please do.

Comment by Elena Stepanova [ 2022-02-22 ]

With the provided access, I was able to figure why the problem occurs. It is a regression indeed.

The patch below introduced the usage of "group" option to mysql_install_db

commit 93a5fb00252c54cad2844b385808a1c6ff0037eb
Author: Monty
Date:   Thu Jan 27 14:43:21 2022 +0200
 
    MDEV-27477 Remaining SUSE patches for 10.2+
    
    This patch let's you specify not only user to use but also group that
    MariaDB should use.

If the value is set, the script uses it in chown operations, but it also adds it to the bootstrap command line, like it did before for user value, as in --group=<value>.

However, there is no such option as group for mariadbd, so instead it takes it as a prefix of --group-concat-max-len.

By sheer luck, in standard MariaDB installations the value would be either none or mysql. If mysql is provided, it is treated as M suffix, thus the value becomes 0m and then adjusted to 4 (with warnings, but the warnings would be usually silenced).

However, OpenBSD uses group/user _mysql, not mysql, and it even sets it in the modified version of mariadb-install-db by default, so it's always there. The underscore is not a valid suffix for a numeric option, so the server cannot parse the presumed group-concat-max-len value and fails to start.

$ bin/mysqld --group=mysql
2022-02-22 18:47:47 139798922537856 [Note] Using unique option prefix 'group' is error-prone and can break in the future. Please use the full name 'group_concat_max_len' instead.
2022-02-22 18:47:47 139798922537856 [Warning] option 'group_concat_max_len': unsigned value 0 adjusted to 4

$ bin/mysqld --group=_mysql
2022-02-22 18:48:11 139757314038656 [Note] Using unique option prefix 'group' is error-prone and can break in the future. Please use the full name 'group_concat_max_len' instead.
Unknown suffix '_' used for variable 'group_concat_max_len' (value '_mysql')
2022-02-22 18:48:11 139757314038656 [Warning] option 'group_concat_max_len': unsigned value 0 adjusted to 4
2022-02-22 18:48:11 139757314038656 [ERROR] bin/mysqld: Error while setting value '_mysql' to 'group_concat_max_len'

The probable fix is not to add the --group option to the server command line, but instead only use it for ownership operations.

Comment by Brad Smith [ 2022-02-22 ]

Thank you for looking into this. OpenBSD has had a very minimal patch for group handling which I re-based on that commit, but all it was was just the command-line handling for --group passed to mariadb-install-db and changing the chown operation.

Comment by Elena Stepanova [ 2022-02-22 ]

Right. While I didn't try it in your environment, I think you should be able to work around the problem by dropping this part from the script

if test -n "$group"
then
  args="$args --group=$group"
fi

Comment by Brad Smith [ 2022-02-22 ]

It looks like that piece as well as the line..

GROUP_OPTION="--group=$group"

That was added to mysqld_safe.sh which should be removed. At the moment it does nothing since the shell script was not changed further down where USER_OPTION is handled.

Comment by Michael Widenius [ 2022-03-01 ]

I have now removed sending the --group option to the server.
I have kept the old code (partly in comments) for a day when we want to add a --group option
to the server to force it to use a specific group for created files.

Comment by Michael Widenius [ 2022-03-01 ]

Bug fix was trivial, most time spent on reading up and discussions

Generated at Thu Feb 08 09:55:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.