1 (edited by lee.ratanak 2024-07-28 18:39:29)

Topic: can't start iredadmin service

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
a fresh install ubuntu 24.04 running on lxc container and iredmail 1.7.0 using mysql backend and nginx webserver and  installed successfully and i can access sogo and roundcube but fail to access iredadmin. what could be the cause of issue?

root@mail:/# systemctl status iredadmin
x iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/usr/lib/systemd/system/iredadmin.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-07-28 10:08:41 UTC; 27min ago
   Duration: 13ms
    Process: 3278 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 3280 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 3282 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 3284 ExecStart=/usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmi>
    Process: 3286 ExecStopPost=/bin/rm -rf /var/run/iredadmin (code=exited, status=0/SUCCESS)
   Main PID: 3284 (code=exited, status=1/FAILURE)
        CPU: 35ms

Jul 28 10:08:41 mail iredadmin[3284]: setgid() to 2001
Jul 28 10:08:41 mail iredadmin[3284]: setuid() to 2001
Jul 28 10:08:41 mail iredadmin[3284]: chdir() to /opt/www/iredadmin
Jul 28 10:08:41 mail iredadmin[3284]: your processes number limit is 31190
Jul 28 10:08:41 mail iredadmin[3284]: your memory page size is 4096 bytes
Jul 28 10:08:41 mail iredadmin[3284]: detected max file descriptor number: 1024
Jul 28 10:08:41 mail iredadmin[3284]: VirtualHosting mode enabled.
Jul 28 10:08:41 mail iredadmin[3284]: lock engine: pthread robust mutexes
Jul 28 10:08:41 mail iredadmin[3284]: thunder lock: disabled (you can enable it with --thunder-lock)
Jul 28 10:08:41 mail iredadmin[3284]: socket(): Permission denied [core/socket.c line 82]

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: can't start iredadmin service

Please show us command output:

ls -dl /opt/www/iredadmin
ls -dl /opt/www/iRedAdmin*

3

Re: can't start iredadmin service

thank for reply.

root@mail:~# ls -dl /opt/www/iredadmin     
lrwxrwxrwx 1 root root 13 Jul 28 09:56 /opt/www/iredadmin -> iRedAdmin-2.6
root@mail:~# ls -dl /opt/www/iRedAdmin*   
dr-xr-xr-x 13 iredadmin iredadmin 4096 Jul 28 11:49 /opt/www/iRedAdmin-2.6

4

Re: can't start iredadmin service

lee.ratanak wrote:

Jul 28 10:08:41 mail iredadmin[3284]: socket(): Permission denied [core/socket.c line 82]

It reports a permission issue.
Please restart iredadmin service again, then show us FULL log related to this restart.

5

Re: can't start iredadmin service

ZhangHuangbin wrote:
lee.ratanak wrote:

Jul 28 10:08:41 mail iredadmin[3284]: socket(): Permission denied [core/socket.c line 82]

It reports a permission issue.
Please restart iredadmin service again, then show us FULL log related to this restart.

when i try to start the service, there is no pidfile found in /var/run/iredadmin even i try to create manually service still not running.

you can see in attachment files.

Post's attachments

Screenshot 2024-07-30 at 6.34.36 PM.png 513.55 kb, file has never been downloaded. 

Screenshot 2024-07-30 at 6.36.17 PM.png 267.03 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

6

Re: can't start iredadmin service

Same issue here with roughly the same setup (used Postgres instead of MySQL) - Been messing with it for a few days now with no luck.

----
- iRedMail version (check /etc/iredmail-release):  1.7.0
- Deployed with iRedMail Easy or the downloadable installer? Downloadable
- Linux/BSD distribution name and version: Ubuntu 24.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

Looping this in journalctl:

Jul 31 01:18:18 mx uwsgi[158967]: [uWSGI] getting INI configuration from /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini
Jul 31 01:18:18 mx iredadmin[158967]: *** Starting uWSGI 2.0.24-debian (64bit) on [Wed Jul 31 01:18:18 2024] ***
Jul 31 01:18:18 mx iredadmin[158967]: compiled with version: 13.2.0 on 17 April 2024 16:23:48
Jul 31 01:18:18 mx iredadmin[158967]: os: Linux-6.8.8-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.8-2 (2024-06-24T09:00Z)
Jul 31 01:18:18 mx iredadmin[158967]: nodename: mx
Jul 31 01:18:18 mx iredadmin[158967]: machine: x86_64
Jul 31 01:18:18 mx iredadmin[158967]: clock source: unix
Jul 31 01:18:18 mx iredadmin[158967]: pcre jit disabled
Jul 31 01:18:18 mx iredadmin[158967]: detected number of CPU cores: 4
Jul 31 01:18:18 mx iredadmin[158967]: current working directory: /
Jul 31 01:18:18 mx iredadmin[158967]: writing pidfile to /var/run/iredadmin/iredadmin.pid
Jul 31 01:18:18 mx iredadmin[158967]: detected binary path: /usr/bin/uwsgi-core
Jul 31 01:18:18 mx iredadmin[158967]: *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Jul 31 01:18:18 mx iredadmin[158967]: chdir() to /opt/www/iredadmin
Jul 31 01:18:18 mx iredadmin[158967]: your processes number limit is 386201
Jul 31 01:18:18 mx iredadmin[158967]: your memory page size is 4096 bytes
Jul 31 01:18:18 mx iredadmin[158967]: detected max file descriptor number: 1024
Jul 31 01:18:18 mx iredadmin[158967]: VirtualHosting mode enabled.
Jul 31 01:18:18 mx iredadmin[158967]: lock engine: pthread robust mutexes
Jul 31 01:18:18 mx iredadmin[158967]: thunder lock: disabled (you can enable it with --thunder-lock)
Jul 31 01:18:18 mx iredadmin[158967]: socket(): Permission denied [core/socket.c line 82]
Jul 31 01:18:18 mx systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
Jul 31 01:18:18 mx systemd[1]: iredadmin.service: Failed with result 'exit-code'.

-----

Things tried:

  • A multitude of setcap commands on uwsgi binary, python binary, and the python script for iredadmin.  None of this lead to the service starting up.

  • Changing /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini to change the socket from a port number to a unix socket (ex: /tmp/iredadmin.sock) -- This caused the service to properly start -- but I didn't want to move it over to a unix socket and then have issues in the future with updates.

7

Re: can't start iredadmin service

Ensure that the configuration files for iRedAdmin are correct and not corrupted. The main configuration file is typically located at /opt/iredadmin/settings.py. Verify that all necessary settings such as database connection details are correctly configured.

8

Re: can't start iredadmin service

The plot thickens... the file isn't even there.  The folder iredadmin isn't in /opt/ either.

# less /opt/iredadmin/settings.py
/opt/iredadmin/settings.py: No such file or directory

Interesting.  The only other ~default setting I changed during setup was that I skipped installing netdata.  Going to try a fresh install just accepting all defaults tomorrow to see if this behavior persists.

9

Re: can't start iredadmin service

It's /opt/www/iredadmin/settings.py.

10

Re: can't start iredadmin service

The settings file is there.  It looks fine.  The fact that the service starts fine if you simply change the socket setting in the debian.ini file from a port to a unix socket is telling us something, just not entirely sure what that something is.

11

Re: can't start iredadmin service

Reinstalled with almost entirely default settings (no sogo, kept netdata) and the service still isn't starting.

Other environmental facts:
Proxmox
Ubuntu 24.04 LXC image


This same environment is running another instance of iRedMail from a while back that started on Ubuntu 20.04 (again from a LXC image) and initially installed iRedMail 1.6.0 and upgraded over time to 1.6.8.

Even with different hostnames for the containers, I tried shutting off/removing the existing server (I just restored it on a completely different environment, tested recovery procedures for good measure!) to make sure there wasn't some strange configuration underlying the problem and that doesn't seem to be the case.

12

Re: can't start iredadmin service

w0k wrote:

Reinstalled with almost entirely default settings (no sogo, kept netdata) and the service still isn't starting.

Other environmental facts:
Proxmox
Ubuntu 24.04 LXC image


This same environment is running another instance of iRedMail from a while back that started on Ubuntu 20.04 (again from a LXC image) and initially installed iRedMail 1.6.0 and upgraded over time to 1.6.8.

Even with different hostnames for the containers, I tried shutting off/removing the existing server (I just restored it on a completely different environment, tested recovery procedures for good measure!) to make sure there wasn't some strange configuration underlying the problem and that doesn't seem to be the case.

the same issue here as well while ubuntu 22.04 work just fine.

13

Re: can't start iredadmin service

iRedAdmin works fine on a normal Ubuntu 24.04 OS.
It reports "socket(): Permission denied [core/socket.c line 82]", not sure whether it's a LXC issue in this case. But i don't have LXC environment for reproducing this issue.

14

Re: can't start iredadmin service

ZhangHuangbin wrote:

iRedAdmin works fine on a normal Ubuntu 24.04 OS.
It reports "socket(): Permission denied [core/socket.c line 82]", not sure whether it's a LXC issue in this case. But i don't have LXC environment for reproducing this issue.

Testing on Proxmox running ubuntu 24.04 vm, iredadmin service work just fine.

15

Re: can't start iredadmin service

但是我通过浏览器无法访问
报错:internal server error

Post's attachments

222.png 139.04 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

16

Re: can't start iredadmin service

welsper.jer wrote:

但是我通过浏览器无法访问
报错:internal server error

访问出错时,这几个日志文件里有什么相关错误?

/var/log/maillog
/var/log/syslog
/var/log/messages

17

Re: can't start iredadmin service

I believe we're running into issues with new defaults for AppArmor.  The concerns at the link below sounds quite similar and is the avenue I'm researching now as a possible root cause.

Unfortunately my account can't post external links.  You can simply google this term "lxc 24.04 uwsgi" and you'll find a forum post on LWN about apparmor profiles causing issues.

Investigating further...

18 (edited by w0k 2024-08-04 13:57:54)

Re: can't start iredadmin service

A confirmation that this has to do with the default apparmor profile for uwsgi that ships with the LXC image for Ubuntu 24.04 (trimmed to just the commands and the service output for clarity):

# apt install apparmor-utils
# aa-complain /etc/apparmor.d/uwsgi-core
# systemctl restart iredadmin
# systemctl status iredadmin
* iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/usr/lib/systemd/system/iredadmin.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-08-04 05:52:24 UTC; 1s ago
    Process: 303676 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 303678 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 303680 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
   Main PID: 303682 (uwsgi)
      Tasks: 6 (limit: 115860)
     Memory: 23.7M (peak: 24.8M)
        CPU: 370ms
     CGroup: /system.slice/iredadmin.service
             |-303682 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>
             |-303684 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>
             |-303685 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>
             |-303686 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>
             |-303687 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>
             `-303688 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/>

Aug 04 05:52:24 mx systemd[1]: Starting iredadmin.service - iRedAdmin daemon service...
Aug 04 05:52:24 mx systemd[1]: Started iredadmin.service - iRedAdmin daemon service.

Not necessarily recommending ignoring the uwsgi apparmor configuration, just need to investigate what configuration is required to allow the port to bind.

19

Re: can't start iredadmin service

Does it work if you disable apparmor service?

20 (edited by w0k 2024-08-06 08:56:52)

Re: can't start iredadmin service

ZhangHuangbin wrote:

Does it work if you disable apparmor service?

I didn't try disabling apparmor entirely.  I simply moved the uwsgi-core profile into complain instead of enforce mode and everything seems to work just fine.  Probably need to build a proper profile for it, but after review, and for my own needs, this is probably fine since I don't expose iredadmin to the internet.

# apt install apparmor-utils
# aa-complain /etc/apparmor.d/uwsgi-core
# systemctl restart iredadmin