For using gadgetfs I have to mount the gadgetfs filesystem to the mount point /dev/gadget. But because /dev is controlled by udev a manually created directory gets lost on each reboot. Sure, I could create the directory in some init.d-Skript but a more clean solution would be to configure udev to automatically create this directory. I'm pretty sure this must be possible somehow because there are lots of other directories in there already.
So how can I configure udev to create a /dev/gadget directory automatically?
Found the solution:
Create /etc/udev/rules/99-gadgetfs.rules with the following content:
ACTION=="add", DEVPATH=="/module/gadgetfs" SUBSYSTEM=="module" RUN+="/bin/mkdir /dev/gadget"
ACTION=="remove", DEVPATH=="/module/gadgetfs" SUBSYSTEM=="module" RUN+="/bin/rmdir /dev/gadget"
Restart udev or run this command:
udevadm trigger
Now when running modprobe gadgetfs udev automatically creates the /dev/gadget directory which can then be mounted. rmmod gadgetfs automatically removes the directory.
Related
I am trying to do an NFS mount using CHEF. I have mounted it successfully. Please find the below code.
# Execute mount
node['chef_book']['mount_path'].each do |path_name|
mount "/#{path_name['local']}" do
device "10.34.56.1:/data"
fstype 'nfs'
options 'rw'
retries 3
retry_delay 30
action %i[mount enable]
end
end
i am able to successfully mount and make an entry in fstab file. But, after mounting the user:group for the mount linked is changing to root:root , which i was not expecting.
i want to use myuser:mygroup as owner:group. I tried changing the same using chown command but am getting permission denied issue
request some guidance
As mentioned in the comment, this is not something Chef controls per se. After the mount, the folder will be owned by whatever the NFS server says. You can try to chmod the folder after mounting but that's up to your NFS configuration and whatnot as to if it will be allowed.
I have written my gpio driver and register it with the system using udev. This created all my device files but the permission they are created is 600. how can I change this default permission to 666 or any other. Since I have to run my program reading this file using sudo.
Should i write any rules in udev.. please explain.
Or should i change operating permission of my program within my program itself to root.
Update: my udev rules.d contains
40-scratch.rules:
ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0003", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev"
and 99-input.rules:
SUBSYSTEM=="input", GROUP="input", MODE="0660"
and udev.conf:
udev_log="err"
I need to run a script when my frambe buffer (/dev/fb?) device is loaded. So, for testing, I used a udev rule (called 98-framebuffer.rules) like that:
KERNEL=="fb0", RUN+="/bin/touch /tmp/test"
The file is not being created when the system starts. What have I done wrong?
udev rules are loaded during the boot process. Check dmesg out after rebooting. Your rule is being executed after your mount.
The rules file is called 50-ioio.rules and the the text is:
ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", SYMLINK+="IOIO%n", MODE="666"
I copied this file to the udev rules directory using:
sudo cp 50-ioio.rules /etc/udev/rules.d
I then restarted udev using:
sudo restart udev
However when I connect the IOIO board via a USB cable and look for the serial port with
ls /dev/IOIO*
It is not being created? I cant find any errors in syslog or anything in dmesg or lsusb - I suspect the udev string is wrong but it is in the documentation for the device?
I restarted the whole box and it got discovered, its not the real answer but at least I can progress
I have Raspberry Pi (with Raspbian) and using it as DLNA/UPnP server and renderer. I run minidlna as DLNA server and i have some media files on USB.
I would like to automaticaly rebuild DLNA DB when drive is mounted and unmounted. This is done by command:
sudo service minidlna force-reload
Is threre any way how to autorun this command?
BTW I use "USBmount" package for automount USB drives.
Thanx
You can do this using the tool usbmount.
It has the possibility to add scripts that will be run on mount/umount events in /etc/usbmount/mount.d/ and /etc/usbmount/umount.d/.
Start by finding your device in lsusb. Note the ID (eg 12f5:a91a)
Create a new udev rules file in /etc/udev/rules.d/ eg /etc/udev/rules.d/100-my-mount.rules and write a new rule in there like this:
ACTION=="add", ATTRS{idVendor}=="12f5", ATTRS{idProduct}=="a91a", RUN+="/home/your_username/bin/my-mount-script.sh"
For unmounted device use ACTION=="remove" in rule and another script.