Job failed because the control process exited with error code

Job for postgresql.service failed because the control process exited with error code

Очень часто данная ошибка возникает вследствии того, что не была инициализирована база данных.

Например, вы выполнили

sudo systemctl start postgresql

Job for postgresql.service failed because the control process exited with error code. See «systemctl status postgresql.service» and «journalctl -xe» for details.

systemctl status -l postgresql.service

● postgresql.service — PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2021-06-09 12:10:31 EEST; 1min 18s ago Process: 7223 ExecStartPre=/usr/bin/postgresql-check-db-dir $ (code=exited, status=1/FAILURE) Jun 09 12:10:31 localhost.localdomain systemd[1]: Starting PostgreSQL database server. Jun 09 12:10:31 localhost.localdomain systemd[1]: postgresql.service: control process exited, code=exited status=1 Jun 09 12:10:31 localhost.localdomain systemd[1]: Failed to start PostgreSQL database server. Jun 09 12:10:31 localhost.localdomain systemd[1]: Unit postgresql.service entered failed state. Jun 09 12:10:31 localhost.localdomain systemd[1]: postgresql.service failed.

Попробуйте выполнить инициализацию базы данных (из под пользователя postgres)

Initializing database . OK

sudo systemctl start postgresql
systemctl status postgresql.service

● postgresql.service — PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2021-06-09 12:22:00 EEST; 12s ago Process: 7741 ExecStart=/usr/bin/pg_ctl start -D $ -s -o -p $ -w -t 300 (code=exited, status=0/SUCCESS) Process: 7734 ExecStartPre=/usr/bin/postgresql-check-db-dir $ (code=exited, status=0/SUCCESS) Main PID: 7746 (postgres) Tasks: 7 CGroup: /system.slice/postgresql.service ├─7746 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432 ├─7749 postgres: logger process ├─7751 postgres: checkpointer process ├─7752 postgres: writer process ├─7753 postgres: wal writer process ├─7754 postgres: autovacuum launcher process └─7755 postgres: stats collector process Jun 09 12:21:59 localhost.localdomain systemd[1]: Starting PostgreSQL database server. Jun 09 12:22:00 localhost.localdomain systemd[1]: Started PostgreSQL database server.

Конечно, источник ошибки может быть совершенно другим.

Часто помогает разобраться status. Желательно выйти из пользователя postgres и выполнить от вашего обычного пользователя

systemctl status postgresql.service

Из полученной информации можно сделать выводы о причинах проблемы

● postgresql.service — PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2021-06-10 01:29:02 EEST; 49s ago Process: 12977 ExecStart=/usr/bin/pg_ctl start -D $ -s -o -p $ -w -t 300 (code=exited, status=1/FAILURE) Process: 12970 ExecStartPre=/usr/bin/postgresql-check-db-dir $ (code=exited, status=0/SUCCESS) Jun 10 01:29:01 host.andrei.com systemd[1]: Starting PostgreSQL database server. Jun 10 01:29:01 host.andrei.com pg_ctl[12977]: pg_ctl: another server might be running; trying to start server anyway Jun 10 01:29:01 host.andrei.com pg_ctl[12977]: LOG: syntax error in file «/var/lib/pgsql/data/postgresql.conf» line 192, near token «/» Jun 10 01:29:01 host.andrei.com pg_ctl[12977]: FATAL: configuration file «/var/lib/pgsql/data/postgresql.conf» contains errors Jun 10 01:29:02 host.andrei.com systemd[1]: postgresql.service: control process exited, code=exited status=1 Jun 10 01:29:02 host.andrei.com systemd[1]: Failed to start PostgreSQL database server. Jun 10 01:29:02 host.andrei.com systemd[1]: Unit postgresql.service entered failed state. Jun 10 01:29:02 host.andrei.com systemd[1]: postgresql.service failed.

Расположение конфигурационного файла postgresql.conf можно получить выполнив

-bash-4.2$ su — postgres -c «psql -c ‘SHOW config_file;'»

Password: config_file ————————————- /var/lib/pgsql/data/postgresql.conf (1 row)

Теперь нужно подставить полученный вами результат в vi

Читайте также:  Как влияет прошивка на ниву шевроле

И исправить ошибку

Ещё один пример

● postgresql.service — PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2021-06-10 01:33:42 EEST; 28s ago Process: 13262 ExecStart=/usr/bin/pg_ctl start -D $ -s -o -p $ -w -t 300 (code=exited, status=1/FAILURE) Process: 13257 ExecStartPre=/usr/bin/postgresql-check-db-dir $ (code=exited, status=0/SUCCESS) Jun 10 01:33:41 host.andrei.com systemd[1]: Starting PostgreSQL database server. Jun 10 01:33:41 host.andrei.com pg_ctl[13262]: pg_ctl: another server might be running; trying to start server anyway Jun 10 01:33:41 host.andrei.com pg_ctl[13262]: LOG: invalid value for parameter «wal_level»: «replica» Jun 10 01:33:41 host.andrei.com pg_ctl[13262]: HINT: Available values: minimal, archive, hot_standby. Jun 10 01:33:41 host.andrei.com pg_ctl[13262]: FATAL: configuration file «/var/lib/pgsql/data/postgresql.conf» contains errors Jun 10 01:33:42 host.andrei.com systemd[1]: postgresql.service: control process exited, code=exited status=1 Jun 10 01:33:42 host.andrei.com systemd[1]: Failed to start PostgreSQL database server. Jun 10 01:33:42 host.andrei.com systemd[1]: Unit postgresql.service entered failed state. Jun 10 01:33:42 host.andrei.com systemd[1]: postgresql.service failed.

Снова ошибка в файле postgresql.conf значение параметра wal_level не допустимо для текущей версии PostgreSQL

Для 9.2 можно выбирать из minimal, archive и hot_standby

И заменить replica на hot_standby

Ещё один пример

● postgresql.service — PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2021-06-10 01:43:39 EEST; 6s ago Process: 13625 ExecStart=/usr/bin/pg_ctl start -D $ -s -o -p $ -w -t 300 (code=exited, status=1/FAILURE) Process: 13620 ExecStartPre=/usr/bin/postgresql-check-db-dir $ (code=exited, status=0/SUCCESS) Jun 10 01:43:38 host.andrei.com systemd[1]: Starting PostgreSQL database server. Jun 10 01:43:38 host.andrei.com pg_ctl[13625]: pg_ctl: another server might be running; trying to start server anyway Jun 10 01:43:38 host.andrei.com pg_ctl[13625]: FATAL: lock file «postmaster.pid» already exists Jun 10 01:43:38 host.andrei.com pg_ctl[13625]: HINT: Is another postmaster ( PID 25489 ) running in data directory «/var/lib/pgsql/data»? Jun 10 01:43:39 host.andrei.com systemd[1]: postgresql.service: control process exited, code=exited status=1 Jun 10 01:43:39 host.andrei.com systemd[1]: Failed to start PostgreSQL database server. Jun 10 01:43:39 host.andrei.com systemd[1]: Unit postgresql.service entered failed state. Jun 10 01:43:39 host.andrei.com systemd[1]: postgresql.service failed.

Запущен ещё как минимум один сервер.

Проверить, что сейчас в postmaster.pid можно командой

25489 /var/lib/pgsql/data 1623237280 5432 /var/run/postgresql localhost 5432001 45

Также можно поискать postgres в выдаче ps

ps -A | grep postgres

25489 pts/1 00:00:00 postgres 25490 ? 00:00:00 postgres 25492 ? 00:00:00 postgres 25493 ? 00:00:00 postgres 25494 ? 00:00:00 postgres 25495 ? 00:00:01 postgres 25496 ? 00:00:00 postgres

Источник

Ошибка запуска Nginx

Немогу стартануть «service nginx start» — выводит сообщение :

Job for nginx.service failed because the control process exited with error code. See «systemctl status nginx.service» and «journalctl -xe» for details.

Запускаю «systemctl status nginx.service» — выводит:

  • nginx.service — LSB: nginx init.d dash script for Ubuntu or other *nix.
  • Loaded: loaded (/etc/init.d/nginx; generated) Active: failed (Result: exit-code) since Sat 2019-06-29 22:12:09 EEST; 2min 34s ago
  • Docs: man:systemd-sysv-generator(8) Process: 5502 ExecStart=/etc/init.d/nginx start (code=exited, status=4)
  • Jun 29 22:12:09 529a.l.hostens.cloud systemd[1]: Starting LSB: nginx init.d dash script for Ubuntu or other *nix.
  • Jun 29 22:12:09 529a.l.hostens.cloud nginx[5502]: /etc/init.d/nginx: You don’t have permissions to execute nginx.
  • Jun 29 22:12:09 529a.l.hostens.cloud systemd[1]: nginx.service: Control process exited, code=exited status=4
  • Jun 29 22:12:09 529a.l.hostens.cloud systemd[1]: nginx.service: Failed with result ‘exit-code’.
  • Jun 29 22:12:09 529a.l.hostens.cloud systemd[1]: Failed to start LSB: nginx init.d dash script for Ubuntu or other *nix..

—- Жду любых предложений. Привет всему сообществу и с первым сообщением меня, сижу тут 7 лет, а привет говорю только сейчас 🙂

Читайте также:  Error loading xml document

Источник

ProgrammerAH

Programmer Guide, Tips and Tutorial

[Solved] Job for network.service failed because the control process exited with error code. See “systemctl st

Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.

1、 The xshell is down and the reconnection failed. First Ping to see if the network is connected. Second, restart the network service and find an error. Third, view the error information according to the prompt. Fourth, solutions. First, check whether the configuration file is wrong. Second, there may be a conflict with the network manager service. Just close the service directly

3. If the two methods 1 and 2 still fail, try to delete all the other irrelevant network card location files under/etc/sysconfig/network scripts to avoid unnecessary influence. 5. Verify the network

Standby for a while, found that xshell connection failed, found that network connection failed, and restart failed.

1、 The xshell is down and the reconnection failed. Ping first to see if the network is connected

2、 Restart the network service and find an error

3、 Check the error information according to the prompt

1. Check whether the configuration file is wrong

2. There may be a conflict with the NetworkManager service. Just close the service directly

3. If both methods 1 and 2 fail after verification, try to delete all other irrelevant network card location files under/etc/sysconfig/network scripts to avoid unnecessary influence

Источник

How fix permanently: Job for mysql.service failed because the control process exited with error code

I am working with Ubuntu 18.04 and MySQL Server — 8.0.18

Suddenly today MySQL can’t start anymore

With the sudo service mysql status command appears:

With the sudo service mysql restart command appears:

Following and executing the two suggested commands:

  • systemctl status mysql.service
  • journalctl -xe

Therefore: sudo systemctl status mysql.service

And with journalctl -xe

I followed the solution about this post:

I used the innodb_force_recovery = 10 (ten), it playing, because with 1 and 2 did not work

Therefore with the sudo systemctl start mysql command is possible start the server. I can see all the data and users saved in peace.

Now through the sudo systemctl status mysql command I get

Until this point would has no sense this post, but if I do either Alpha or Beta steps:

the same problem happens again.

Therefore now is mandatory keep the innodb_force_recovery = 10 , otherwise it returns to the same problem

Warning:

The correct range is from 1 to 6, I am assuming 10 is «interpreted» how the maximum value (6)

Is there a way to configure something and remove innodb_force_recovery ? It to return to the normal or old configuration where all worked fine (without innodb_force_recovery )

Note the final content of /var/log/mysql/error.log is

I am working with VirtualBox — Ubuntu is a guest. It had been working for more of 3 months, now suddenly this situation appeared.

More Info:

One

As requested desertangels

Two

Executing cat /etc/mysql/mysql.conf.d/mysqld.cnf

Three

BTW: just in case, with mysql -u root -p appears:

Читайте также:  Магнитола junsun 8227l прошивка

Источник

Apache not able to restart

Trying to restart apache from terminal using the following command:

When executing that command, I’m getting below error:

On excuting «systemctl status apache2.service» I get this output:

12 Answers 12

There is some syntax error in the file apache2.conf .

In a terminal, type:

It will show you where is the error in the apache2.conf file to correct.

Maybe this will help to find the cause:

In my case it was a mistake in the configuration file:

The problem is because some configuration files are deleted, you have to reinstall it.

To replace configuration files that have been deleted, without purging the package, you can do:

To fully remove the apache2 config files, you should:

which will then let you reinstall it in the usual way with:

Purge is required to remove all the config files — if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.

Then REINSTALL PHP5:

To fully remove the apache2 config files, you should:

1) sudo apt-get purge apache2

which will then let you reinstall it in the usual way with:

2) sudo apt-get install apache2

I got the same error after removing a virtual host. The problem was the lingering SSL conf file associated with that host located in /etc/apache2/sites-enabled . The SSL was through Let’s Encrypt so the code for me to remove was:

you most likely have a syntax error. for me it was in my ‘sites-enabled’ folder.

i mis-spelled ‘ServerAlias’ to ‘ServerAlisa’.

I got the Same errors While working with .htaccess

I just put this command

in /etc/apache2/sites-enabled/000-default.conf this folder

after adding this i have getting the error

then i delete these peace of command from the file and my error has resolved.

This is mostly a configuration error. I just now had an old site enabled on apache, what caused this error. So I had to disable it before reloading apache.

Thank you for your help! I was able to install correctly with Solution:

To fully remove the apache2 config files, you should:

sudo apt-get purge apache2 which will then let you reinstall it in the usual way with:

sudo apt-get install apache 2

It now works fine.

I think the problem is that you have some site enabled but you deleted its configuration file. Try disabling the site with sudo a2dissite «name» and then restart apache server. At least this was the problem for me and this action solved it.

In my case, the error started to appear after doing apt upgrade . After playing a lot I went to following directories to see what I can disable.

  • /etc/apache2/mods-enabled — a2dismod (to turn back on a2enconf )
  • /etc/apache2/conf-enabled — a2disconf (to turn back on a2enconf )

In my case, I had to those MODS enabled.

It seems that apt-upgrade must have removed/broken php7.2 because as soon as I disabled it and restarted everything worked. Of course, in anyone else’s case, it may be something different. When Apache crashes it may be bad config or bad mod. You have to pick your battles.

Источник

Smartadm.ru
Adblock
detector