Connecting to ALSA - linux

When I try to connect to the ALSA sound system as another user on one of our machines I get the following message- "ALSA lib pcm_dmix.c:975:(snd_pcm_dmix_open) unable to create IPC semaphore". The machine has been logged in as another user in our system. It doesn't matter if I use aplay or my application I get the same message. If I run as root the application connects to the ALSA system and plays the sound. If I su to the user who is logged into the console I get the same failure.
Does anyone have any ideas? I have tried to use setcap on my program but this failed due to "Operation not supported". This maybe because my application is on a NFS mounted partition.

Try setting ipc_key_add_uid in your .asoundrc file. see ALSA documentation on pcm plugins for more information.

Related

Serial port unavaliable arduino

Trying to upload a code to arduino, but whether in the Arduino IDE or Arduino Create, both return this erro while uploading. Running on Linux Tara(mint 19 cinnamon).
./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -logger humantags -fqbn arduino:avr:mega:cpu=atmega2560 -build-cache /tmp -build-path /tmp/716441957/build -verbose -libraries /tmp/716441957/custom -libraries /tmp/716441957/pinned /tmp/716441957/sketch_oct8a
Sketch uses 8280 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 443 bytes (5%) of dynamic memory, leaving 7749 bytes for local variables. Maximum is 8192 bytes.
Programming with: Serial
Flashing with command:/home/jesus/.arduino-create/arduino/avrdude/6.3.0-arduino9/bin/avrdude -C/home/jesus/.arduino-create/arduino/avrdude/6.3.0-arduino9/etc/avrdude.conf -q -q -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino-create-agent734074237/sketch_oct8a.hex:i
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
1#
First, check the port in your IDE. In Arduino tools->port
If the port is hidden or you can not move the cursor over this then run this commands in your terminal.If everything ok then skips this and follow the second part.
sudo apt-get install librxtx-java -y
sudo usermod -aG dialout $USER
sudo apt-get install gnome-system-tools
2#
After this again check the first method. If it is not working then run this commands
ls -l /dev/ttyACM*
sudo usermod -a -G dialout <username>
You probably have another program running which is already using this port.
You should close most other programs like putty or another serial monitor app.
Otherwise, try to reconnect the Arduino to the PC.
I know that these ideas below come from using a Teensy, but they may help you.
Sometimes there are the ACM* ports listed in the Arduino IDE. Try looking at the ser ports. I know when I am running my Teensy, sometimes I have them switched and need to select the correct one.
Also, from my experience with the Teensy, you might need to add a udev rule to allow permissions to access the port from non-root user. Here is the link that shows the udev file.
There is no direct way to solve this issue. In addition to it, you are not using an IDE. I will list the things you need to check, I am sure this will solve your problem.
I am not good at Linux environment so I will refer to applications names as window, you go the corresponding application in Linux.
Go to linux device manager and see for your arduino board. It should have proper naming like "arduino uno at port 3", then use the correct port in your command. If this name does not come properly then it means Driver is not available in your machine. So, go to step2.
Find the driver online and install it in your system, I am not sure about the support of linux with arduino, once it is done please repeat step1.
So, I conclude in short that you do not have the proper driver (which is strongly believe) or pointing the wrong port. I am not an expert with the udev rules, but it is definitely an issue you can experience with these kinds of micro-controllers.

Bluez Library access as non root user

I have developed BLE scanning application using bluez4 library APIs.I am able to run application using root user but because of security reasons it will be required for me to run application with non root user.
Using setcap package I am able to do "hcitool lescan" as a non root user,
=> sudo setcap 'cap_net_raw,cap_net_admin+eip' which hcitool
=> getcap !$
getcap which hcitool
But these changes does not work while running my ble scanning application as non root user and it got stuck with API "hci_send_req" which returns error "Failed to set scan parameters data.Operation not permitted".
Please some one can help me on this.
Regards
Nishith
Maybe two years late, but I was getting the same error and the answer was quite simple.
You just need to perform a setcap operation on the binary file that you want to execute so it can get access to bluetooth operations. The command is as follows:
sudo setcap 'cap_net_raw,cap_net_admin+eip' /absolute/path/to/your/executable/file
Hope that helps!

running wireshark from chroot jail

hi I want to run wireshark from inside a chroot jail.
but when i run it it gives following error:
WARNING: no socket to connect to
I have tried and search everywhere but no explanation so far.
Even if it does not work I want to understand why it is not working.
Wireshark uses GnuTLS to try to decrypt SSL/TLS connections.
Apparently GnuTLS uses gnome-keyring on some systems, and gnome-keyring is probably what's printing the messages.
My guess is that it's trying to connect to some daemon running on your machine over a UNIX-domain socket, but the chroot jail is preventing it from accessing the socket.
If that's not preventing Wireshark from running, just ignore the warning.
If it is preventing Wireshark from running ("I get a warning when I run X" is not the same as "X doesn't run"), you might not be able to run Wireshark in a chroot jail, unless there's some way to let gnome-keyring connect to that daemon from inside the jail.

Raspbian Wheezy Owncloud and NFS together

I am trying to setup a file/DLNA server on raspberry pi (raspbian wheezy) for the files to be shared by all the devices I use - android and Linux to the minimum.
I have a USB drive with some decent storage where I have all my files. So far, I had NFS and dlna serving the USB drive contents.
Recently, I installed owncloud. It required the owncloud data directory to be owned by www-data. I have mounted (from fstab) the USB drive with options rw,user,uid=33,gid=33,mask=007. The owncloud worked fine (though it is very slow to render the contents).
My nfs exports is as follows:
/owncloud_data/mystuff *(rw,all_squash,anonuid=33,anongid=33,no_subtree_check)
My shomount -e localhost displays the following:
Export list for localhost:
/owncloud_data/mystuff (everyone)
However, when I issue
sudo mount localhost:/owncloud_data/mystuff /my_nfs
I get the following error:
mount.nfs: access denied by server while mounting localhost:/owncloud_data/mystuff
I don't understand why. I kind of guess that this is because the /owncloud_data/mystuff is owned by the www-data. But, the nfs-server is run as root; should it not be able to read the data? Or am I missing anything in this regard? I dont get any useful logs in the /var/log/messages; I tried including the --debug all option in the nfs config.
I haven't started with the dlna yet (I have installed minidlna which was working with NFS before I installed the owncloud).
OR, is there a better solution for what I am trying to do?
Please let me know if you need more information in this regard.
Thanks
I wont tick this as an answer. It is a work around.
The problem is if I export the /owncloud_data/mystuff the nfs mount is not working. If I export all /owncloud_data, it is working fine (along with the export options I have mentioned in the original post). I just mount /owncloud_data/mystuff on the client side (though technically I can mount /owncloud_data there).
I will be happy if anybody can explain this behaviour and solve to export /owncloud_data/mystuff.

Device node getting created but device driver not getting linked

I have written a simple device driver. Only loading the module my device file is getting created. But when my application tries to open the device file I am getting an error -1 (operation not permitted). When I have tried to look at device characteristics by executing the command:
$udevadm info -a -p /sys/class/char/<devname>
I get the output:
KERNEL=="<devname>"
SUBSYSTEM=="char"
DRIVER==" "
So apparently my device node is not getting linked to the device driver.
Can anybody please help me out with this.
Thanks
Have you checked the permissions on the device node udev created?
Udev manages the permissions of those device nodes, and unless you're running as root it's quite likely you're not allowed to read/write from/to the device node.
Edit
If you're running as root the permissions on the device node won't be a factor. Please show us the content of /proc/devices, the output of ls -la /dev/my-device-node and your code.

Resources