You are not logged in.
I have 12 lines in my old /etc/rc.local that set up powersaving features and make symlinks mainly. Before systemd we just needed to put stuff like that in /etc/rc.local to do it. I read from falconindy that we should now be using tmpfiles to do this but I can't find the thread where he said that. On the wiki it says to use a service file to emulate rc.local. Is this the accepted way to do it?
https://wiki.archlinux.org/index.php/Sy … 2Frc.local
Last edited by maggie (2012-11-01 20:17:24)
Offline
You could use an rc.local file if you please. I think it would be just as wrong now as it was before, so I see no harm if you are comfortable with it. But really it has always been kind of a hack or cheat to enable laziness.
For power saving you may use /etc/tmpfiles.d . Just see the man page for more info. Also, these things can pretty easily be done with /etc/udev/rules.d/ though it may take a few minutes longer to learn how to write a udev rule. I personally use udev rules, and they work great. Also, udev rules seem to be used for a quite a bit, so learning them was certainly worht the effort.
Offline
I read the man page for tmpfiles.d but I dont see how to cause a tmpfile to execute something. They seem to be used to make or remove or symlink. How would I use it to execute this:
echo min_power > /sys/class/scsi_host/host0/link_power_management_policyOffline
Also, these things can pretty easily be done with /etc/udev/rules.d/ though it may take a few minutes longer to learn how to write a udev rule. I personally use udev rules, and they work great.
I'm curious what things you are doing with udev rules? Can you describe and post a few examples?
Offline
I read the man page for tmpfiles.d but I dont see how to cause a tmpfile to execute something. They seem to be used to make or remove or symlink. How would I use it to execute this:
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
I think you want to use the "w" action. So you'd create, say, /etc/tmpfiles.d/boot.conf that contains:
w /sys/class/scsi_host/host0/link_power_management_policy - - - - min_powerBut I get stuck there. I'm not sure how to trigger that file to be run at boot and only at boot. Out of time, but hopefully that can help get you started...
Last edited by ColdPie (2012-10-31 20:19:42)
Offline
@ColePie - I thought that tmpfiles are managed to run at boot by default and presumably taken down at shutdown. It isn't clear from the man page to me.
DESCRIPTION
systemd-tmpfiles uses the configuration files from the above directories to describe the creation, cleaning and removal of volatile and temporary files and directories which usually reside in directories such as /run or /tmp.
... if these are indeed created in /tmp or /run (tmpfs), I don't see why they need to be removed at reboot/shutdown since they are volatile anyway.
Last edited by graysky (2012-10-31 20:37:09)
Offline
I think you want to use the "w" action. So you'd create, say, /etc/tmpfiles.d/boot.conf that contains:
w /sys/class/scsi_host/host0/link_power_management_policy - - - - min_power
I tried this, rebooted, but it did not seem to work for me. In /etc/tmpfiles.d/boot.conf
w /sys/class/scsi_host/host0/link_power_management_policy ---- min_powerBut when I reboot I get
cat /sys/class/scsi_host/host0/link_power_management_policy
max_performanceOffline
WonderWoofy wrote:Also, these things can pretty easily be done with /etc/udev/rules.d/ though it may take a few minutes longer to learn how to write a udev rule. I personally use udev rules, and they work great.
I'm curious what things you are doing with udev rules? Can you describe and post a few examples?
Can't comment on WonderWoofy's set up, but I use udev rules to set my SSDs' elevators to noop:
$ cat /etc/udev/rules.d/10-ssd.rules
ACTION=="add|change", KERNEL=="sda", SUBSYSTEM=="block", ATTR{size}=="234441648", ATTR{queue/scheduler}="noop"
ACTION=="add|change", KERNEL=="sdb", SUBSYSTEM=="block", ATTR{size}=="234441648", ATTR{queue/scheduler}="noop"I would imagine that setting the values of other devices attributes (i.e. to enable power-saving modes or whatever) could be done in a similar way.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
w /sys/class/scsi_host/host0/link_power_management_policy ---- min_power
Your problem is your syntax: you need to add spaces to the block of dashes.
Offline
You could read the manpage: 'man 5 tmpfiles.d' or http://0pointer.de/public/systemd-man/tmpfiles.d.html
Offline
Thank you everyone!
Offline
$ cat /etc/udev/rules.d/10-ssd.rules ACTION=="add|change", KERNEL=="sda", SUBSYSTEM=="block", ATTR{size}=="234441648", ATTR{queue/scheduler}="noop" ACTION=="add|change", KERNEL=="sdb", SUBSYSTEM=="block", ATTR{size}=="234441648", ATTR{queue/scheduler}="noop"
# this set a noop scheduler for non-rotating devices (SSDs etc), good because you should not use noop for normal storage discs
ACTION=="add", SUBSYSTEM=="block", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
Offline
I'm curious what things you are doing with udev rules? Can you describe and post a few examples?
Sorry I missed this past for a few days graysky. I use udev rules for my scheduler (though I now no longer have rotational disks in my computer):
% cat 60-scheduler.rules
## set deadline scheduler for non-rotating disks
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
# set deadline scheduler for non-rotating disks
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"I also use one for my backlight. I had a tmpfile for this, but it stopped working 100% of the time. So I whipped this up, and it always seems to work. Not sure why my tmpfile stopped, or if it would work again, or if I did something stooopid to make it not work. Bua anyway:
% cat 44-backlight.rules
ACTION=="add", KERNEL=="acpi_video0", SUBSYSTEM=="backlight", SUBSYSTEMS=="pci", DRIVERS=="i915", ATTR{brightness}="2"My trackpoint was super slow. So I made this. It takes a while for this actual path to show up. In fact, I think that it doesn't actually show up until X is started. So I had to use a udev rule here. Also if I don't have the graphical target enabled, it just fails, as it will only wait for so long. So here you go:
% cat 98-trackpoint.rules
KERNEL=="serio2", SUBSYSTEM=="serio", DRIVER=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="190"I also don't use wake on lan. So I made this:
cat 52-eth0wol.rules
ACTION=="add", KERNEL=="eth0", SUBSYSTEM=="net", RUN+="/usr/sbin/ethtool -s eth0 wol d"Offline
Did the OP get an answer to his question?
I have just one simple line in /etc/tmpfiles.d/fix-apple-kb-fn-keys.conf and it doesn't work.
Do these files require any special permissions?
w /sys/module/hid_apple/parameters/fnmode - - - - 2Arch linux
Offline
@Jurassic, maybe if you put the module that controls the keyboard into your intramfs, the path might exist earlier? Also, in the tmpfiles.d man page, there is the option 'f' which says that it will creat a file if it does not yet exist and optionally write a parameter to it.
Offline
the hid_apple module has a parameter for this, so you may just want to set the option via a /etc/modprobe.d/ file. If the module is loaded in initramfs, you will have to add the modprobe.d file to FILES in /etc/mkinitcpio.conf and rebuild the initramfs.
$ modinfo hid_apple | grep fnmodeOffline
Yeah, eventually I found the arch wiki and followed it. Was just curious why it didn't work with temp files, perhaps because the path didn't exist as WonderWoofy pointed out? Thanks guys.
Arch linux
Offline