1 (edited by Alxpv 2019-02-13 18:12:45)

Topic: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Yes
- Linux/BSD distribution name and version: Ubuntu16.04LTS i386
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- 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.
====

Hello, I installed iRedMail completely and everything was ok, so I switched all our mail to that server. But then we decided to install another application that re-wrote Nginx config for sites-available (& enabled). Of course, no backup was made smile We restored everything related to work with php section (we use 5.6 for old cms & 7.2 for everything else including Roundcube) through unix socket

Any my nginx config caused errors - 502, then Internal Server Error, etc. The problem seems to be in socket - I am unable to find normal config or manual on how to setup python app to work under nginx.

Restarting of iredadmin service caused failure. So now I need to reinstall and re-configure manually iRedAdmin console.
Please advise on any manual / procedure description on how to return it back to life.

Current iRedAdmin service status:
sudo service iredadmin status
● iredadmin.service - iRedAdmin daemon service
   Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-02-12 18:28:42 MSK; 18h ago
  Process: 31140 ExecStopPost=/bin/rm -rf /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 31138 ExecStop=/usr/bin/uwsgi --stop /var/run/iredadmin/iredadmin.pid (code=exited, status=255)
  Process: 31136 ExecStart=/usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid (code=exited, status=1/FAILURE)
  Process: 31132 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 31130 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 31127 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
Main PID: 31136 (code=exited, status=1/FAILURE)

feb 12 18:28:42 mail.* uwsgi[31136]: detected binary path: /usr/bin/uwsgi-core
feb 12 18:28:42 mail.* uwsgi[31136]: setgid() to 2001
feb 12 18:28:42 mail.* uwsgi[31136]: setuid() to 2001
feb 12 18:28:42 mail.* uwsgi[31136]: chdir() to /opt/www/iredadmin
feb 12 18:28:42 mail.* uwsgi[31136]: chdir(): Permission denied [core/uwsgi.c line 2586]
feb 12 18:28:42 mail.* systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
feb 12 18:28:42 mail.* uwsgi[31138]: signal_pidfile()/kill(): No such process [core/uwsgi.c line 1654]
feb 12 18:28:42 mail.* systemd[1]: iredadmin.service: Control process exited, code=exited status=255
feb 12 18:28:42 mail.* systemd[1]: iredadmin.service: Unit entered failed state.
feb 12 18:28:42 mail.* systemd[1]: iredadmin.service: Failed with result 'exit-code'.

----

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

2

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Alxpv wrote:

feb 12 18:28:42 mail.* uwsgi[31136]: chdir() to /opt/www/iredadmin
feb 12 18:28:42 mail.* uwsgi[31136]: chdir(): Permission denied [core/uwsgi.c line 2586]

Commands below should fix it:

chown -R iredadmin:iredadmin /opt/www/iRedAdmin-*
chmod -R 0555 /opt/www/iRedAdmin-*
service iredadmin restart

3 (edited by Alxpv 2019-02-14 16:02:44)

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Hello,

iredadmin app is located in folder /opt/www/iredadmin, so i modified commands accordingly

This commands was applied, but nothing happens - still getting error:

sudo service iredadmin status
● iredadmin.service - iRedAdmin daemon service
   Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-02-14 10:53:24 MSK; 5s ago
  Process: 2343 ExecStopPost=/bin/rm -rf /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 2340 ExecStop=/usr/bin/uwsgi --stop /var/run/iredadmin/iredadmin.pid (code=exited, status=255)
  Process: 2337 ExecStart=/usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid (code=exited, status=1/FAILURE)
  Process: 2334 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 2329 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 2326 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
Main PID: 2337 (code=exited, status=1/FAILURE)

фев 14 10:53:24 mail.ab-group.net uwsgi[2337]: os: Linux-4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:19 UTC 2019
Feb 14 10:53:24 mail.* uwsgi[2337]: nodename: mail.*
Feb 14 10:53:24 mail.* uwsgi[2337]: machine: i686
Feb 14 10:53:24 mail.* uwsgi[2337]: clock source: unix
Feb 14 10:53:24 mail.* uwsgi[2337]: pcre jit disabled
Feb 14 10:53:24 mail.* systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 10:53:24 mail.* uwsgi[2340]: signal_pidfile()/kill(): No such process [core/uwsgi.c line 1654]
Feb 14 10:53:24 mail.* systemd[1]: iredadmin.service: Control process exited, code=exited status=255
Feb 14 10:53:24 mail.* systemd[1]: iredadmin.service: Unit entered failed state.
Feb 14 10:53:24 mail.* systemd[1]: iredadmin.service: Failed with result 'exit-code'.

Maybe should modifi uwsgi config (/usr/share/uwsgi/confdefault.ini) with some permissions?

#set mode of created unix socket
chmod-socket = 664 -> to 666?

4

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

journalctl -xe
-- The start-up result is done.
Feb 14 11:09:50 mail.* sudo[3018]: pam_unix(sudo:session): session closed for user root
Feb 14 11:09:50 mail.* uwsgi[3039]: [uWSGI] getting INI configuration from /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini
Feb 14 11:09:50 mail.* uwsgi[3039]: *** Starting uWSGI 2.0.12-debian (32bit) on [Thu Feb 14 11:09:50 2019] ***
Feb 14 11:09:50 mail.* uwsgi[3039]: compiled with version: 5.4.0 20160609 on 28 September 2018 15:58:56
Feb 14 11:09:50 mail.* uwsgi[3039]: os: Linux-4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:19 UTC 2019
Feb 14 11:09:50 mail.* uwsgi[3039]: nodename: mail.*
Feb 14 11:09:50 mail.* uwsgi[3039]: machine: i686
Feb 14 11:09:50 mail.* uwsgi[3039]: clock source: unix
Feb 14 11:09:50 mail.* uwsgi[3039]: pcre jit disabled
Feb 14 11:09:50 mail.* uwsgi[3039]: detected number of CPU cores: 2
Feb 14 11:09:50 mail.* uwsgi[3039]: current working directory: /
Feb 14 11:09:50 mail.* uwsgi[3039]: writing pidfile to /var/run/iredadmin/iredadmin.pid
Feb 14 11:09:50 mail.* uwsgi[3039]: detected binary path: /usr/bin/uwsgi-core
Feb 14 11:09:50 mail.* uwsgi[3039]: setgid() to 2001
Feb 14 11:09:50 mail.* uwsgi[3039]: setuid() to 2001
Feb 14 11:09:50 mail.* uwsgi[3039]: chdir() to /opt/www/iredadmin
Feb 14 11:09:50 mail.* uwsgi[3039]: chdir(): Permission denied [core/uwsgi.c line 2586]
Feb 14 11:09:50 mail.* systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 11:09:50 mail.* uwsgi[3042]: signal_pidfile()/kill(): No such process [core/uwsgi.c line 1654]
Feb 14 11:09:50 mail.* systemd[1]: iredadmin.service: Control process exited, code=exited status=255
Feb 14 11:09:51 mail.* systemd[1]: iredadmin.service: Unit entered failed state.
Feb 14 11:09:51 mail.* systemd[1]: iredadmin.service: Failed with result 'exit-code'.

5

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Alxpv wrote:

iredadmin app is located in folder /opt/www/iredadmin, so i modified commands accordingly

You got it wrong, do not modify the commands i wrote in previous reply.

/opt/www/iredadmin (in lower cases) is a symbol link to /opt/www/iRedAdmin-0.9.4 (the version number may be different on your server), so we need to change owner/permission on iRedAdmin-0.9.4 instead, not /opt/www/iredadmin.

6

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

ZhangHuangbin wrote:
Alxpv wrote:

iredadmin app is located in folder /opt/www/iredadmin, so i modified commands accordingly

You got it wrong, do not modify the commands i wrote in previous reply.

/opt/www/iredadmin (in lower cases) is a symbol link to /opt/www/iRedAdmin-0.9.4 (the version number may be different on your server), so we need to change owner/permission on iRedAdmin-0.9.4 instead, not /opt/www/iredadmin.

Well, I renamed iRedAdmin-0.9.4 to just 'iredadmin' earlier and removed symlink
Now I tried to make an upgrade of iRedAdmin, re-created symlink and got folder iRedAdmin-0.9.4

But after sudo permissions was set, it returns an error anyway:

iRedAdmin daemon service
   Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Чт 2019-02-14 12:22:21 MSK; 6s ago
  Process: 8154 ExecStopPost=/bin/rm -rf /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 8152 ExecStop=/usr/bin/uwsgi --stop /var/run/iredadmin/iredadmin.pid (code=exited, status=255)
  Process: 8148 ExecStart=/usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid (code=exited, status=1/FA
  Process: 8146 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 8143 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 8139 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
Main PID: 8148 (code=exited, status=1/FAILURE)

Feb 14 12:22:20 mail.* systemd[1]: Starting iRedAdmin daemon service...
Feb 14 12:22:21 mail.* systemd[1]: Started iRedAdmin daemon service.
Feb 14 12:22:21 mail.* uwsgi[8148]: [uWSGI] getting INI configuration from /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini
Feb 14 12:22:21 mail.* uwsgi[8148]: *** Starting uWSGI 2.0.12-debian (32bit) on [Thu Feb 14 12:22:21 2019] ***
Feb 14 12:22:21 mail.* systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 12:22:21 mail.* uwsgi[8152]: signal_pidfile()/kill(): No such process [core/uwsgi.c line 1654]
Feb 14 12:22:21 mail.* systemd[1]: iredadmin.service: Control process exited, code=exited status=255
Feb 14 12:22:21 mail.* systemd[1]: iredadmin.service: Unit entered failed state.
Feb 14 12:22:21 mail.* systemd[1]: iredadmin.service: Failed with result 'exit-code'.

7

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Any relevant error in /var/log/syslog right after you restarted iredadmin service?

8

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

ZhangHuangbin wrote:

Any relevant error in /var/log/syslog right after you restarted iredadmin service?

Hello,

It still says permission error
I don't know which permissions it needs more, I changed all according earlier instruction

ZhangHuangbin wrote:

chown -R iredadmin:iredadmin /opt/www/iRedAdmin-*
chmod -R 0555 /opt/www/iRedAdmin-*
service iredadmin restart

Log:

Feb 19 09:46:33 mail systemd[1]: Stopped iRedAdmin daemon service.
Feb 19 09:46:33 mail systemd[1]: Starting iRedAdmin daemon service...
Feb 19 09:46:33 mail systemd[1]: Started iRedAdmin daemon service.
Feb 19 09:46:33 mail uwsgi[24543]: [uWSGI] getting INI configuration from /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini
Feb 19 09:46:33 mail uwsgi: *** Starting uWSGI 2.0.12-debian (32bit) on [Tue Feb 19 09:46:33 2019] ***
Feb 19 09:46:33 mail uwsgi: compiled with version: 5.4.0 20160609 on 28 September 2018 15:58:56
Feb 19 09:46:33 mail uwsgi: os: Linux-4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:19 UTC 2019
Feb 19 09:46:33 mail uwsgi: nodename: mail.*
Feb 19 09:46:33 mail uwsgi: machine: i686
Feb 19 09:46:33 mail uwsgi: clock source: unix
Feb 19 09:46:33 mail uwsgi: pcre jit disabled
Feb 19 09:46:33 mail uwsgi: detected number of CPU cores: 2
Feb 19 09:46:33 mail uwsgi: current working directory: /
Feb 19 09:46:33 mail uwsgi: writing pidfile to /var/run/iredadmin/iredadmin.pid
Feb 19 09:46:33 mail uwsgi: detected binary path: /usr/bin/uwsgi-core
Feb 19 09:46:33 mail uwsgi: setgid() to 2001
Feb 19 09:46:33 mail uwsgi: setuid() to 2001
Feb 19 09:46:33 mail uwsgi: chdir() to /opt/www/iredadmin
Feb 19 09:46:33 mail uwsgi: chdir(): Permission denied [core/uwsgi.c line 2586]
Feb 19 09:46:33 mail systemd[1]: iredadmin.service: Main process exited, code=exited, status=1/FAILURE
Feb 19 09:46:33 mail uwsgi[24548]: signal_pidfile()/kill(): No such process [core/uwsgi.c line 1654]
Feb 19 09:46:33 mail systemd[1]: iredadmin.service: Control process exited, code=exited status=255
Feb 19 09:46:33 mail systemd[1]: iredadmin.service: Unit entered failed state.
Feb 19 09:46:33 mail systemd[1]: iredadmin.service: Failed with result 'exit-code'.

9

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Possible to give me direct ssh access with root privilege to take a look?
Contact me: zhb _at_ iredmail.org

10

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

Fixed, caused by incorrect file permission of its parent directory /opt/www.
It was owned by 'www-data:www-data' with permission 0770, should be owned by "root:root" with 0755.

11

Re: iRedAdmin - lost nginx config, reinstall of ONLY iredadmin possible?

ZhangHuangbin wrote:

Fixed, caused by incorrect file permission of its parent directory /opt/www.
It was owned by 'www-data:www-data' with permission 0770, should be owned by "root:root" with 0755.

Perfect, many thanks!