Cannot enable PRU on Beaglebone Black - linux

I am trying to enable the PRU module on my BeagleBone Black, but I came across two errors.
The first one, is when I am trying to activate it:
echo BB-BONE-PRU-01 >/sys/devices/bone_capemgr.9/slots
and I get this error:
-sh: echo: write error: No such file or directory
And the second one comes up when I try to run a simple example, like this:
./PRU_memAccessPRUDataRam
with this error:
./PRU_memAccessPRUDataRam: error while loading shared libraries: libprussdrv.so: cannot open shared object file: No such file or directory
Ho you have any ideea on how can I resolve this two issues? Thank you!

Re first question: check whether your file system has /sys/devices/bone_capemgr.9 or /sys/devices/bone_capemgr.8. Many use the command: >sudo echo BB-BONE-PRU-01 >/sys/devices/bone_capemgr.*/slots, so it doesn't matter; note also the need for sudo unless you have previously done a sudo su or have logged in as root (not normally recommended).
Re second question: it may be related to first problem. Also, see: http://www.element14.com/community/community/knode/single-board_computers/next-gen_beaglebone/blog/2013/05/22/bbb--working-with-the-pru-icssprussv2. As explained in Step 1), do an >lsmod to see if pru is enabled. If not, you can do a >modprobe uio_pruss or better, change the device tree loaded at bootup (am335x-boneblack.dtb) to have the pru parameter status = "disabled" changed to status = "okay". The link above, authored by Shabaz, is the most useful and understandable link I have found in about a year (on and off) of working with the BBB; it's well worth going through everything there as a tutorial.

Related

Screen error: Can't locate local/lib.pm in #INC (you may need to install the local::lib module)

I'm new to linux coding and have just been given an account on a server at work. I don't have sudo permissions. For some unknown reason, the 'screen' program has suddenly stopped working. Every time I try to open a screen session I get the following error
Can't locate local/lib.pm in #INC (you may need to install the local::lib module) (#INC contains: /home/user/perl5/lib/perl5/x86_64-linux-thread-multi /home/user/perl5/lib/perl5 /home/user/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/user/miniconda3/lib/site_perl/5.26.2 /home/user/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/user/miniconda3/lib/5.26.2 .).
BEGIN failed--compilation aborted.
I've tried opening up my .bash_profile and .bashrc to delete any lines referring to perl or the local::lib, and I don't have permissions to install the local::lib myself. I've tried navigating to the directories listed in the error message but they also don't exist. I also tried reinstalling perl and screen into a conda environment but screen needs to be activated before the environment so I just got the same message. Both perl and screen are still installed as I can print the version.
I have no idea why screen suddenly stopped working as I don't think I did anything, and it was working perfectly fine for the first few weeks. Any ideas/help would be much appreciated!
See #dave-mitchell's comments to what local::lib is, but as for how to solve the problem, you'll probably need to install local::lib yourself in your home directory. This does not require administrative access using the bootstrap method as outlined in the local::lib documentation:
https://metacpan.org/pod/local::lib#The-bootstrapping-technique
Following that, cpanminus (cpanminus) should be able to install most perl modules using the --local-lib option as needed.
However, if this is simply a problem with screen itself not working, and you don't care about perl modules per se, then I would recommend installing tmux as an alternative to screen which is also possible to do without administrative privileges (see this superuser question) and is widely considered to be a superior option

"libz.so.1: cannot open shared object file: No such file or directory"

I am getting this error as:
apt-get: error while loading shared librarie: libz.so.1:cannot open shared object file: No such file or directory
When trying:
sudo apt-get zlib1g
I'm using a Ubuntu 16.04 os and i can't log into the graphic interface, after booting I can only see a blinking underscore on the top left corner of the screen, so i pressed "alt+f4" to open a terminal session.
In my commands historical I found the command:
rm -rf zlib-1.6.37
(That command was executed from the root directory of my user.) And i don't know if that is the cause.
I do need some solution to thia problem as soon as possible please.
If you need some more info just ask for it, I will reply with the answer as soon as I can.
Ok, I've figured it out, it was quite simple, but i just got desperate
The solution was just to recreate the symlink that was damaged (libz.so.1) and that fixed the problem, now I have another issue, it seems like I'm connected to network but i don't have internet at all anyway that's for another question.
Thanks if somebody tried helping me, even if the question just have like 2 hours from posted.

Adding path to CUDA libraries without sudo access

I used a library (the library is called cublas) in my CUDA code which I 'm writing in linux, I can compile my code successfully using nvcc but when I run the code I get this error:
error while loading shared libraries: libcublas.so.7.5: cannot open shared object file: No such file or directory
I found This link as a solution which suggests to run some commands in order to solve the issue. one solution based on this link is running the following command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
The system which gpu locates in it and I am using to run my code on it is shared between me and other people, I am not a sudo user in that system. I am wondering if running this command is safe and does not affect other settings of the system
Can anyone please help me to know that>
Thank you so much
I am wondering if running this command is safe and does not affect other settings of the system
Yes, you'll be fine.
This command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
only affects the process you execute it in.
It will not affect any other user's process, or any other process of yours.
Furthermore, if you log out and log in again, you will have to execute that command again. It is not "sticky"

Xorg keeps throwing series of errors

Currently running: Arch linux 4.0.7-2
I've worked with X11 for a while without any trouble. Until recently after a reboot the following error came up: No screens found. I looked up similar questions but none of them had the answer required. I tried to remake my configuration file but that wasn't possible either due to Number of created screens does not match number of detected devices. Configuration failed.
I spend hours trying to find a fix but nothing worked, I tried re-installing every single package I had and removed everything to bare. Unfortunately no luck.
I then went and reinstalled entire Arch linux but to my surprise the first error to appear when trying to make a configuration file was No devices to configure. Running startx however gives me a set of floating terminals but freezes entirely.
lspci -vvv http://ix.io/juQ
/var/log/Xorg.0.log http://ix.io/juR
I'm kind of clueless right now. Any help would be much appreciated.
I think that the problem is located in that line of your log:
[ 355.070] (II) Loading /usr/lib/xorg/modules/drivers/i740_drv.so
[ 355.079] (EE) Failed to load /usr/lib/xorg/modules/drivers/i740_drv.so: /usr/lib/xorg/modules/drivers/i740_drv.so: undefined symbol: I740_Sync
It seems that this file is missing, googling a little i found that archlinux forum post, that probably will help you:
https://bbs.archlinux.org/viewtopic.php?id=176555
What you need to do, is simply run that command:
pacman -Sf `pacman -Qqet`
And maybe it solve the problem (there are no more answers to that post, so i'm not sure if it works)

writing to /dev/uinput (on ubuntu 12.04)

I'm developing a little program that creates virtual joysticks on linux, with a python front end. It is a fork of Linux-Virtual-Joystick.
I need to write to dev/uinput in order to create the user-defined joystick.
The file is opened with O_RDWR (I temporarily added read/write access others for the file whilst debugging). When I do
write(uifd, &uidev, sizeof(uinput_user_dev));
it returns -1 and sets errno to 22(EINVAL). The arguments are correct, and the file was successfully opened.
Did anyone else encounter this problem? I shelved the project for about a month, but I remember that it worked in the last version of Ubuntu.
Update: uinput works on ubuntu 12.10
I think the problem you have is with access rights to uinput. The error message you receive is typical of that and I have seen the identical behaviour before with other devices.
In order to test that assumption, change the /dev/uinput permissions to allow access to all:
chmod +0666 /dev/uinput
Then try again your code. If now it works fine, you will need to make that change permanent, since otherwise it will revert back to the original permissions after reboot.
To do that in a safe fashion, add a rule file to be located at: /etc/dev/rules.d
with the following line:
KERNEL=="uinput", GROUP="udev_group"
To see how a rule file should look like, check the udev rules file located at:
/lib/udev/rules.d/50-udev-default.rules
When ready, add a a group named udev_group and add your user name to it (or any user that is supposed to have write access to uinput).
You may need to reboot to get the new rule working.
The outcome would be that any user who's member of that group will have full access to uinput, which is exactly what you wanted.
to add the group you can install "Users and Groups":
sudo apt-get install gnome-system-tools
and launch it at:
Application -> System Tools -> Administration -> Users and Groups**
or in terminal:
gnome-system-tools
Since uinput module is missing, you should consider building it before going further.
I've never rebuilt a Linux kernel module this way, so you can follow the explanation here
First, you need to get the corresponding Linux source code and headers. Also install module-init-tools
Then, change dir to /usr/src/linux and do as root
cp /boot/config-* ./.config
make drivers/input/misc/uinput.ko
It'll take a minutes to build uinput.ko
Check if it works before move uinput.ko to /lib/modules/<"yourkernelversion">/kernel/drivers/input/misc
insmod ./drivers/input/misc/uinput.ko
Edit 1:
It seems that since Linux 2.6.35-17.23, uinput is a built-in module. That's why it's not shown by lsmod.
I have just taken a look at your code, and I think the problem is in this line
if (write(uifd, &uidev, sizeof(uinput_user_dev) != sizeof(uinput_user_dev)))
It should be
if (write(uifd, &uidev, sizeof(uinput_user_dev)) != sizeof(uinput_user_dev))
Hope that helps
I had this error in Ubuntu 14.04 too, from your repo (https://github.com/ferry-/Linux-Virtual-Joystick-cpp) . I fixed it by zeroing out the device::uidev member in the device constructor in device.h.
memset(&uidev, 0, sizeof(uidev));

Resources