[arch-general] /etc/tmpfiles.d

Curtis Shimamoto sugar.and.scruffy at gmail.com
Mon Sep 17 20:44:13 EDT 2012


On 09/17/12 at 10:31am, Matthew Monaco wrote:
> On 09/17/2012 09:40 AM, Mart?n Cigorraga wrote:
> > "[...]However, tmpfiles may also be used to write values into certain files
> > on boot. For example, if you use /etc/rc.local to disable wakeup from USB
> > devices with echo USBE > /proc/acpi/wakeup, you may use the following
> > tmpfile instead:
> > 
> > 
> > /etc/tmpfiles.d/disable-usb-wake.conf
> > 
> > 
> > w /proc/acpi/wakeup - - - - USBE
> > 
> > The tmpfiles method is recommended in this case since systemd doesn't
> > actually support /etc/rc.local."
> > 
> > Does that means that I need to move all the content from /etc/rc.local to
> > /etc/tmpfiles.d? For example this is my actual /etc/rc.local:
> > ~ $ cat /etc/rc.local
> > #!/bin/bash
> > #
> > # /etc/rc.local: Local multi-user startup script.
> > #
> > 
> > #modprobe radeon # added by hybrid-video-ati-intel install script
> > #echo IGD > /sys/kernel/debug/vgaswitcheroo/switch # added by
> > hybrid-video-ati-intel install script
> > echo OFF > /sys/kernel/debug/vgaswitcheroo/switch # completely deactivate
> > radeon
> > 
> > ## ATi
> > # Source: https://wiki.archlinux.org/index.php/ATI#Performance_tuning
> > echo low > /sys/class/drm/card0/device/power_profile
> > #echo profile > /sys/class/drm/card0/device/power_method
> > echo dynpm > /sys/class/drm/card0/device/power_method
> > echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
> > 
> > # CPUFREQ
> > for i in 0 1 2 3; do cpufreq-set -c $i -g powersave; done  ## sets
> > powersave cpufreq governor for all CPU cores
> > #echo -n 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
> > echo -n 20 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
> > 
> > # Prepare the system for Wake-on-Lan
> > /usr/sbin/ethtool -s eth0 wol pg
> > 
> > # Activate laptop_mode
> > echo 5 > /proc/sys/vm/laptop_mode
> > 
> > # Performance tweaks for USB drivers under KDE SC
> > echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
> > echo madvise > /sys/kernel/mm/transparent_hugepage/defrag
> > echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
> > 
> > 
> > If this is the case, how do you guys would convert the FOR loop!?
> > 
> 
> For ethtool, just create a separate service that executes that command.
> 
> Everything else you do is writing to /sys, so you can have one giant tmpfiles.d
> file.
> 
> For the for loop:
> w /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - - - - powersave
> w /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor - - - - powersave
> w /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor - - - - powersave
> w /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor - - - - powersave
> 
> Also, I don't think it's an error if the file doesn't exist, so you can just do
> cpu0..cpu16 or whatever if you feel like.

I am fairly certain that tmpfiles.d understands "*", so you could
probably get away with one line for something like that.
-- 
Curtis Shimamoto
sugar.and.scruffy at gmail.com


More information about the arch-general mailing list