Monday, January 18, 2021

Nagios Core - Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!

 Setting up a new Nagios Core installation and I ran across the following error message:
Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!

If you search for this error, you'll find a lot of posts saying to set SELinux to Permissive or Disabled. This (and many other SELinux issues) is easily solved while leaving SELinux Enforcing. First, verify that SELinux is the culprit: 
tail -f -n 0 /var/log/audit/audit.log

Could pipe to "grep denied" if you wanted. Do whatever you did to get the error again, and you should see some new lines come in like this:

type=AVC msg=audit(1609875518.415:72426): avc:  denied  { getattr } for  pid=951704 comm="cmd.cgi" path="/usr/local/nagios/var/rw/nagios.cmd" dev="dm-0" ino=68793599 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=fifo_file permissive=0
What you need to do is use audit2allow to build policy to instead allow the denied action. So copy the single offending line of audit.log and run the following:
# echo "<replace-with-the-denied-error-message>" | audit2allow -M <some-name>
So mine looked like:
# echo "type=AVC msg=audit(1609875518.415:72426): avc:  denied  { getattr } for  pid=951704 comm="cmd.cgi" path="/usr/local/nagios/var/rw/nagios.cmd" dev="dm-0" ino=68793599 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=fifo_file permissive=0" | audit2allow -M nagios_1
Then load the new policy:
# semodule -i nagios_1.pp
Wait a few seconds and the new policy will be in effect. Tail your audit.log and try the action again. Second time around I got a new error in the web-gui:
Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update! 
If you get another "avc denied" message take that and pipe it to audit2allow and load the new policy. Rinse/repeat until you stop getting denied messages and the action you were trying works. For the Nagios Core command I needed to do this 3 times total, but end result should be a working application and SELinux still enabled.
# echo <2nd-denied-log> | audit2allow -M nagios_2
# semodule -i nagios_2.pp
# echo <3rd-denied-log> | audit2allow -M nagios_3 
# semodule -i nagios_3.pp

Tuesday, September 18, 2018

Intel RST - Newest AHCI/RAID Driver by CPU Generation

Official support for various Intel chipsets gets deprecated after some period of time. Here is the most current version officially supported by each generation:


CPU GenCPU ArchSATA ControllerRST VersionRST Date
1stWestmere/ArrandaleIntel 5 Series/340012.9.0.100112/12/2013
2ndSandy BridgeIntel 6 Series/C20012.9.0.100112/12/2013
3rdIvy BridgeIntel 7 Series/C21613.0.0.10982/5/2014
4thHaswellIntel 8 Series/C22014.8.16.10634/16/2017
5thBroadwellIntel 9 Series14.8.16.10634/16/2017
6thSkylakeIntel 100 Series/C23016.5.1.10307/19/2018
7thKaby LakeIntel 200 Series16.5.1.10307/19/2018
8thCoffee LakeIntel 300 Series16.5.1.10307/19/2018

This was derived from the iaAHCIC.inf file with each x64 release. Pretty certain if you put a 2nd gen (Sandy Bridge) CPU in a supported 3rd gen (Ivy Bridge) motherboard you would use the corresponding 3rd gen driver.

Please comment if you find any different information.

Friday, January 6, 2017

Intel WiDi on 2nd Gen Intel Core CPU

Spent some time over the holidays with some relatives. After marveling that I could use miracast to display a video from my phone on their TV, they requested I set up their laptop to do the same.

Figured it would be a pretty simple request - I was wrong. The laptop in question contained a 2nd gen Intel Core i5 CPU, so although not the latest and greatest, still very adequate for their email/web-browsing use.

I was pretty certain this system supported WiDi, but wanted to verify things before proceeding. Let's take a look at the updated system requirements for Intel WiDi:
http://www.intel.com/content/www/us/en/support/emerging-technologies/000014932.html

According to this document, Intel only supports 4th Gen Intel core and newer chips with Windows 10. That's fine - software support falls off for older hardware fairly often. Luckily, the laptop was still running 7 and the .

I went to start pulling down the software only to find this fine page from Intel's website:
http://www.intel.com/content/www/us/en/support/emerging-technologies/000021693.html

Here's the icing on the cake:
"August 15, 2016 – Intel WiDi software downloads have been removed."
That's pretty lame and smells like forced obsolescence. Stopping development is one thing, removing existing packages that might be needed by customers is another.

So editorial opinions outside here's the system components and what it took to get it working.
  • Intel Core i5-2430M
  • Intel Centrino Wireless-N 1030
  • Windows 7 x64


GPU Drivers
First upgraded the GPU drivers (HD Graphics 3000). Grabbed the current release:
https://downloadcenter.intel.com/download/24971/

Intel File Version: 15.28.24.64.4229
Device Manager Reported Driver Date: 5/26/2015
Device Manager Reported Driver Version: 9.17.10.4229


Wireless Drivers
Next, upgraded the Intel PROSet wireless drivers. For whatever reason - searching for the drivers for this card on Intel's site results in only Bluetooth drivers as of this post... I finally found a matrix of OS/Wireless-Card/Newest-Driver which is worth it's weight in gold:
http://www.intel.com/content/www/us/en/support/network-and-i-o/wireless-networking/000005559.html

It pointed me to Intel PROSet ver 18.40.4:
https://downloadcenter.intel.com/download/26094

You need to make sure "Intel My WiFi Technology" is installed as part of the PROSet drivers. I was never offered the option when upgrading the existing drivers - had to use the procedure here (Use the modify option from Control Panel -> Programs and Features -> Intel PROSet Wireless, click the checkbox for Intel My Wifi Technology):
http://www.intel.com/content/www/us/en/support/network-and-i-o/wireless-networking/000005738.html

Intel File Version: 18.40.4
Device Manager Reported Driver Date: 4/30/2015
Device Manager Reported Driver Version: 15.11.0.9


WiDi Client
Last came the Windows 7 WiDi client. This was the real guessing game. Intel doesn't host it anymore - so good luck with 3rd party sites. The newest release I found (6.0.60.0) only supports 4th gen and newer CPUs. The installer will give an error message telling you what components aren't compatible to aid your guessing.

Finally found version 4.2.24.0 which worked. Google "intel wireless display 4.2.24.0" or the like to find it on sites like Softpedia, OEM support sites, etc. For whatever reason - the prior 4.2.19.0 release failed in install for me.

***EDIT*** Found a release of 4.2.24.0 direct from Intel:
https://downloadcenter.intel.com/download/23428/

Upon writing this, I see a release of version 4.2.29.0 (only on 3rd party sites) that would likely work as well - at least it looks legit. I'll try to upgrade if I get my hands on the system again. It also looks like there can be some weird upgrade bugs if you have an old version of the client installed, so it's likely best to perform an uninstall first.

4.2.24.0/4.2.29.0 are the newest WiDi clients I can find for 2nd/3rd gen CPUs. Please let me know if you find newer.


Conclusion
Using the above software packages I was able to cast the laptop's screen to the Smart TV without issue.

Overall Intel's driver site leaves something to be desired. When I couldn't find the WiFi driver (only bluetooth) I did try the Intel Driver Update Utility only to be met with the same results. Hopefully this is a quickly corrected bug.

The removal of the WiDi software from Intel's site is pretty poor form though. I guarantee this will be a trend that continues as many users hold onto systems longer.

There's a good chance that the same will work for 3rd Generation Intel Core CPUs (with their respective GPU driver of course).