Apache fails to start on linux, with this error [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have been running apache2 without issues,
but after configuring some virtual hosts it failed to reload.
I edited the files in /etc/sites-available and the /etc/hosts file.
I see the following error:
sudo service apache2 start
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
┌─[✗]─[rodgers#parrot]─[~]
└──╼ $journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
Nov 05 21:47:00 parrot brisk-menu[1965]: gdk_window_get_origin: assertion 'GDK_>
Nov 05 21:47:00 parrot brisk-menu[1965]: gdk_window_get_origin: assertion 'GDK_>
lines 3031-3053/3053 (END)
░░ A start job for unit UNIT has finished successfully.
░░
░░ The job identifier is 42.
Nov 05 21:46:39 parrot dbus-daemon[1663]: [session uid=1000 pid=1663] Activating via systemd: service name='org.a11y.Bus' unit='at-sp>
Nov 05 21:46:39 parrot systemd[1629]: Starting Accessibility services bus...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit UNIT has begun execution.
░░
░░ The job identifier is 58.
Nov 05 21:46:39 parrot dbus-daemon[1663]: [session uid=1000 pid=1663] Successfully activated service 'org.a11y.Bus'
Nov 05 21:46:39 parrot systemd[1629]: Started Accessibility services bus.
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit UNIT has finished successfully.
░░
░░ The job identifier is 58.
Nov 05 21:46:39 parrot dbus-daemon[1663]: [session uid=1000 pid=1663] Activating service name='org.freedesktop.portal.IBus' requested>
Nov 05 21:46:40 parrot x-session-manager[1655]: WARNING: Unable to find provider '' of required component 'dock'
Nov 05 21:46:42 parrot systemd[1629]: run-user-138.mount: Succeeded.

See Apache log to get more details about the error:
Ubuntu /var/log/apache2
CentOS or Redhat /var/log/httpd

Related

Setting up a systemd service to loop videos using VLC on a Raspberry Pi

I have a Raspberry Pi 4 that I'm using inside a display case to play some mp4 videos on loop. While normally I might simply open VLC using the desktop GUI, load them, hit play and maximize to fullscreen, I want this to be a bit more robust and capable of restarting itself. Also, I will note, for an undiagnosed reason, the above has resulted in video stoppage when I tried it.
What I've tried is to follow these instructions, but I would really appreciate some help to troubleshoot where I may be going wrong: https://gist.github.com/anthonyray/bb6fd7363cd99204330f17c54513f293
My videokiosk.service file looks like this:
[Unit]
Description=videokiosk
[Service]
User=kioskman
Environment="DISPLAY=:0"
ExecStart=/usr/bin/vlc -Rf pastels.mp4
WorkingDirectory=/home/sean/Videos
Restart=always
[Install]
WantedBy=multi-user.target
Its status after loading and trying to run it was:
● videokiosk.service - videokiosk
Loaded: loaded (/etc/systemd/system/videokiosk.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Fri 2022-07-22 10:47:52 EDT; 3min 56s ago
Process: 885 ExecStart=/usr/bin/vlc -Rf pastels.mp4 (code=exited, status=0/SUCCESS)
Main PID: 885 (code=exited, status=0/SUCCESS)
CPU: 430ms
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Scheduled restart job, restart counter is at 5.
Jul 22 10:47:52 raspberrypi systemd[1]: Stopped videokiosk.
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Start request repeated too quickly.
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Failed with result 'start-limit-hit'.
Jul 22 10:47:52 raspberrypi systemd[1]: Failed to start videokiosk.
The journal looks like this:
-- Journal begins at Mon 2022-04-04 08:44:56 EDT. --
Jul 22 10:47:52 raspberrypi vlc[885]: > Shutting down.
Jul 22 10:47:52 raspberrypi vlc[885]: [00486638] [cli] lua interface: Requested shutdown.
Jul 22 10:47:52 raspberrypi vlc[885]: [afc0d578] cache_read stream error: cannot pre fill buffer
Jul 22 10:47:52 raspberrypi vlc[885]: [afc0e188] mjpeg demux error: cannot peek
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Succeeded.
░░ Subject: Unit succeeded
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit videokiosk.service has successfully entered the 'dead' state.
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ Automatic restarting of the unit videokiosk.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Jul 22 10:47:52 raspberrypi systemd[1]: Stopped videokiosk.
░░ Subject: A stop job for unit videokiosk.service has finished
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A stop job for unit videokiosk.service has finished.
░░
░░ The job identifier is 1446 and the job result is done.
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Start request repeated too quickly.
Jul 22 10:47:52 raspberrypi systemd[1]: videokiosk.service: Failed with result 'start-limit-hit'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit videokiosk.service has entered the 'failed' state with result 'start-limit-hit'.
Jul 22 10:47:52 raspberrypi systemd[1]: Failed to start videokiosk.
░░ Subject: A start job for unit videokiosk.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit videokiosk.service has finished with a failure.
░░
░░ The job identifier is 1446 and the job result is failed.
Thank you for your time and thoughts.
Here is what has worked: Changing the WantedBy field to graphical.target; granting permission to the directory holding the videos to the service user.
Thanks to #MarkSetchell for asking the right questions.

How to make my app run in background in Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I created a service in my Ubuntu instance by adding it to systemd like:
sudo systemctl enable myservice.service
Created symlink /etc/systemd/system/multi-user.target.wants/myservice.service → /etc/systemd/system/myservice.service.
the setting inside my myservice.service are:
[Unit]
Description=myserviceService
[Service]
Restart=always
Type=simple
ExecStart=/home/myservice-app/core/core
[Install]
WantedBy=multi-user.target
This is the error when I check status:
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: myservice.service: Main process exited, code=exited, status=1/FAILURE
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: myservice.service: Failed with result 'exit-code'.
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: myservice.service: Scheduled restart job, restart counter is at 5.
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: Stopped myserviceService.
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: myservice.service: Start request repeated too quickly.
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: myservice.service: Failed with result 'exit-code'.
Feb 02 06:51:16 myservice-ubuntu-app systemd[1]: Failed to start myservice Service.
What am I doing wrong? The service runs properly in foreground with no errors, its just the service that struggles to run.
If your Go program is able to start normally (meaning not as a service, but manually from command line), then check if this is a policy issue.
For instance, a SELinux policy could prevent your Go binary to start if it is not installed in a system path (like /usr/local/bin).
Or the service definition uses relative instead of absolute paths (same here).
Or with the wrong user.

How to resolve chown: invalid user while starting apache server? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am trying to start apache2 services by running-
sudo service apache2 start
But it is resulting in-
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
I tried-
sudo systemctl status apache2.service
and it's showing-
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-12-08 11:17:18 IST; 7min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 30529 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Dec 08 11:17:18 dk systemd[1]: Starting The Apache HTTP Server...
Dec 08 11:17:18 dk apachectl[30535]: chown: invalid user: 'dk'
Dec 08 11:17:18 dk systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Dec 08 11:17:18 dk systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 08 11:17:18 dk systemd[1]: Failed to start The Apache HTTP Server.
I am assuming the problem is with invalid user: dk. How can i resolve this?
Also I recently removed one user account which already had LAMP stack installed. Is that the reason why it's showing invalid user?
In new systems, e.g. ubuntu 20 * LTS, the configuration file is /etc/apache2/envvars
look for APACHE_RUN_USER and APACHE_RUN_GROUP.
You must see in the file:
/etc/apache2/apache2.conf
or
/etc/apache2/httpd.conf
what is the entered user and what group
normally it is:
User www-data
Group www-data
or maybe in your case it is "dk"
in addition, you may have specified in the server file that the site location is in a directory owned by "dk".
Check the server configuration with the command:
apachectl configtest
or
sudo apachectl configtest

Missing '='. in Debian service [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I've created this service in /etc/systemd/system/webapp.service
in a
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
This is the content:
[Unit]
Description=webapp daemon
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/bin/start-webapp.sh
ExecStop=/usr/local/bin/stop-webapp.sh
ExecReload=/usr/local/bin/reload-webapp.sh
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=webapp.service
I try to startd the service using:
sudo systemctl start webapp.service
But when I do
sudo systemctl status webapp.service
I got this error:
● webapp.service - webapp daemon
Loaded: loaded (/etc/systemd/system/webapp.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Jun 01 11:31:48 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:31:52 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:35:21 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
Jun 01 11:35:31 localhost systemd[1]: /etc/systemd/system/webapp.service:8: Missing '='.
and
admin#localhost:/etc/systemd/system$ cat -vetn webapp.service
1 [Unit]$
2 Description=webapp daemon$
3 [Service]$
4 Type=simple$
5 ExecStart=/usr/local/bin/start-webapp.sh$
6 ExecStop=/usr/local/bin/stop-webapp.sh$
7 ExecReload=/usr/local/bin/reload-webapp.sh$
8 [Install]$
9 WantedBy=multi-user.target$
Your config content seems nothing wrong, so I have copied it to my debian server and try to run it, and it's really ok.
But it's strange that the stdout of cat -vetn webapp.service is not the exactly content of your original config, so would you mind to remove the original config and do it again ?
refer: https://wiki.debian.org/systemd/Services
redo:
mv webapp.service /tmp/webapp.service
vi webapp.service # check characters
After creating or modifying any unit files, we must tell systemd that we want it to look for new things:
systemctl daemon-reload
Then, tell systemd to enable it, so that it will start every time we boot:
systemctl enable myservice.service
Finally, start it:
systemctl start myservice.service

I Can't start the mongodb server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I just installed MongoDb on Ubuntu 16.04 and I can not run the server. I get the following information when the "status" of the server (sudo systemctl start mongodb):
lmunoz#lmunoz:/var/www/node/dashboard$ sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented
database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor
preset: enabled)
Active: failed (Result: exit-code) since mar 2017-05-09 12:01:59 PET;
29s ago
Process: 1042 ExecStart=/usr/bin/mongod --quiet --config
/etc/mongod.conf (code=exited, status=48)
Main PID: 1042 (code=exited, status=48)
may 09 12:01:59 lmunoz systemd[1]: Started High-performance, schema-
free document-oriented database.
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Main process
exited, code=exited, status=48/n/a
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Unit entered
failed state.
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Failed with result
'exit-code'.
The log (/var/log/mongodb/mongod.log) shows me the following:
listen(): bind() failed errno:98 Address already in use for socket:
127.0.0.1:27017
addr already in use
Failed to set up sockets during startup.
dbexit: rc: 48
And my configuration file (/etc/systemd/system/mongodb.service) contains:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
Look at the logs you are having another service which is running on the port 27017.
Look for that service and stop it and then retry. Or if you don't care about the service running on that port, can do
sudo fuser -k 27017/tcp
Another alternative will be to change the default of mongodb. See mongodb how to change default port

Resources