Module install error
licaon-kter opened this issue · comments
$ sudo ejabberdctl module_install mod_cron
Error: error
Error: not_available
Umm then how?
ejabberd HEAD (processone/ejabberd@be60263), Debian Bullseye, arm64, Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 13.1.2
Is it listed in modules_available? Do other modules install correctly, or all fail?
$ ejabberdctl module_install mod_cron
Error: error
Error: not_available
$ ejabberdctl modules_available
$ ejabberdctl modules_update_specs
$ ejabberdctl modules_available
mod_cron Execute scheduled commands
...
$ ejabberdctl module_install mod_cron
Module mod_cron has been installed and started.
It's configured in the file:
/home/vscode/.ejabberd-modules/mod_cron/conf/mod_cron.yml
Configure the module in that file, or remove it
and configure in your main ejabberd.yml
Ok, indeed I missed those two commands.
Available comes up empty, as expected I guess.
But
$ sudo ejabberdctl modules_update_specs
Error: {repository,"https://github.com/processone/ejabberd-contrib",
{error,enoent}}
The default configuration in most cases results in something like this:
$ make relive
...
> ext_mod:modules_dir().
"/home/badlop/.ejabberd-modules"
I try to reproduce the error message you get:
$ sudo mkdir /tmp/onlyroot
$ CONTRIB_MODULES_PATH=/tmp/onlyroot make relive
...
> ext_mod:modules_dir().
"/tmp/onlyroot"
> ext_mod:update().
2022-12-02 16:46:26.767934+01:00 [info] Update packages from repo https://github.com/processone/ejabberd-contrib:
{error, eacces}
{repository,"https://github.com/processone/ejabberd-contrib",
{error,eacces}}
The error messages mean:
eacces:
Missing search or write permissions for the parent directories of Dir.
enoent:
The directory does not exist.
It seems the problem in your case is that the parent dir doesn't exist. So I try setting a path with a parent that doesn't exist... and ext_mod succeeds in creating the parent one correctly:
$ CONTRIB_MODULES_PATH=/tmp/abcdefg make relive
...
> ext_mod:modules_dir().
"/tmp/abcdefg"
> ext_mod:update().
2022-12-02 16:51:57.891321+01:00 [info] Update packages from repo https://github.com/processone/ejabberd-contrib: ok
ok
Some ideas for you to check:
- What's the result of ext_mod:modules_dir() in your case?
- Does ejabberd have write access to that path?
- Can you try setting other values to CONTRIB_MODULES_PATH?
(ejabberd@localhost)1> ext_mod:modules_dir().
"/var/lib/ejabberd/.ejabberd-modules"
I've checked that path before writing
$ sudo -u ejabberd stat /var/lib/ejabberd/
Access: (0750/drwxr-x---) Uid: ( 1001/ejabberd) Gid: ( 1001/ejabberd)
Let's create the folder just in case
$ sudo -u ejabberd mkdir /var/lib/ejabberd/.ejabberd-modules
$ sudo -u ejabberd stat /var/lib/ejabberd/.ejabberd-modules
Access: (0755/drwxr-xr-x) Uid: ( 1001/ejabberd) Gid: ( 1001/ejabberd)
Progress, error changed a bit
$ sudo -u ejabberd ejabberdctl modules_update_specs
Error: {repository,"https://github.com/processone/ejabberd-contrib",
{error,erofs}}
erofs - Read-only file system
I couldn't reproduce that exact error, I guess I didn't yet reproduce your exact case
(ejabberd@localhost)3> file:make_dir("/tmp/asd").
ok
(ejabberd@localhost)4> file:make_dir("/asd").
{error,eacces}
(ejabberd@localhost)5> file:make_dir("/bin/asd").
{error,eacces}
(ejabberd@localhost)8> file:make_dir("/bin/").
{error,eexist}
Anyway, can you try setting other values to CONTRIB_MODULES_PATH? You can set that option in ejabberdctl.cfg.
Set for example to /tmp, does then work? In that case, what username and permissions does the created path have? If you reproduce those permissions in the initial path, does then the command work?