Sysfs is a Linux filesystem, normally mounted on /sys, which provides information about hardware and kernel components.

learn more… | top users | synonyms

1
vote
0answers
44 views

when running `udevadm test`: `no db file to read /run/udev/data/+gpio_sw:PA7: No such file or directory`

I am trying to write an udev rule that matches a GPIO Pin of my Orange Pi (the GPIOs use the gpio-sunxi kernel module). My ultimate goal is to let users who are member of a particular group access ...
1
vote
0answers
44 views

Reconstructing dmidecode binary dump from /sys/firmware/dmi/tables

Background dmidecode utility is able to create a raw binary dump using --dump-bin option: root@here:~$ dmidecode --dump-bin foo.dump which can be re-used on another machine, producing effect as if ...
3
votes
2answers
125 views

sysfs and devtmpfs

Ok, Ulrich Dangel explains very well the difference between devtmpfs and udev but what happen with sysfs I understand that the kernel use sysfs to export device nodes to user space to be used by udev, ...
1
vote
0answers
30 views

A/D pins always read max (1023)

I am using the Aria G25 board from Acme Systems. I have their Terra board breakout. I have also asked this question on their google groups but thought it might be a more general issue so have posted ...
0
votes
0answers
58 views

Getting the block device from an udev scsi_disk subsystem (udev C API)

I am using the udev C API to monitor connection and disconnection of SATA drives. struct udev_monitor *mon; mon = udev_monitor_new_from_netlink(udev, "udev"); ...
1
vote
1answer
52 views

Are Modules listed under /sys/module all the Loaded Modules?

I'm wondering if I can use the directory listing of /sys/module instead of lsmod to get a list of currently loaded modules. Is that the list of loaded modules only? Or maybe that combined with ...
3
votes
2answers
404 views

What is the difference between /sys/block/sda1/stat and /sys/block/xvda1/stat?

On my local machine, I have /sys/block/sda1/stat. On an Amazon machine, I have /sys/block/xvda1/stat. When I run cat /sys/block/sda1/stat or cat /sys/block/xvda1/stat both give 11 fields of output. ...
2
votes
1answer
221 views

What is the relationship (similarity and differences) between /proc/devices and /dev entries in Linux?

When we register a driver, the "name" parameter shows up in /proc/devices, yet we can write to the devices using the entry in /dev corresponding to the device. What are the core ideas behind /proc and ...
3
votes
1answer
106 views

Why am I able to write a module parameter with READ ONLY permissions?

I wrote the following simple linux kernel module to test the param feature: #include<linux/module.h> int a = 5; module_param(a, int, S_IRUGO); int f1(void){ printk(KERN_ALERT "hello ...
21
votes
4answers
1k views

Making Linux read swap back into memory

The Linux kernel swaps out most pages from memory when I run an application that uses most of the 16GB of physical memory. After the application finishes every action (typing commands, switching ...
1
vote
1answer
103 views

Reading from sysfs returns EINVAL

box101:~ # cat /sys/class/net/eno1/carrier cat: /sys/class/net/eno1/carrier: Invalid argument What the...? OK, so what does strace say? ... open("/sys/class/net/eno1/carrier", O_RDONLY) = 3 ...
2
votes
1answer
98 views

Managing settings from /sys directory in arch

I can manage /proc directory settings with sysctl and config files in /etc/sysctl.d but is there equivalent tool for the /sys directory? I want to change the I/O scheduler to bfq permanently. Should ...
0
votes
1answer
73 views

How to figure out primary/secondary IDE channel via sysfs (if possible)

Though I've got quite a good basic understanding of sysfs meanwhile, there are still things I cannot solve on my own. For a starter, I'd like to figure out via sysfs (later by scripting of course) ...
4
votes
1answer
667 views

Difference between /dev and /sys

Exactly what is the difference between devfs and sysfs? Both seem to maintain a list of hardwares attached to the system. Then why the need for 2 separate fs even arose? As far as I can get /sys ...
1
vote
1answer
437 views

Allow non-root user go get network traffic statistics

I know that I can use cat /sys/class/net/eth0/statistics/rx_bytes to see the amount of received bytes. Sadly I only can run this command as root. When I am another user, I get cat: ...
4
votes
0answers
2k views

Is it possible to get network interface index not via /sys?

So what I'm looking for is an interface index (or name) but the real one. if_nametoindex(3) and ioctl(2) don't seem to help me here. Now the only way I found how to do this is via /sys. Let me ...
3
votes
1answer
882 views

Getting information from sysfs

I'm creating a script for polling information about network interfaces. For this I get some data from /sysfs. Everything went fine until I wanted to clarify all possible states of an interface (Which ...
7
votes
1answer
87 views

How do I know what decompression algorithms are compiled-in into the linux kernel?

If /proc/config.gz is unavailable, how do I know what decompression algorithms the running kernel is capable of using on a compressed cpio initramfs? Is the gzip algorithm always available, even when ...
3
votes
1answer
229 views

How do I find out what filesystem drivers are compiled-in into the linux kernel?

On a running linux system, what is a portable (among linux distributions) way to find out what filesystems the current kernel has compiled-in (not through modules) support for? Consider for example ...
1
vote
1answer
216 views

Accessing GPIO after kernel boots

my rootfs.cpio has only following files: [root@localhost extract]# ls dev init tmp dev has console only. init is cross-compiled from the program given at the end: Then I make a my image and ...
2
votes
1answer
344 views

USB modalias. Meaning of numeric values

For the USB modaliases, I know that the values corresponding to the device's vendor and product ids can be found here: http://www.linux-usb.org/usb.ids Which online resources and/or kernel source ...
14
votes
1answer
6k views

Difference between /dev and /sys/class?

What is the difference between the device representation in /dev and the one in /sys/class? Is one preferred over the other? Is there something one offers and the other doesn't?
4
votes
4answers
7k views

Unable to write to a GPIO pin despite file permissions on /sys/class/gpio/gpio18/value

This is on a Raspberry Pi. Here's the output of sudo ls -lL /sys/class/gpio/gpio18: -rwxrwx--- 1 root gpio 4096 Mar 8 10:50 active_low -rwxrwx--- 1 root gpio 4096 Mar 8 10:52 ...
0
votes
1answer
2k views

/sys/class filesystem on Linux

On Linux (Ubuntu 11.10 on a ARM processor in my case) I was looking for a way to measure CPU temperature. I found out that a cat /sys/class/thermal/thermal_zone0/temp did the trick. Now I wonder: ...
3
votes
3answers
2k views

How to find out easily whether a block device (or a part of it) is mounted somehow

I want to know what the easiest way is to determine (without root privilege) whether a block device (say sdb) or any part of it is mounted (and which part of it). Checking /proc/mounts for sdb is not ...
3
votes
1answer
2k views

Kernel recognizes USB device but then I can't find it in /sys or /dev

When I connect my Samsung 390G (a cheap cell phone!) to Ubuntu 13.04, dmesg seems to indicate that the storage device thereon is recognizable: [Sun Dec 29 01:26:10 2013] scsi16 : usb-storage ...
3
votes
2answers
1k views

Kernel module parameters vs /sys/class/… explanation

I was making (my first) kernel module to play with the gpio pins of my pandaboard and interrupts. Already "built-in", I noticed you can do (briefly) cd /sys/class/gpio echo 138 > export # a file ...
7
votes
2answers
1k views

Which of proc, sys etc. should be bind-mounted (or not) when chrooting into a “replacement” distribution?

This answer to another question basically boils down to chrooting into another Linux distribution in order to mainly use that as a replacement to its too restricted (but irreplaceable) parent. The ...
3
votes
1answer
145 views

Finding a char device in /sys using a Bash script?

I have one of these and I am trying to write a Bash script for finding the device path in /sys. My approach goes something like this: start in /sys/modules/usbled since this is the name of the ...
3
votes
1answer
358 views

Using Bash to write to a device in /sys?

I have one of these: Basically, it's a USB device with three LEDs (red, green, and blue). The Linux kernel has supported this device through the usbled module for quite some time now. However, I ...
5
votes
2answers
288 views

Can you identify transport via sysfs?

I'm writing a script, and I'm interested in being able to identify the transport class (fc - "fibre channel", scsi, iscsi, etc.) for a given block device. I can retrieve this information via ls -l ...
2
votes
1answer
295 views

CONFIG_GPIO_SYSFS makes /sys/class/leds disappear

I have an embedded Linux board I'm working on, with a button and a couple LEDs. By default, I can control the LEDs via /sys/class/leds/redled/brightness However, I have no way to monitor the ...
8
votes
3answers
4k views

Why does rsync fail to copy files from /sys in Linux?

I have a bash script which uses rsync to backup files in Archlinux. I noticed that rsync failed to copy a file from /sys, while cp worked just fine: # rsync /sys/class/net/enp3s1/address /tmp ...
2
votes
0answers
2k views

How to retrieve sysfs devpath of a USB flash drive given its corresponding partition sysfs path?

I have a USB flash drive connected to a hub. Its storage device partition devpath in sysfs is /devices/pci0000:00/0000:00:12.2/usb6/6-1/6-1.2/6-1.2:1.0/host10/target10:0:0/10:0:0:0/block/sdb/sdb1. I ...
1
vote
2answers
590 views

Is there a generic approach to automatically make some sysfs controls ch{own,mod} user-accessible?

My current primary question motivator: $ ls -l /sys/devices/platform/samsung total 0 -rw-r--r-- 1 root root 4096 27. jaan 14:17 battery_life_extender drwxr-xr-x 3 root root 0 19. jaan 18:40 leds ...
11
votes
3answers
4k views

How does systemd-tmpfiles work?

I'm trying to change the value of /sys/bus/usb/devices/4-3/power/wakeup at every boot (4-3 according to my lsusb, it's the keyboard ID). The default value is: # cat ...
0
votes
0answers
359 views

Settings value in /sys/devices/platform/i8042/serio1/serio2/speed as no effect

I'm following this tutorial to ajust the TrackPoint speed for my Lenovo T420. However, setting a value in /sys/devices/platform/i8042/serio1/serio2/speed has no effect. The trackpoint is unaffected ...
15
votes
4answers
543 views

How do I learn what I can do with /proc and /sys

I'd like to know more about the advanced uses of the /proc and /sys virtual filesystems, but I don't know where to begin. Can anyone suggest any good sources to learn from? Also, since I think sys has ...