ValueError: Set gpio mode failed, ... Gpios on BBB - beagleboneblack

I want to manipulate my gpios on Beaglebone black...
Example:
GPIO.setup("P8_11", GPIO.IN)
it gives back the error mentioned in the title:
ValueError: Set gpio mode failed, missing file or invalid permissions.
Thanks for help

This seems to be a problem with u-boot on the BBB. The following hack worked for me:
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=100
Run that on the BBB, then do a hard reset. This solution came from this GitHub issue.

Related

ImageMagic gives ' delegate failed `'ufraw-batch' '

{ Error: Command failed: identify: delegate failed `'ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i'' # error/delegate.c/InvokeDelegate/1919.
identify: unable to open image `/tmp/magick-53080Z_JGYvtuPOl8.ppm': No such file or directory # error/blob.c/OpenBlob/2841.
I got an issue while working with ImageMagick in my node application I did the search but can't get the proper solution for my problem.
Edit: ufraw is no longer maintained, so use at your own risk and see dcraw alternative lower down.
You need to install 'ufraw-batch'
sudo apt-get install ufraw-batch
If this does not work, as it did for me. I got a "Segmentation fault (core dumped)"
This seems to be common problem with ufraw: https://sourceforge.net/p/ufraw/bugs/
It does not seem to get update much anymore, at least not in the main repos.
Converting RAW image into other types of image you can use DCRaw (it is also used by UFRaw).
Here is an example to convert a .cr2 image to a .png:
dcraw -c -w "./IMG_1.CR2" | pnmtopng > "./IMG_1.png";
Macos:
brew install ufraw
Solved it for me

Device Tree for SPI0 not loading during Beaglebone Black Boots up

I am presently using Debian GNU/Linux 7.9 (wheezy) [Kernel version 3.8.13-bone70] on the BBB. Everything works fine until I reboot the BBB. Before rebooting, I do the following to verify If the SPI0 is enabled.
root#beaglebone:/sys/devices/bone_capemgr.9# echo ADAFRUIT-SPI0 > slots
root#beaglebone:/sys/devices/bone_capemgr.9# cat slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
**8: ff:P-O-L Override Board Name,00A0,Override Manuf,ADAFRUIT-SPI0**
The 8th slot is loaded with SPI 0
root#beaglebone:~# ls -al /dev/spidev*
crw-rw---T 1 root spi 153, 0 Feb 14 05:53 /dev/spidev1.0
Its showing spidev1.0, so its fine
root#beaglebone:~# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups
group: spi0_pins_s0
pin 84 (44e10950),
pin 85 (44e10954),
pin 86 (44e10958),
Its showing the SPI pins.
root#beaglebone:~# sudo nano /boot/uEnv.txt
I opened the uEnv.txt file and added this line, so that the SPI0 DT will load during system boot up
optargs=capemgr.enable_partno=ADAFRUIT-SPI0
Problem: Why isn't my SPI0 DT being loaded during system boot up?, after a reboot I did the first three steps mentioned above to check, but noticed that the DT fails to load after rebooting. why is this happening?
After a while of researching, I got the solution for this. Sadly, entering "optargs=capemgr.enable_partno=ADAFRUIT-SPI0" in the uEnv.txt does not load the device tress during system boot up.
One solution I found was to include line "echo ADAFRUIT-SPI0 > /sys/devices/bone_capemgr.9/slots" in /etc/rc.local as mentioned here!.
Another solution is also simple, just include the line "CAPE=ADAFRUIT-SP0" in /etc/default/capemgr file. Then reboot and all should work fine.

Showing [hello-world.upload] Error 2 in contiki

I am trying to upload hello-world in Micaz using Contiki.
I followed these steps
user#instant-contiki:~$ cd contiki/examples/hello-world
user#instant-contiki:~/contiki/examples/hello-world$ make TARGET=micaz hello-world
CC hello-world.c
LD hello-world.micaz
rm hello-world.co
user#instant-contiki:~/contiki/examples/hello-world$ make TARGET=micaz savetarget
saving Makefile.target
Finally while uploading I got the below error
user#instant-contiki:~/contiki/examples/hello-world$ make hello-world.upload
using saved target 'micaz'
avr-objcopy -O srec hello-world.micaz hello-world.srec
uisp -dprog=mib510 -dserial=/dev/ttyS0 -dpart=ATmega128 --wr_fuse_h=0xd1 --wr_fuse_e=ff --erase --upload if=hello-world.srec --verify
Error: Permission denied
-> /dev/ttyS0
make: *** [hello-world.upload] Error 1
rm hello-world.srec
I have seen many Stackoverflow questions regarding the same .
But those workaround is not solving my issues.
Am I doing anything wrong.
Please Suggest.
First of all, the problem is about permission.
Try "sudo make hello-world.upload"
And if you use Instant contiki 2.7 and it is your first time compiling with Micaz,
you may have another problem about "make: uisp: Command not found"
Then, refer following link.
http://iotnet.blogspot.kr/2014/07/contiki-micaz-2-uisp-command-not-found.html

Kdump doesn't executed on Kernel Panic

I'am trying to get kdump work an a Debian Squeeze.
I've made a dump kernel with this config
.config
The normal Kernel gets started in grub with the option crashkernel=128M
kdump tells me that the dump kernel is loaded and ready for dumping.
The kexec command that is executed by kdump also seems to work.
kexec -p --command-line="BOOT_IMAGE=/boot/vmlinuz-2.6.32-kdump root=UUID=ee9dbc96-599a-4c55-b20c-2bc2b2301581 rw 1 irqpoll maxcpus=1 reset_devices" --initrd=/boot/initrd.img-2.6.32-kdump /boot/vmlinuz-2.6.32-kdump
If i use -f instead of -p the dump kernel is loaded.
But when i trigger a crashdump with sysrq nothing happens.
Did you enable the config macro CONFIG_KEXEC? Can you add prints at the panic() function in the kernel/panic.c file and check?

Monitoring URLs with Nagios

I'm trying to monitor actual URLs, and not only hosts, with Nagios, as I operate a shared server with several websites, and I don't think its enough just to monitor the basic HTTP service (I'm including at the very bottom of this question a small explanation of what I'm envisioning).
(Side note: please note that I have Nagios installed and running inside a chroot on a CentOS system. I built nagios from source, and have used yum to install into this root all dependencies needed, etc...)
I first found check_url, but after installing it into /usr/lib/nagios/libexec, I kept getting a "return code of 255 is out of bounds" error. That's when I decided to start writing this question (but wait! There's another plugin I decided to try first!)
After reviewing This Question that had almost practically the same problem I'm having with check_url, I decided to open up a new question on the subject because
a) I'm not using NRPE with this check
b) I tried the suggestions made on the earlier question to which I linked, but none of them worked. For example...
./check_url some-domain.com | echo $0
returns "0" (which indicates the check was successful)
I then followed the debugging instructions on Nagios Support to create a temp file called debug_check_url, and put the following in it (to then be called by my command definition):
#!/bin/sh
echo `date` >> /tmp/debug_check_url_plugin
echo $* /tmp/debug_check_url_plugin
/usr/local/nagios/libexec/check_url $*
Assuming I'm not in "debugging mode", my command definition for running check_url is as follows (inside command.cfg):
'check_url' command definition
define command{
command_name check_url
command_line $USER1$/check_url $url$
}
(Incidentally, you can also view what I was using in my service config file at the very bottom of this question)
Before publishing this question, however, I decided to give 1 more shot at figuring out a solution. I found the check_url_status plugin, and decided to give that one a shot. To do that, here's what I did:
mkdir /usr/lib/nagios/libexec/check_url_status/
downloaded both check_url_status and utils.pm
Per the user comment / review on the check_url_status plugin page, I changed "lib" to the proper directory of /usr/lib/nagios/libexec/.
Run the following:
./check_user_status -U some-domain.com.
When I run the above command, I kept getting the following error:
bash-4.1# ./check_url_status -U mydomain.com
Can't locate utils.pm in #INC (#INC contains: /usr/lib/nagios/libexec/ /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5) at ./check_url_status line 34.
BEGIN failed--compilation aborted at ./check_url_status line 34.
So at this point, I give up, and have a couple of questions:
Which of these two plugins would you recommend? check_url or check_url_status?
(After reading the description of check_url_status, I feel that this one might be the better choice. Your thoughts?)
Now, how would I fix my problem with whichever plugin you recommended?
At the beginning of this question, I mentioned I would include a small explanation of what I'm envisioning. I have a file called services.cfg which is where I have all of my service definitions located (imagine that!).
The following is a snippet of my service definition file, which I wrote to use check_url (because at that time, I thought everything worked). I'll build a service for each URL I want to monitor:
###
# Monitoring Individual URLs...
#
###
define service{
host_name {my-shared-web-server}
service_description URL: somedomain.com
check_command check_url!somedomain.com
max_check_attempts 5
check_interval 3
retry_interval 1
check_period 24x7
notification_interval 30
notification_period workhours
}
I was making things WAY too complicated.
The built-in / installed by default plugin, check_http, can accomplish what I wanted and more. Here's how I have accomplished this:
My Service Definition:
define service{
host_name myers
service_description URL: my-url.com
check_command check_http_url!http://my-url.com
max_check_attempts 5
check_interval 3
retry_interval 1
check_period 24x7
notification_interval 30
notification_period workhours
}
My Command Definition:
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
}
The better way to monitor urls is by using webinject which can be used with nagios.
The below problem is due to the reason that you dont have the perl package utils try installing it.
bash-4.1# ./check_url_status -U mydomain.com Can't locate utils.pm in #INC (#INC contains:
You can make an script plugin. It is easy, you only have to check the URL with something like:
`curl -Is $URL -k| grep HTTP | cut -d ' ' -f2`
$URL is what you pass to the script command by param.
Then check the result: If you have an code greater than 399 you have a problem, else... everything is OK! THen an right exit mode and the message for Nagios.

Resources