You are not logged in.

#1 2015-12-22 20:38:15

Regis
Member
Registered: 2013-12-26
Posts: 5

Homeless mysql user

Hello,

(Short abstract for those who have little time: I suspect a tiny bug in mariadb package and would like to be sure before reporting it.)

Today when I booted my computer I saw some red writings before the login prompt cleared the screen. It did not prevent my computer from working properly, but I investigated the error. The relevant systemd journal entries are:

dec. 22 20:24:37 localhost pwck[292]: user mysql : directory « /var/lib/mysql » does not exist
dec. 22 20:24:37 localhost pwck[292]: pwck : no change
dec. 22 20:24:37 localhost systemd[1]: shadow.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
dec. 22 20:24:37 localhost systemd[1]: Failed to start Verify integrity of password and group files.
dec. 22 20:24:37 localhost systemd[1]: shadow.service: Unit entered failed state.
dec. 22 20:24:37 localhost systemd[1]: shadow.service: Failed with result 'exit-code'.

I figured the cause of the problem was that I installed mariadb package (and removed it shortly after). This created a "mysql" user which home directory is /var/lib/mysql according to /etc/passwd, however this directory was never created, and thus does not exist. The error I had is simply pwck progam showing me the inconsistency.

I never used mariadb so I can be wrong, but my guess is that someone who would actually use this package would create /var/lib/mysql when configuring it. However in the case of someone who does NOT use the package, the inconsistency remains : mysql user home directory does not exist.

Would it not be cleaner to create /var/lib/mysql (even if it stays empty) during mariadb package installation,  just after creating user "mysql", to avoid a daily error in the logs?

I think the fix would be trivial: it would just be a matter of editing the post-install script by adding a "mkdir -p /var/lib/mysql" just next to the useradd command.

Is there any particular reason why this is not done already? Would you say this is a bug (even if a pretty minor one)?

Thanks,

Regis

Offline

#2 2015-12-23 00:47:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: Homeless mysql user

Adding untracked dirs is not the answer. Paying attention to those errors when they happen and fixing them is.

Offline

#3 2015-12-23 01:11:34

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: Homeless mysql user

Regis wrote:

Would you say this is a bug (even if a pretty minor one)?

Yes, plus the fact that the user is not removed when the package is removed I would consider a bug. But that's just my humble opinion.

Offline

#4 2015-12-23 01:27:03

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Homeless mysql user

Scimmia wrote:

Adding untracked dirs is not the answer. Paying attention to those errors when they happen and fixing them is.

I notice that this is the general behaviour/policy of many/most packages here, but I see no reason why we can't have untracked (home) dirs while we have untracked users/groups.

Last edited by tom.ty89 (2015-12-23 01:27:43)

Offline

#5 2015-12-23 03:58:17

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: Homeless mysql user

fukawi2 wrote:
Regis wrote:

Would you say this is a bug (even if a pretty minor one)?

Yes, plus the fact that the user is not removed when the package is removed I would consider a bug. But that's just my humble opinion.

Removing users on package removal is a security risk. This is left up to the user.
https://www.archlinux.org/todo/usergroup-management/

Offline

#6 2015-12-23 04:02:11

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: Homeless mysql user

tom.ty89 wrote:
Scimmia wrote:

Adding untracked dirs is not the answer. Paying attention to those errors when they happen and fixing them is.

I notice that this is the general behaviour/policy of many/most packages here, but I see no reason why we can't have untracked (home) dirs while we have untracked users/groups.

Since users/groups aren't tracked by the package manager, that's a bit of a straw man.

Offline

#7 2015-12-23 06:12:29

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Homeless mysql user

My point is, this isn't about having random untracked dirs, but they are home dirs for the created users which aren't suppose to be tracked, and home dirs and the users in such case should not be decoupled.

Things is they don't get removed anyway once they're filled.

Also think of this, if the created user isn't always expected to be useless and safe to delete, once the package is uninstalled and the empty home dir is gone, we'll possibly end up creating it again manually than cleaning up the user. Also what so bad of having untracked HOME dirs anyway? The users should simply be useradd with -m, and if we consider both of them useless, we can useradd -r when necessary.

Last edited by tom.ty89 (2015-12-23 06:29:04)

Offline

#8 2015-12-23 19:32:56

Regis
Member
Registered: 2013-12-26
Posts: 5

Re: Homeless mysql user

I tend to agree with tom.ty89: home directories are not really untracked, they just aren't tracked by pacman but by /etc/passwd file.

A package creating /var/lib/mysql during install would break the rule of not adding automatically a file to the system that is not tracked by pacman, but this rule is often broken anyway (content of /var/log or even /var/lib is not fully tracked by pacman). Adding another exception for a home directory doesn't seem to be a big issue to me.

The only drawback I see of automatically creating mysql home directory is that the administrator will not be warned that there is a potentially unused user (in case he wants to remove it). But the price to pay for that warning is that 99% of Arch users will have to take some time to understand why they have an error message at boot-up, and create the home directory manually. To put it another way, this package doesn't work out-of-the-box and requires a manual step to be installed properly without polluting the logs with an error.

For the sake of human-kind time saving, I would vote for an automatic directory creation...

Offline

#9 2015-12-24 12:52:08

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Homeless mysql user

AL tends to automate as littlle as possible, adding messages to mariadb .install file seems like a better solution.

post-install could warn users they have to create the datadir themselves.
post-remove could remind them they manually remove the user & folder.

Just create a feature request in AL bugtracker for this.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB