FS#54077 - package prosody not working due to bad install folder permission.
Attached to Project:
Community Packages
Opened by social loser (socialloser1) - Tuesday, 16 May 2017, 08:01 GMT
Last edited by Sergej Pupykin (sergej) - Monday, 02 October 2017, 17:01 GMT
Opened by social loser (socialloser1) - Tuesday, 16 May 2017, 08:01 GMT
Last edited by Sergej Pupykin (sergej) - Monday, 02 October 2017, 17:01 GMT
|
Details
Description:
package prosody not working due to bad permission of installing folder. prosody installation contains a folder '/var/lib/prosody' with permission 750. the command to add user "prosodyctl adduser" won't work with this setting, even running this command as root. it seems this command utilize another process to do this, which is not running as root. (just my guess, prosody is written with lua, which I can not read ) Steps to reproduce: 1, install prosody package 2, run command 'prosodyctl adduser test@localhost' |
This task depends upon
say, my current login user is 'tom',
there are several problems, all with the permission of '/var/lib/prosody/' folder:
1, a clear installation will create this folder with ownership of root, and permission 750
at this time , running 'prosodyctl adduser' will fail. the reason cause this is this command is running as user 'tom', it tries to create file owned by 'tom' and it fails.
if you run 'prosodyctl adduser' with root, the created file is not readable by the server process.
2, if change permission to 777, then user can be added , but the user file created is not readable by the server daemon, so even you add the user successfully , you still can't log in.
3, you have to manually change the permission of user data files created by 'prosodyctl adduser' command to be readable by others. at this time, it works. but further 'adduser' command still create wrong permission(or ownership).
However they are only created by systemd-sysusers.hook which runs at the end of the transaction after the install script and the prosody user has no defined uid so can not be referenced by uid.
you can see that system users is created once the conf file is installed to sysusers.d folder. so when post_install is running , the user has already been created. chown will work.
$ getent passwd prosody
$ getent group jabber
$ cat prosody.install
post_install() {
chown prosody:jabber /var/lib/prosody
echo ">> Documentation: http://wiki.archlinux.org/index.php/Prosody"
echo ">> Probably you need to do 'chown prosody:jabber /var/lib/prosody'"
}
post_upgrade() {
post_install $1
}
post_remove() {
paths=(/etc/prosody /var/lib/prosody /var/log/prosody
/var/log/old/prosody)
first=true
for path in ${paths[@]}; do
if [ -d $path ]; then
if $first; then
first=false
echo "==> Leftover Paths:"
fi
echo "==> $path"
fi
done
}
$ sudo pacman -U prosody-1\:0.10.r7198+.2fd20f372cb1+-2-x86_64.pkg.tar.xz
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (5) lua51-5.1.5-6 lua51-expat-1.3.0-3 lua51-filesystem-1.6.3-3
lua51-socket-20160311-1 prosody-1:0.10.r7198+.2fd20f372cb1+-2
Total Installed Size: 2.42 MiB
:: Proceed with installation? [Y/n] y
(5/5) checking keys in keyring [######################] 100%
(4/5) checking package integrity [######################] 100%
(4/5) loading package files [######################] 100%
(5/5) checking for file conflicts [######################] 100%
(5/5) checking available disk space [######################] 100%
:: Processing package changes...
(1/5) installing lua51 [######################] 100%
(2/5) installing lua51-socket [######################] 100%
(3/5) installing lua51-expat [######################] 100%
(4/5) installing lua51-filesystem [######################] 100%
(5/5) installing prosody [######################] 100%
chown: invalid user: ‘prosody:jabber’
>> Documentation: http://wiki.archlinux.org/index.php/Prosody
>> Probably you need to do 'chown prosody:jabber /var/lib/prosody'
Optional dependencies for prosody
lua51-sec: TLS encryption support
lua51-bitop: websocket support
lua51-event: libevent support
lua51-dbi: SQL storage support
:: Running post-transaction hooks...
(1/3) Updating system user accounts...
(2/3) Creating temporary files...
(3/3) Arming ConditionNeedsUpdate...
Note the chown failure. A tmpfiles.d entry might work but you are required to read pacman's output which instructs you to manually perform the action anyway which you appear to have ignored.
See how aur/prosody-hg does it.
d /var/lib/prosody 0750 prosody jabber -
Also appears to work and avoids running systemd-sysusers on a per package basis.
Does that change work for you on a clean install / clean-chroot?
Edit: Change permissions from 0755 to 0750 to match existing permissions only changing the ownership
aren't directories created by 'tmpfiles.d' file will be deleted with reboot? prosody use '/var/lib/prosody' to storage pesistent informations, user account, password, etc.
even this directory is persistent, it is called "tmp", but while calling the configure script, it is called "datadir" ("--datadir=/var/lib/prosody"). I always feel such kind of workaround a little frustrating.
d /var/lib/prosody 0750 prosody jabber -
to tmpfile. It creates /var/lib/prosody with rwxr-x--- and prosody:jabber