Cannot find the Nagios binary or no execute permissions in NagiosQL - apache

I downloaded nagiosql_320.tar.gz and installed NagiosQL. When I click on check configuration file, it shows error as:
Cannot find the Nagios binary or no execute permissions!
I created symlink as below for nagios binary with following permission.
lrwxrwxrwx 1 root root 28 Jul 5 16:07 /usr/sbin/nagios -> /usr/local/nagios/bin/nagios
-rwxr-x--- 1 nagios apache 692624 Jun 27 14:40 /usr/local/nagios/bin/nagios
How can I correct the error?

chmod +x /usr/local/nagios/bin/nagios and try again

Related

SSH/Fuse mount create file ok but can't delete it

I have a proxmox server so under debian, and I want to mount a remote directory from my Nas Synologies to make backups.
I normally use ssh mounts without any problem.
But this time I have an error that I have never encountered, I can create files, but not delete them.
I find this very strange and I don't see where this can come from
root#proxmox:/mnt/# sshfs user#192.168.0.1:home/data /mnt/dist-folder/ -o reconnect,
ServerAliveInterval=60,ServerAliveCountMax=30,allow_other,
default_permissions,uid=0,gid=0,umask=007
root#proxmox:/mnt# cd dist-folder/
root#proxmox:/mnt/dist-folder# touch aa.txt
root#proxmox:/mnt/dist-folder# ls -la
total 12
drwxrwx--- 1 root root 114 Mar 13 09:53 .
drwxr-xr-x 7 root root 4096 Mar 13 09:37 ..
-rwxrwx--- 1 root root 0 Mar 13 09:53 aa.txt
root#proxmox:/mnt/dist-folder# rm aa.txt
rm: cannot remove 'aa.txt': Permission denied
With uid=0,gid=0 for root user and group
Thanks
This is finally a problem specific to synology.
For the assembly of the file it is absolutely necessary to respect the path by starting with
/homes/<user>home/
So it's give
sshfs user#192.168.0.1:/homes/proxmox/home/data /mnt/dist-folder/
And it's works fine !
It's not the first time that I have an abnormal configuration for this synology tool... AGrrrr

Jenkins user cannot copy files to Apache /var/www folder - all permissions appropriate

Jenkins installed on Ubuntu 18.04 and running successfully.
As part of our project build process, we need to copy built files to a specific folder under /var/www/html (Apache folder). Our build / Execute shell:
npm install
ng build --prod
cp -R /var/lib/jenkins/workspace/kagi-core/dist/core/* /var/www/html/kagi-core/
But jenkins build fails at the final copy command with the following errors:
23:18:10 + cp -R /var/lib/jenkins/workspace/kagi-core/dist/core/3rdpartylicenses.txt /var/lib/jenkins/workspace/kagi-core/dist/core/assets ...
23:18:10 cp: cannot create regular file '/var/www/html/kagi-core/3rdpartylicenses.txt': Permission denied
...
...
Here's what we did/tried so far:
Added "jenkins" user to root and ubuntu groups.
ubuntu#ip-172-31-15-215:/var/www/html$ groups jenkins
jenkins : jenkins root ubuntu
Changed permissions on /var/www/html/kagi-core folders to "jenkins" user
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 17 21:36 www
..
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 18 21:04 html
..
drwxrwxrwx 4 ubuntu jenkins 4096 Sep 18 21:18 kagi-core
What are we missing? Appreciate any help!
While trying to fix this, found the solution. Adding here for reference:
On observing carefully, the permissions to /var/www folders, they are as
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 17 21:36 www
but instead they should be the other way around (allow "jenkins" user to the default group):
drwxr-xr-x 3 jenkins ubuntu 4096 Sep 17 21:36 www
Also we reset the group to default root
So the command that solved the issue was
cd /var
sudo chown -R jenkins:root www/
After this, jenkins builds were successful (able to copy to the /var/www/html folder).

Systemd service using screen: 'No screen session found'

I'm trying to setup a minecraft server for my kid and screen is giving me fits. I've been following this tutorial and I've already consulted this AskUbuntu answer. I'm running on Ubuntu 16.04.5 x64. I have created the following Service file and linked it to /etc/systemd/system/minecraft.service.
[Unit]
Description=Minecraft Server
Documentation=
Wants=network.target
After=network.target
[Service]
User=minecraft
Group=minecraft
Nice=5
EnvironmentFile=-/var/minecraft/unit.conf
KillMode=none
SuccessExitStatus=0 1
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
PrivateTmp=true
InaccessibleDirectories=/root /sys /srv -/opt /media -/lost+found
ReadWriteDirectories=/var/minecraft/server /usr/bin/screen
WorkingDirectory=/var/minecraft/server
#ExecStartPre= /usr/bin/screen -dmS Minecraft
ExecStart= /usr/bin/screen -dm -S Minecraft '/usr/bin/java -Xmx1500M -Xms1024M -jar /var/minecraft/server/craftbukkit-1.13.jar'
ExecStop=/usr/bin/screen -S minecraft -p 0 -X stuff "stop^M"
[Install]
WantedBy=multi-user.target
When I monitor the service startup, I get the following in the journalctl logs:
Aug 05 14:55:41 spigot-1 systemd[1]: Started Minecraft Server.
Aug 05 14:55:41 spigot-1 screen[9869]: No screen session found.
Per the SO post I referenced, I already changed the permissions in /var/run/screen. This is the current setup:
root#spigot-1:/var/minecraft/server# ls -alR /var/run/screen/
/var/run/screen/:
total 0
drwxrwxrwx 4 root root 80 Aug 5 14:12 .
drwxr-xr-x 23 root root 860 Aug 5 14:11 ..
drwx------ 2 minecraft minecraft 40 Aug 5 14:55 S-minecraft
drwx------ 2 root root 40 Aug 5 14:50 S-root
/var/run/screen/S-minecraft:
total 0
drwx------ 2 minecraft minecraft 40 Aug 5 14:55 .
drwxrwxrwx 4 root root 80 Aug 5 14:12 ..
/var/run/screen/S-root:
total 0
drwx------ 2 root root 40 Aug 5 14:50 .
drwxrwxrwx 4 root root 80 Aug 5 14:12 ..
** Debug Notes **
You'll see the commented ExecStartPre command in there... all that happens if I try to start the screen session with that command is I get a second 'No screen session found' error.
I can launch the server from the command line using 'screen -dmS Minecraft [..]' and reattach. I can do this both as root and as the 'minecraft' user.
Any help would be greatly appreciated
I don't have Ubuntu to hand, but I tried something similar on Fedora 24 and had a similar error. To investigate I added an strace to the screen command and removed PrivateTmp so that I could get the trace output.
ExecStart=/bin/strace -o /tmp/s -f screen -dm -S me bash -c 'sleep 999'
In the output I found that at the end, screen was trying to open a pseudo-tty and failed to do so:
open("/dev/ptmx", O_RDWR) = -1 EACCES (Permission denied)
...
write(1, "No more PTYs.\r\nSorry, could not "..., 52) = 52
I added some ls -l /dev commands to the Unit to see what the effect of the PrivateDevices=true option had been. There was indeed a /dev/ptmx file, but unlike my real /dev it was a symbolic link to /dev/pts/ptmx, instead of just being the special character device. For some reason on my system I have:
$ ls -l /dev/ptmx /dev/pts/ptmx
crw-rw-rw- 1 root tty 5, 2 Aug 6 14:29 /dev/ptmx
c--------- 1 root root 5, 2 Jun 27 08:29 /dev/pts/ptmx
(This is probably a bug depending on the version of systemd and udev.)
So when /dev/ptmx is replaced in the private namespace by a symbolic link to /dev/pts/ptmx, you can no longer open a new pty. A simple fix for testing was sudo chmod a+rw /dev/pts/ptmx which indeed made the Unit work and start the screen process.
This may not be the case for you, but you could undertake a similar debug method to try to find the problem.

make: *** /lib/modules/2.6.32-279.el6.x86_64/build: No such file or directory. Stop

I downloaded the RALINK driver from their web site
untar -xvf rtl*
and then i ran "make" in it. google search suggested "kernel-devel"
needed to be installed.
i installed the kernel-devel package but i still get this error
make: *** /lib/modules/2.6.32-279.el6.x86_64/build: No such file or directory. Stop.
when i check to see if that file exists..
i cd into /lib/modules/2.6.32-279.el6.x86_64/
i believe this error happens right after "make" command tries to execute this command
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/2.6.32-279.el6.x86_64/build M=/home/a/Desktop/3/rtl8712_8188_8191_8192SU_usb_linux_v2.6.6.0.20120405 modules
and it's there it is called "build"
so why is it saying no such file or directory ?
**EDIT**
If your problem is like the one I was having (see below), it seems the kernel development package isn't installed.
Try:
yum install kernel-devel
Original Message
I am having the same problem. But, interestingly, when I ls-l on the parent directory to the "missing directory" (so, ls -l /lib/modules/2.6.32-431.el6.x86_64/) it shows that build is a broken link pointing to /usr/src/kernels/2.6.32-431.el6.x86_64, but /usr/src/kernels/ is empty.
So, I don't know if this is much help, but hopefully it gives someone else a better idea of what's wrong.
[root#xx libreswan-3.7]# ls -l /lib/modules/2.6.32-431.el6.x86_64/
total 3524
lrwxrwxrwx. 1 root root 46 Dec 12 13:42 build -> ../../../usr/src/kernels/2.6.32-431.el6.x86_64
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 extra
drwxr-xr-x. 11 root root 4096 Dec 12 13:42 kernel
-rw-r--r--. 1 root root 589679 Dec 12 13:43 modules.alias
...
-rw-r--r--. 1 root root 851070 Dec 12 13:43 modules.usbmap
lrwxrwxrwx. 1 root root 5 Dec 12 13:42 source -> build
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 updates
drwxr-xr-x. 2 root root 4096 Dec 12 13:42 vdso
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 weak-updates
[root#xx libreswan-3.7]# ls /usr/src/kernels/
[root#xx libreswan-3.7]#
Notice that the "source" link is also broken because it points to build.
cd /lib/modules/2.6.32-431.el6.x86_64
sudo rm build
sudo ln -s ../../../usr/src/kernels/2.6.32-431.29.2.el6.x86_64/ build
The above commands fixed the issue for me
But basically you must be able to use any version of 2.6.32* directory in the last command.
Thanks to Nighthawk663.
I have the same problem in ./configure --with-linux=/lib/modules/uname -r/build/. It says "not a file..." too.
Reason:
The kernel head files are missing for the current kernel.
How I solved it:
find current kernel: uname -r
yum install kernel-devel-$(uname -r)
you may not find it...
just google that version of kernel-devel-... download the rpm file, and do
rpm -i kernel-devel-xxxx.rpm
Then it works for me!
/usr/lib/modules/your-kernel-edition/build is a link file.
the link file exists. but the target file might not exists. So It is ok to see the link file, but the folder can not be changed into it (cd).
Similar Example on fedora 29.
lrwxrwxrwx. 1 root root 40 Oct 21 07:38 /usr/lib/modules/4.18.16-300.fc29.x86_64/build -> /usr/src/kernels/4.18.16-300.fc29.x86_64
Just install kernel-devel.
Example.
sudo dnf install kernel-devel-$(uname -r)
Because the link is not with your kernel version.
Delete the wrong link.
$ rm build`
Use $ uname -r to check the kernel version
Build new link with your kernel version.
$ ln -s ../../../usr/src/kernels/($(uname -r)/ build
Done

Production log not working

In the past I thought I was just crazy. I may be, but my production log is not at all responding to some requests. I am POSTing images to my rails app from a mobile client, then GETting a refreshed view in a web browser. The changed record is plainly visible. None of the above is showing up in my production log, but similar requests were logged an hour ago. I haven't changed any config files. I haven't restarted my server. Any suggestions as to why this is happening?
Check what value is set to
config.log_level = :warn
in your
/rails_app/config/enviroments/production.rb
FYI
The available log levels are: :debug,
:info, :warn, :error, :fatal.
So if you set the level to fatal only serious errors will be logged. If you set it to debug almost everything will be logged. By default in production it is set to warn. This is with good reason. As you don't want huge log files piling up on your production server for no reason.
In my case first i added config.log_level = :debug to production.rb file then i had to create the production.log file (in the log folder), then giving appropriate permissions with chmod command.
In my case I had the following gem rails_12factor in my Gemfile for production.
So I had to
Remove rails_12factor from my Gemfile
gem uninstall rails_12factor
bundle install
And on the next push to production the logs worked for me. FYI: I am using rails 5.2.1, but the rails web app started in rails 3.
Low memory is the most likely cause that I have been able to come up with. I will post here if I can prove it.
I solved the Problem by putting
Rails.logger.instance_variable_get(:#logger).instance_variable_get(:#log_dest).sync = true if Rails.logger
into my config/initializers/...
I was having the same problem. Tried everything out there on this website.
Finally i checked the value of Rails.logger in console. It gave following output.
#<RailsStdoutLogging::StdoutLogger:0x00007fe3b5bc3540
#default_formatter=#<Logger::Formatter:0x00007fe3b5bc3658 #datetime_format=nil>,
#formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007fe3b5bc34c8 #datetime_format=nil>,
#level=0,
#logdev=
#<Logger::LogDevice:0x00007fe3b5bc3608
#dev=#<IO:<STDOUT>>,
#filename=nil,
#mon_count=0,
#mon_mutex=#<Thread::Mutex:0x00007fe3b5bc35b8>,
#mon_mutex_owner_object_id=70307991657220,
#mon_owner=nil,
#shift_age=nil,
#shift_period_suffix=nil,
#shift_size=nil>,
#progname=nil>
Then I crosschecked with some other rails project and that gave the below output
#<ActiveSupport::Logger:0x00005566367b77c0 #level=0,
#progname=nil,
#default_formatter=#<Logger::Formatter:0x00005566367b7950 #datetime_format=nil>, #formatter=#<Logger::Formatter:0x00005566367b7770 #datetime_format=nil>,
#logdev=#<Logger::LogDevice:0x00005566367b7900 #shift_period_suffix=nil, #shift_size=nil,
#shift_age=nil, #filename=nil,
#dev=#<File:/home/rajanverma/workspace/aarvy/log/production.log>,
#mon_mutex=#<Thread::Mutex:0x00005566367b7888>, #mon_mutex_owner_object_id=46948744543360,
#mon_owner=nil, #mon_count=0>>
You can clearly see that both projects were using different loggers to show output. I don't want to output log on STDOUT so I changed my logger to ActiveSupport by creating an initializer file.
config/initializer/logger.rb
Rails.logger = ActiveSupport::Logger.new('log/production.log')
Now it started logging on production.log.
EDIT: I tried doing the same in production.rb, but don't know why it always got overwritten. So i decided to put in initializer. I don't know weather it has any performance issues. Also I don't know how it was changing automatically to #<RailsStdoutLogging::StdoutLogger:0x00007fe3b5bc3540 as writing on production.log should be a default behaviour. Please let me know if you know better reason.
I had the same problem related to production log.
To trace back issue with web server:
tail -f /var/log/apache2/error.log
Message from application: Permission denied - /var/www/APPLICATION-NAME/log/invitation.log (Errno::EACCES)
cd /var/www/APPLICATION-NAME/log
using the comman ll you will get log permissions
total 28
drwxr-sr-x 2 www-data www-data 4096 Sep 18 03:55 ./
drwxrwsr-x 14 www-data www-data 4096 Sep 24 23:52 ../
-rw-r--r-- 1 root www-data 71 Sep 18 03:55 agent_invitation.log
-rwxrwxrwx 1 root www-data 71 Sep 18 03:55 email.log*
-rw-r--r-- 1 root www-data 71 Sep 18 03:55 invitation.log
-rw-r--r-- 1 root www-data 71 Sep 18 03:55 messages.log
-rw-r--r-- 1 root www-data 51 Sep 13 01:32 production.log
Solution:
Have to change owner from root to other user:
chown www-data:www-data ./ -R
Now use ll to see the permissions
total 28
drwxr-sr-x 2 www-data www-data 4096 Sep 18 03:55 ./
drwxrwsr-x 14 www-data www-data 4096 Sep 24 23:52 ../
-rw-r--r-- 1 www-data www-data 71 Sep 18 03:55 agent_invitation.log
-rwxrwxrwx 1 www-data www-data 71 Sep 18 03:55 email.log*
-rw-r--r-- 1 www-data www-data 71 Sep 18 03:55 invitation.log
-rw-r--r-- 1 www-data www-data 71 Sep 18 03:55 messages.log
-rw-r--r-- 1 www-data www-data 51 Sep 13 01:32 production.log
Restart you web server:
sudo service apache2 restart
now check production logs.