Questions tagged [sysfs]
Sysfs is a Linux filesystem, normally mounted on /sys, which provides information about hardware and kernel components.
164
questions
1
vote
0
answers
13
views
How to run samples/rpmsg_client_sample in Linux?
I am learning RPMSG in Linux, and I found there is a samples/rpmsg_client_sample.c.
I built it into a kernel module, but I don't know how to make its probe function to be called?
And is there any ...
0
votes
1
answer
22
views
Where to create symlinks to sysfs iio files
I wrote a driver that exposes I2C registers via an IIO device, this device operates in direct mode (read/write directly to files in sysfs), the files are correctly created in sysfs and work fine.
I ...
0
votes
0
answers
17
views
Replicating 'udisks power-off' behavior (without udisks)
udisks exists for regular users, root must (and is) able to live without it, I need help figuring out how.
The goal is to do exactly what
udisks power-off /dev/sdX
does without udisks. hdparm is out ...
0
votes
1
answer
81
views
where to enable /sys/fs/cgroup/memory/0/memory.usage_in_bytes?
I try to count total memory usage in linux via /sys/fs
For this I've found /sys/fs/cgroup/memory/0/memory.usage_in_bytes in https://docs.kernel.org/admin-guide/cgroup-v1/memory.html#user-interface
i'...
0
votes
1
answer
59
views
structure /sys/fs/cgroup/memory.stat
What is the structure of linux memory via /sys/fs/cgroup/memory.stat?
what is the anon memory?
What is the file memory?
how to get the full used memory via /sys/fs?
1
vote
0
answers
62
views
Does udev have an issue with the 'hwmon' subsystem?
I have a temp/humidity sensor connected to the i2c-0 interface on a Raspberry Pi: Rpi OS ver 'bookworm'. It works fine, and I can read sensor values from the files in /sys/class/hwmon/hwmon2 (or ...
2
votes
1
answer
43
views
Why is this folder duplicated in `sysfs`?
I have a Raspberry Pi that is running the 'bookworm' version of the OS; the 64-bit version of the OS if that makes any difference. I've installed one of the SHT3X temperature & humidity sensors, ...
0
votes
1
answer
139
views
Watching for /sys/class/net file changes using systemd
I'm trying to get a systemd service to restart when some ethernet cable gets plugged in, by monitoring changes to the /sys/class/net/eth0/carrier_up_count system file.
I tried creating a systemd path ...
0
votes
1
answer
40
views
Are numbers in sysfs presented in decimal or hex?
I am looking at files in sysfs, specifically in /sys/bus/usb/devices
The files contains small numbers, expressed as two characters, for example "00"
All of the examples that I have contain ...
0
votes
0
answers
31
views
How do I check if a kobject exists?
I'm following this guide on sysfs: https://embetronicx.com/tutorials/linux/device-drivers/sysfs-in-linux-kernel/
If I use kobject_create_and_add to add a new kobject, the function will fail if the ...
1
vote
1
answer
533
views
cgroup virtual file system is read only for root, when root has write privileges?
As the title of my question suggests, I am trying to edit the properties of my cgroup virtual file system - create new directories, edit the resource limits in certain files, etc - but any write ...
0
votes
0
answers
44
views
How to modify the scale attribute of a backlight in sysfs?
How can a user change the scale attribute of a backlight that is exposed in sysfs? On my machine it's located at /sys/class/backlight/amdgpu_bl1/scale. I tried using udev to add write permissions to ...
0
votes
0
answers
105
views
Is it correct to physically remove a PCI-E device after 'removing' it via sysfs?
Sometimes I have to replace a PCI Express device, for example a network card (NIC) on a Linux server. I was always wondering if it is possible to do without downtime.
I had success with adding new ...
0
votes
0
answers
33
views
How to find out, which network device is created by an USB port?
I see a networking device in the USB bus: lsusb shows it well and it looks working well.
As a network device, it also generates a network interface. Yes, ip link ls shows them, and some of them is ...
0
votes
1
answer
56
views
can't get permissions for debug folder with a custom program
I am running a program on kali Linux. The program uses Openssl and some other networking libraries. When I try to run the program I get the output below:
Failed to open /sys/kernel/debug/ieee80211/...
0
votes
2
answers
216
views
Linux 6.7: /sys/class/graphics/fb0 is missing
What happened to this node/symlink? It used to be there for ages, linking to the primary display adapter, and I cannot find it any longer with Linux 6.7.4. I've not found anything relevant in the ...
0
votes
1
answer
93
views
Documentation of /sys/block/*/device/type
Where is documentation of /sys/block/*/device/type ?
I need information about this file .
cat /sys/block/*/device/type
0
0
5
what is this numbers meaning ?
0
votes
2
answers
595
views
cat: read error: Operation not supported for /sys/class/net/eth0/phys_*
I customized the system using Kernel 6.4.0 and Busybox, but I don't know why the three files starting with phys_ cannot be accessed, and other files in the same folder can.
# pwd
/sys/class/net/eth0
# ...
1
vote
1
answer
104
views
Why does udev rule not work on `DEVPATH=="/kernel"`?
I'm testing udev rules with a file /etc/udev/rules.d/10-test.rules.
This line:
DEVPATH=="/devices/system/node/node0", ATTR{hugepages/hugepages-1048576kB/nr_hugepages}="4"
makes /...
0
votes
0
answers
90
views
Wake notebook from sleep with USB4 wake-on-connect
I have a Lenovo T16 Gen 2 notebook with two thunderbolt 4 ports and a docking station. A usb keyboard is connected to the dock. I switch the connection of the dock between two notebooks. I want to ...
0
votes
1
answer
311
views
Who mounts /proc and /sys in GNU/Linux systems?
If you build a custom GNU/Linux system for an embedded device, do you need to execute
mount -t proc proc /proc
mount -t sysfs sysfs /sys
somewhere in init process or is this done automatically by the ...
0
votes
1
answer
142
views
How to hide file and directory under /sys in Linux?
I am working on an embedded Linux system (with kernel 5.10.24).
I am trying to disable sysfs from kernel, but I found some other stuffs relies on sysfs, so I have to enable sysfs in kernel build.
Now ...
0
votes
1
answer
233
views
KERNELS in udev not persistent across reboots
I am trying to match a device using udev and run a command every time the device is connected (via RUNS). The device (a V4L2 USB camera) is always connected to the same USB port, so I thought I could ...
2
votes
2
answers
3k
views
What are host bridges vs pci bridges in lspci output?
I am trying to understand the pcie topology on my system and the output of lspci.
My output for lspci and the tree of the pci topology:
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir/...
0
votes
1
answer
823
views
What do the different values of /sys/kernel/mm/lru_gen/enabled mean?
I wanted to check if the multi-generational LRU was active on my desktop, so I looked at the value of /sys/kernel/mm/lru_gen/enabled. It was set to 0x0007. I felt unsure what to make of this value, so ...
0
votes
0
answers
910
views
How to find the SCSI ID of a disk in QTS?
Normally, in Linux, one can use lsscsi to map disk devices to their SCSI ID:
# lsscsi -d
[N:0:4:1] disk SAMSUNG MZVLB1T0HBLR-000L7__1 /dev/nvme0n1 [259:0]
[N:1:5:1] disk ...
0
votes
1
answer
173
views
What's inside Linux kernel sysfs holders directory?
What exactly is under the /sys/module/<module_name>/holders directory? From what I see it's all symlinks. But symlinks representing what?
1
vote
1
answer
89
views
Why can the mount points of debugfs and sysfs be overlapped?
The mount point for debugfs is /sys/kernel/debug, and the mount point for sysfs is /sys/, why can these 2 mount points be overlapped without interference?
0
votes
1
answer
565
views
Why debugfs is mounted on /sys/kernel/debug?
As far as I know, /sys/ is for sysfs, why debugfs is mounted under the /sys/ directory? Why not just mount it under /debug/ to make it clearer?
1
vote
0
answers
790
views
Permission denied of sysfs attribute file
As part of firewall implementation I am implementing a sysfs device, which attributes are defined by:
#define FILE_PERMISSIONS S_IWUSR | S_IRUGO
static DEVICE_ATTR(sysfs_att, FILE_PERMISSIONS, display,...
1
vote
2
answers
2k
views
how can I make sysfs parameter value persist for each reboot?
I have to write some sysfs parameter files and each reboot. I wonder if there is a way to automatically set those as early as possible, preferably even during initramfs. Is there canonically way to do ...
1
vote
1
answer
212
views
Is there ever a reason to query ioctl for hardware info when we have sysfs?
My assumption is that sysfs is built using ioctl queries, meaning all the information you would want (or at least most of it) is already available by simply reading files on sysfs. I notice some ...
1
vote
1
answer
523
views
What data does /sys/module/notes hold?
I want to know what type of data the notes subdir holds in a specific /sys/module entry, however the man 5 sysfs of /sys/module is not fully documented yet. There must be some documentation around it ...
4
votes
1
answer
961
views
can't write to /sys/devices/system/cpu/cpufreq/*/energy_performance_preference when ac-adapter is connected
AC-adapter unplugged:
$ echo power | sudo tee energy_performance_preference
power
$ echo $?
0
AC-adapter plugged-in:
$ echo power | sudo tee energy_performance_preference
power
tee: ...
5
votes
1
answer
9k
views
How to update/refresh changed partlabels as reported by lsblk?
On Linux, the command lsblk -o partlabel will display the partlabel for block devices.
I have used gdisk to change a partlabel.
After the change, lsblk is still reporting the old value of the ...
2
votes
1
answer
233
views
Any way to make sysfs file immutable?
I'm trying to make /sys/fs/selinux/enforce always contain "1", and prevent it from being changed.
I've been able to do this on /etc/selinux/config by running chattr +i /etc/selinux/config
...
2
votes
1
answer
340
views
Is there any good documentation on sysfs? [closed]
I'm looking for good documentation for sysfs; the man page is incomplete and even has one sentence that just stops half way through. I've found the Linux kernel documentation but that's a little bit ...
3
votes
2
answers
3k
views
How to attach a listener to sysfs files?
How to watch for sysfs file changes (like /sys/class/net/eth0/statistics/operstate) and execute a command on content change?
inotify does not work on sysfs
I don't want to poll. I want to set a ...
1
vote
0
answers
434
views
Matching PCI and Thunderbolt devices
Is there a reliable way to find which PCI devices (eg. video card) are connected via a particular Thunderbolt device (eg. eGPU enclosure, Dock) on a Linux system?
Context
In my particular use-case, I'...
3
votes
1
answer
461
views
Can I relate a USB device from /sys to a particular USB connector from Dmidecode?
Having had a bit of an internet-scour, I think the answer may be "No", but:
Can I find the USB port description (as per dmidecode) corresponding to the USB device from sysfs?
We can ...
1
vote
0
answers
99
views
sysfs: Correspondence between modules and drivers?
In sysfs, one can find which driver is handling a device. For example, the following shows that the driver handling the device led0 is called leds-gpio.
pi@raspberrypi:/sys/devices/platform/leds/leds/...
0
votes
1
answer
1k
views
Concurrent write access to character device file
I am wondering what happens when two processes write to a character device file at the same time.
Currently, I am mostly worried about /dev/spidev0.0 on a Raspberry pi.
If I assume correctly that it's ...
2
votes
0
answers
254
views
understand output and format of `udevadm info /dev/sda1`
Last time I was responsible for a unix system it was AT&T many years ago. I've finally got unix (linux) at home again. Things have changed.
I'm working on understanding udev and /sys.
The output ...
0
votes
1
answer
1k
views
Is there a reliable path to specific device events?
I'm running ubuntu linux and I have a bluetooth mouse that I would like to capture evdev events from. The problem is that the event device can potentially be different any time I connect the mouse: ...
2
votes
5
answers
2k
views
Thermal throttling on i7-1185G7
I have a brand new i7-1185G7 laptop whose CPU is being heavily throttled on Linux 5.8.0, even though it's thermals are in bounds (albeit a bit high).
$ sensors
ucsi_source_psy_USBC000:001-isa-0000
...
2
votes
3
answers
5k
views
Why, after unmounting cgroup v1, do I still have empty directories under /sys/fs/cgroup?
I just unmounted cgroup version 1, leaving just a single cgroup2 mount on my system.
$ mount | grep -i cgroup
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=...
0
votes
1
answer
712
views
bind ltc2947-spi driver on BeagleBone Black
Having trouble binding a SPI driver on the BeagleBone Black. The driver in question, ltc2947-spi, is in the linux mainline, but not in the beaglebone kernel tree. When I get this working, I'll submit ...
7
votes
1
answer
2k
views
Why does Linux list USB Host Controller' vendor as "Linux Foundation"?
On any PC where USB host controller is connected to the PCI/PCIE bus I see the following:
$ cat /sys/bus/usb/devices/usb1/{idVendor,idProduct,manufacturer,product,serial}
1d6b
0002
Linux 4.14.157-...
0
votes
1
answer
118
views
nvmem device tree naming pattern
In the nvmem.yml there is
properties:
$nodename:
pattern: "^(eeprom|efuse|nvram)(@.*|-[0-9a-f])*$"
I have a hard time finding the pattern in the source code itself.
Where can I find ...
0
votes
2
answers
643
views
PCI-E, sysfs and user-id permission weirdness
On our 3.X series kernel, a proprietary PCI-Express device has a proprietary kernel driver. We're seeing some weird errors on trawling PCI capabilities. I can not find any great docs - does anyone ...