varnish 4.1 default.vcl permissions denied - magento2

When I'm trying to add magento 2 varnish.vcl file by creating a symbolic link, varnish service stop working with error permission denied, while if I use default varnish configuration file varnish works smooth.
My Stack is ubuntu 16.04, varnish 4.1
ls -al
drwxr-xr-x 2 root root 4096 Mar 21 13:14 .
drwxr-xr-x 96 root root 4096 Mar 21 12:56 ..
lrwxrwxrwx 1 root root 44 Mar 21 13:14 default.vcl -> /var/www/bazaar/varnish.vcl
-rw-r--r-- 1 root root 1225 Aug 22 2017 default.vcl_bak
-rw-r--r-- 1 root root 37 Mar 21 12:56 secret
here is the status for varnish service
● varnish.service - Varnish HTTP accelerator
Loaded: loaded (/lib/systemd/system/varnish.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/varnish.service.d
└─customexec.conf
Active: failed (Result: exit-code) since Wed 2018-03-21 13:59:08 UTC; 2s ago
Docs: https://www.varnish-cache.org/docs/4.1/
man:varnishd
Process: 3093 ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m (code=exited, status=2)
Main PID: 3093 (code=exited, status=2)
Mar 21 13:59:08 bazaar systemd[1]: Stopped Varnish HTTP accelerator.
Mar 21 13:59:08 bazaar systemd[1]: Started Varnish HTTP accelerator.
Mar 21 13:59:08 bazaar varnishd[3093]: Error: Cannot read -f file (/etc/varnish/default.vcl): Permission denied
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Unit entered failed state.
Mar 21 13:59:08 bazaar systemd[1]: varnish.service: Failed with result 'exit-code'.
my current user for nginx is bazaar
and permissions for varnish.vcl is as follow
-rw-r--r-- 1 bazaar bazaar 7226 Mar 21 13:24 varnish.vcl
Any hint or help will be highly appreciated.
Thanks.

It is likely that the user (vcache) does not have access to read in the parent directory(s) /var/www/bazaar.

Related

Apache Zookeeper: Unable to access data directory

OS: RHEL 8.2
I am trying to create a systemctl service for zookeeper. It fails to access the datadir.
Here is my config for zookeeper,
dataDir=/opt/zookeeper
maxClientCnxns=20
tickTime=2000
dataDir=/var/zookeeper/
initLimit=20
syncLimit=10
server.0=master:2888:3888
clientPort=2181
admin.serverPort=8082
Permission of /opt/zookeeper is set to 777.
[user1#server1 opt]$ ls -lart
total 0
dr-xr-xr-x. 17 root root 244 Jul 3 10:56 ..
drwxr-xr-x 3 root root 27 Jul 10 10:29 rh
drw-r--r-- 2 user2 user2 6 Jul 17 08:48 hsluw_data
drw-r--r-- 2 user2 user2 6 Jul 17 08:58 hsluw_config
drwxr-xr-x. 6 root root 71 Jul 17 08:58 .
drwxrwxrwx 3 user2 user2 23 Jul 17 09:40 zookeeper
If I run the command,
./bin/zookeeper-server-start.sh config/zookeeper.properties
it gives me an error message: Unable to access datadir
[2020-07-30 10:25:50,767] ERROR Invalid configuration, only one server specified (ignoring) (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-07-30 10:25:50,767] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
[2020-07-30 10:25:50,769] INFO zookeeper.snapshot.trust.empty : false (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2020-07-30 10:25:50,769] ERROR Unable to access datadir, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
org.apache.zookeeper.server.persistence.FileTxnSnapLog$DatadirException: Cannot write to data directory /var/zookeeper/version-2
at org.apache.zookeeper.server.persistence.FileTxnSnapLog.<init>(FileTxnSnapLog.java:132)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:124)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)
Unable to access datadir, exiting abnormally
However, sudoing the above command works,
sudo ./bin/zookeeper-server-start.sh config/zookeeper.properties
Now I have created a service in /etc/systemd/system/zookeeper.service
I wrote the service in /etc/systemd/system/zookeeper.service in this way,
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=user2
ExecStart=/home/user2/kafka/bin/zookeeper-server-start.sh /home/user2/kafka/config/zookeeper.properties
ExecStop=/home/user2/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
The SELinux status is disabled.
user2#server1$ sestatus
SELinux status: disabled
Now if I do the following
sudo systemctl daemon-reload
sudo systemctl start zookeeper
sudo systemctl enable zookeeper
I am getting the the same Unable to access the datadir error like the following,
[user2#server1 /]$ systemctl status zookeeper
\u25cf zookeeper.service
Loaded: loaded (/etc/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2020-07-30 10:13:19 CEST; 24s ago
Main PID: 12911 (code=exited, status=3)
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: org.apache.zookeeper.server.persistence.FileTxnSnapLog$Data>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.persistence.FileTxnS>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.ZooKeeperServerMain.>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.ZooKeeperServerMain.>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.ZooKeeperServerMain.>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.quorum.QuorumPeerMai>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: at org.apache.zookeeper.server.quorum.QuorumPeerMai>
Jul 30 10:13:19 server1.localdomain zookeeper-server-start.sh[12911]: Unable to access datadir, exiting abnormally
Jul 30 10:13:19 server1.localdomain systemd[1]: zookeeper.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Jul 30 10:13:19 server1.localdomain systemd[1]: zookeeper.service: Failed with result 'exit-code'.
What am I missing here?
In the configuration file, this line
dataDir=/var/zookeeper/
appears twice. Removing that line solves the issue.

Failed at step CHDIR spawning /opt/Informer5/informer5.sh: No such file or directory

I have an application called "Informer." I am trying to register it as a service and I'm not sure where I have gone wrong.
Here is informer.service:
[Unit]
Description=Informer Docker
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
User=root
WorkingDirectory=/opt/Informer5 <===Modify for the appropriate directory
ExecStart=/opt/Informer5/informer5.sh start <===Modify for the appropriate directory
ExecStop=/opt/Informer5/informer5.sh stop <===Modify for the appropriate directory
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
This file is in my /etc/systemd/system folder. I have enabled the service via
sudo systemctl enable informer
when I execute
sudo systemctl start informer
The response I get is
Job for informer.service failed because the control process exited with error code. See "systemctl status informer.service" and "journalctl -xe" for details.
So, running, systemctl status informer.service, I see the following:
$sudo systemctl status informer.service
● informer.service - Informer Docker
Loaded: loaded (/etc/systemd/system/informer.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-09-18 08:49:07 EDT; 4min 2s ago
Process: 5780 ExecStart=/opt/Informer5/informer5.sh start <===Modify for the appropriate directory (code=exited, status=200/CHDIR)
Main PID: 5780 (code=exited, status=200/CHDIR)
Sep 18 08:49:07 informer5 systemd[1]: Starting Informer Docker...
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Main process exited, code=exited, status=200/CHDIR
Sep 18 08:49:07 informer5 systemd[1]: Failed to start Informer Docker.
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Unit entered failed state.
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Failed with result 'exit-code'.
Running $ sudo journalctl -xe, I get:
$ sudo journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit informer.service has failed.
--
-- The result is failed.
Sep 18 08:06:36 informer5 systemd[1]: informer.service: Unit entered failed state.
Sep 18 08:06:36 informer5 systemd[1]: informer.service: Failed with result 'exit-code'.
Sep 18 08:06:36 informer5 sudo[5690]: pam_unix(sudo:session): session closed for user root
Sep 18 08:12:40 informer5 sudo[5712]: n_connor : TTY=pts/0 ; PWD=/opt/Informer5 ; USER=root ; COMMAND=/bin/cat /etc/systemd/system/informer.service
Sep 18 08:12:40 informer5 sudo[5712]: pam_unix(sudo:session): session opened for user root by n_connor(uid=0)
Sep 18 08:12:40 informer5 sudo[5712]: pam_unix(sudo:session): session closed for user root
Sep 18 08:15:01 informer5 CRON[5716]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 18 08:15:01 informer5 CRON[5717]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 18 08:15:01 informer5 CRON[5716]: pam_unix(cron:session): session closed for user root
Sep 18 08:17:01 informer5 CRON[5721]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 18 08:17:01 informer5 CRON[5722]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Sep 18 08:17:01 informer5 CRON[5721]: pam_unix(cron:session): session closed for user root
Sep 18 08:25:01 informer5 CRON[5732]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 18 08:25:01 informer5 CRON[5733]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 18 08:25:01 informer5 CRON[5732]: pam_unix(cron:session): session closed for user root
Sep 18 08:35:01 informer5 CRON[5745]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 18 08:35:01 informer5 CRON[5746]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 18 08:35:01 informer5 CRON[5745]: pam_unix(cron:session): session closed for user root
Sep 18 08:45:01 informer5 CRON[5758]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 18 08:45:01 informer5 CRON[5759]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 18 08:45:01 informer5 CRON[5758]: pam_unix(cron:session): session closed for user root
Sep 18 08:47:43 informer5 sudo[5774]: n_connor : TTY=pts/0 ; PWD=/opt/Informer5 ; USER=root ; COMMAND=/bin/cat /etc/systemd/system/informer.service
Sep 18 08:47:43 informer5 sudo[5774]: pam_unix(sudo:session): session opened for user root by n_connor(uid=0)
Sep 18 08:47:43 informer5 sudo[5774]: pam_unix(sudo:session): session closed for user root
Sep 18 08:49:07 informer5 sudo[5777]: n_connor : TTY=pts/0 ; PWD=/opt/Informer5 ; USER=root ; COMMAND=/bin/systemctl start informer
Sep 18 08:49:07 informer5 sudo[5777]: pam_unix(sudo:session): session opened for user root by n_connor(uid=0)
Sep 18 08:49:07 informer5 systemd[5780]: informer.service: Failed at step CHDIR spawning /opt/Informer5/informer5.sh: No such file or directory
-- Subject: Process /opt/Informer5/informer5.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /opt/Informer5/informer5.sh could not be executed and failed.
--
-- The error number returned by this process is 2.
Sep 18 08:49:07 informer5 systemd[1]: Starting Informer Docker...
-- Subject: Unit informer.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit informer.service has begun starting up.
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Main process exited, code=exited, status=200/CHDIR
Sep 18 08:49:07 informer5 systemd[1]: Failed to start Informer Docker.
-- Subject: Unit informer.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit informer.service has failed.
--
-- The result is failed.
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Unit entered failed state.
Sep 18 08:49:07 informer5 systemd[1]: informer.service: Failed with result 'exit-code'.
Sep 18 08:49:07 informer5 sudo[5777]: pam_unix(sudo:session): session closed for user root
Sep 18 08:53:09 informer5 sudo[5787]: n_connor : TTY=pts/0 ; PWD=/opt/Informer5 ; USER=root ; COMMAND=/bin/systemctl status informer.service
Sep 18 08:53:09 informer5 sudo[5787]: pam_unix(sudo:session): session opened for user root by n_connor(uid=0)
Sep 18 08:53:09 informer5 systemd[1]: Configuration file /etc/systemd/system/informer.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Sep 18 08:53:09 informer5 sudo[5787]: pam_unix(sudo:session): session closed for user root
Sep 18 08:54:01 informer5 sudo[5791]: n_connor : TTY=pts/0 ; PWD=/opt/Informer5 ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 18 08:54:01 informer5 sudo[5791]: pam_unix(sudo:session): session opened for user root by n_connor(uid=0)
I think that the salient error here is informer.service: Failed at step CHDIR spawning /opt/Informer5/informer5.sh: No such file or directory
I have checked that the file does exist and I can manually start the service using that file as root. I have a home directory set in the service file. I have no idea where this error is coming from. I am using ubuntu 16.04 and I have enabled root login with ssh. Any ideas?
I added #!/bin/bash in the bash file at the top and it worked
e.g.
nano server.sh
#!/bin/bash
echo "Serving Web App!"
serve -s build -p 4004
chmod +x server.sh
nano /etc/systemd/system/web.service
[Unit]
Description=Web App
After=network.target
[Service]
WorkingDirectory=/var/www/html/web
User=root
ExecStart=/var/www/html/web/server.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Things to note
Verify the WorkingDirectory e.g cd /var/www/html/web if it does not exist create it e.g. cd /var/www/html/web

Sphinx When Restart/Stop searchd.pid is deleted

I just install Sphinx version sphinx-2.2.11-1.rhel7.x86_64 on Centos7.3
So i success to install it and index the database and when i start it first time the Sphinx is starting but when i try to use service searchd stop or service searchd restart everytime the searchd.pid is auto deleted but never created again so the sphinx can't start again because of the error
[root#ns510209 log]# service searchd start
Redirecting to /bin/systemctl start searchd.service
Job for searchd.service failed because a configured resource limit was exceeded. See "systemctl status searchd.service" and "journalctl -xe" for details.
Any suggestion how i can fix this issue im trying for few days to find a way but still no luck ...
I met the same issue. The root cause is that searchd cannot write the binlog file due to incorrect metadata in the following folder:
# ls -al /var/lib/sphinx/
total 23580
drwxr-xr-x 2 sphinx sphinx 4096 Jul 9 16:52 .
drwxr-xr-x 33 root root 4096 Mar 12 14:18 ..
-rw------- 1 sphinx sphinx 8 Jul 9 16:47 binlog.001
-rw------- 1 sphinx sphinx 8 Jul 9 16:52 binlog.002
-rw------- 1 sphinx sphinx 0 Jul 9 16:52 binlog.lock
-rw------- 1 sphinx sphinx 12 Jul 9 16:52 binlog.meta
-rw------- 1 sphinx sphinx 0 Jun 21 18:53 doc.old.spl
-rw-r--r-- 1 sphinx sphinx 0 Jul 9 16:52 doc.spa
Move all files, except for doc.* (or whatever prefix is used), from this folder. Then start the service:
# systemctl start searchd
# systemctl status searchd
● searchd.service - SphinxSearch Search Engine
Loaded: loaded (/usr/lib/systemd/system/searchd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2019-07-09 16:52:43 MSK; 6min ago
Process: 1690 ExecStart=/usr/bin/searchd --config /etc/sphinx/sphinx.conf (code=exited, status=0/SUCCESS)
Process: 1687 ExecStartPre=/bin/chown sphinx.sphinx /var/run/sphinx (code=exited, status=0/SUCCESS)
Process: 1684 ExecStartPre=/bin/mkdir -p /var/run/sphinx (code=exited, status=0/SUCCESS)
Main PID: 1693 (searchd)
CGroup: /system.slice/searchd.service
├─1692 /usr/bin/searchd --config /etc/sphinx/sphinx.conf
└─1693 /usr/bin/searchd --config /etc/sphinx/sphinx.conf

centos 7 with Digital ocean vps httpd.service failier

im try to install phpmyadmin on centos 7 with digitalocean droplet.i edited allow IP to dynamic any IP.but when i try to restart the service,i got this message.
[root#centos-512mb-nyc2-01 /]# sudo systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
here is the result after run systemctl status httpd.service
[root#centos /]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2016-04-26 04:47:31 EDT; 1min 50s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 2633 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 2632 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 2632 (code=exited, status=1/FAILURE)
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: Starting The Apache HTTP Server...
Apr 26 04:47:31 centos-512mb-nyc2-01 httpd[2632]: AH00526: Syntax error on line 1 of /etc/httpd/conf.d/phpMyAdmin.conf:
Apr 26 04:47:31 centos-512mb-nyc2-01 httpd[2632]: allow not allowed here
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 26 04:47:31 centos-512mb-nyc2-01 kill[2633]: kill: cannot find process ""
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: Failed to start The Apache HTTP Server.
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: Unit httpd.service entered failed state.
Apr 26 04:47:31 centos-512mb-nyc2-01 systemd[1]: httpd.service failed.
here is my http file
Allow from# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
Require all granted
#Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Why don't you use the one click Application Image that Digital Ocean offers?
You can get the full tutorial here

Could not start RStudio Server 0.99.893-x86_64

I installed it a Centos 7 box.
R studio server service could not start.
I run the command
systemctl status rstudio-server.service
and it showed:
● rstudio-server.service - RStudio Server
Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Thu 2016-01-28 20:18:20 ICT; 1min 6s ago
Process: 48820 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=203/EXEC)
Jan 28 20:18:20 localhost.localdomain systemd[1]: rstudio-server.service: control process exited, code=exited s...=203
Jan 28 20:18:20 localhost.localdomain systemd[1]: Failed to start RStudio Server.
Jan 28 20:18:20 localhost.localdomain systemd[1]: Unit rstudio-server.service entered failed state.
Jan 28 20:18:20 localhost.localdomain systemd[1]: rstudio-server.service failed.
Jan 28 20:18:20 localhost.localdomain systemd[1]: rstudio-server.service holdoff time over, scheduling restart.
Jan 28 20:18:20 localhost.localdomain systemd[1]: start request repeated too quickly for rstudio-server.service
Jan 28 20:18:20 localhost.localdomain systemd[1]: Failed to start RStudio Server.
Jan 28 20:18:20 localhost.localdomain systemd[1]: Unit rstudio-server.service entered failed state.
Jan 28 20:18:20 localhost.localdomain systemd[1]: rstudio-server.service failed.
I installed and run an old version (rstudio-server-0.99.491-1.x86_64) on the same box without any problem.
How could I fix the issues?
Although you asked this question 3 years ago, I think it's still necessary to share my solution to this problem.
I encounter this problem after I updated R.
The reason why you can not restart rstudio-server is that the PORT 8787 was been using by previous rserver. After knowing this, the solution is easy.
First, check the pid that was using PORT 8787
sudo netstat -anp | grep 8787
tcp 0 0 0.0.0.0:8787 0.0.0.0:* LISTEN pid/rserver
Second, kill this pid (use your pid)
sudo kill -9 pid
Third, restart rstudio-server or reinstall resutio server package