Questions tagged [sysfs]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 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 ...
dlee1828's user avatar
1 vote
1 answer
44 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 ...
user10709800's user avatar
0 votes
0 answers
22 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 ...
basilm4r0's user avatar
0 votes
0 answers
25 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 ...
melonfsck's user avatar
  • 143
0 votes
0 answers
14 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 ...
peterh's user avatar
  • 9,731
0 votes
1 answer
42 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/...
umarkaa's user avatar
0 votes
2 answers
73 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 ...
Artem S. Tashkinov's user avatar
0 votes
1 answer
36 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 ?
mah454's user avatar
  • 308
0 votes
2 answers
331 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 # ...
just a student's user avatar
1 vote
1 answer
51 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 /...
zwhconst's user avatar
  • 125
0 votes
0 answers
51 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 ...
Simone Gaiarin's user avatar
0 votes
1 answer
193 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 ...
mrn's user avatar
  • 149
0 votes
1 answer
102 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 ...
wangt13's user avatar
  • 429
0 votes
1 answer
153 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 ...
porst17's user avatar
  • 101
2 votes
2 answers
2k 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/...
shafe's user avatar
  • 191
0 votes
1 answer
579 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 ...
Newbyte's user avatar
  • 1,036
0 votes
0 answers
605 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 ...
j4nd3r53n's user avatar
  • 715
0 votes
1 answer
141 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?
user555335's user avatar
1 vote
1 answer
74 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?
tristone's user avatar
0 votes
1 answer
426 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?
tristone's user avatar
1 vote
0 answers
646 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,...
e.ad's user avatar
  • 111
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 ...
Wang's user avatar
  • 1,296
1 vote
1 answer
187 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 ...
Bob Odenkirk's user avatar
1 vote
1 answer
448 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 ...
Daniel Kolom's user avatar
4 votes
1 answer
714 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: ...
mathway's user avatar
  • 141
5 votes
1 answer
8k 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 ...
mpb's user avatar
  • 1,611
2 votes
1 answer
198 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 ...
dcom-launch's user avatar
2 votes
1 answer
293 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 ...
nohatsatthetable's user avatar
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 ...
Zeta.Investigator's user avatar
1 vote
0 answers
353 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'...
hertg's user avatar
  • 11
3 votes
1 answer
400 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 ...
andrewf's user avatar
  • 132
1 vote
0 answers
91 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/...
Fachu's user avatar
  • 11
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 ...
Daniel D.'s user avatar
2 votes
0 answers
213 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 ...
Ernie Rael's user avatar
0 votes
1 answer
969 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: ...
shwoseph's user avatar
  • 345
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 ...
thwd's user avatar
  • 203
2 votes
3 answers
4k 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=...
Evan Carroll's user avatar
  • 30.9k
0 votes
1 answer
656 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 ...
bluesquall's user avatar
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-...
Ruslan's user avatar
  • 3,370
0 votes
1 answer
109 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 ...
vermaete's user avatar
  • 101
0 votes
2 answers
564 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 ...
NJL's user avatar
  • 3
4 votes
1 answer
4k views

How does Linux detect number of "possible" CPUs

I have an AMD CPU with 8 cores and 2 threads per core. Linux (correctly) shows this as 16 "cpus". However, sysfs actually shows 32 "possible" cpus, with 16 of them not present and ...
Nicholas Bishop's user avatar
1 vote
1 answer
3k views

Get USB device tree without lsusb

I have a USB device and would like to see what it's parent device is, i.e. which hub it is connected to. The reason is that I'm debugging an issue with sleep mode. However, this is on an embedded ...
jdm's user avatar
  • 579
1 vote
0 answers
43 views

Why does "some" line have higher delay that "full" one due to memory pressure?

I have the following stats: cat /sys/fs/cgroup/user.slice/memory.pressure some avg10=0.00 avg60=0.00 avg300=0.00 total=1954777 full avg10=0.00 avg60=0.00 avg300=0.00 total=1626895 The documentation ...
sebelk's user avatar
  • 4,399
6 votes
2 answers
637 views

Grep inside /sys file returns nothing

I want to search for a string inside the /sys/class/tty/* directories. So I tried with: # grep -rn path -e pattern but it returns nothing. Example: # cat /sys/class/tty/ttySTM0/iomem_base 0x40010000 ...
Mark's user avatar
  • 723
0 votes
1 answer
2k views

negetive width in bit field '<anonymous>' while running 'make'

Thank you for reading this question. I was trying to compile a kernel module that works with sysfs, and while executing make I ended up with this error. Can somebody please help me understand what ...
thatbangaloreanguy's user avatar
0 votes
1 answer
218 views

Easy and elegant way to toggle values in /sys/

What I really want is a NOT and write. I have files that are either 1 or 0, like /sys/class/leds/platform::mute/brightness /sys/class/leds/platform::micmute/brightness What I want is a way to turn ...
Evan Carroll's user avatar
  • 30.9k
2 votes
0 answers
1k views

how can I remove an event from /dev/input/event*

some specs: os : kubuntu 18.04 driver : thinkapad_acpi 0.26 laptop : thinkpad x1 yoga gen4 I got a new laptop. It's a 2 in 1, I want to be able to use the keyboard in tablet as I'm plugged ...
gnarlyninja's user avatar
1 vote
1 answer
4k views

What does this linux kernel panic message: sysfs: cannot create duplicate filename mean?

[1.503917] NET: Registered protocol family 17 [ 1.504612] libphy: mdiobus_find: mii bus [igb_enet_mii_bus] found 1.504711] sysfs: cannot create duplicate filename '/kernel/marvell/...
user2153522's user avatar
0 votes
1 answer
317 views

What does the /sys/class/block/*/hidden file mean?

Block devices(but not partitions) exposed to userspace through sysfs have a file called hidden, but it doesn't appear documented anywhere? What does it mean?
Linux User's user avatar