You are not logged in.
Actually it's quite weird, every time rc-local.service was enable successfully with boot but then it keeps failing. However, once I modify /etc/systemd /system/rc-local.service( even something that really doesn't matter ), it will be enabled successfully again. but only ONCE each time.
[Unit]
Description=/etc/rc.local compatibility
[Service]
Type=oneshot
ExecStart=/etc/rc.local
TimeoutSec=0
RemainAfterExit=yes
[Install]
WantedBy=multi-user.targetOffline
This is my rc.local:
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
# Solve the load/unload problem
hdparm -B 254 /dev/sda
# switch to the intergrated graphics card
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
# turn off the ati card
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
# save the brightness config
echo 3 > /sys/class/backlight/acpi_video0/brightnessAnd maybe tmpfiles.d is recommended for the three echo thing. but when I created the three files in /etc/tmpfiles.d/ and run sudo systemd-tmpfiles --create filename, then i boot, it doesn't work at all.
Offline
I mean i just remove rc.local, disable rc-local.service and add the tmpfiles.d/filename, but the tmpfiles.d does not work.
Any idea?
Offline
Offline
yes, 'filename' ends in '.conf' but it does not work at all.
or... any other solution for my `rc.local`?
`failing` means 'rc-local.service Active: failed `
Offline
All of those things can be done with udev rules. I had a Momentus XT, which I now no longer have in my system, but my old rule is still there. It is as follows:
ACTION=="add", SUBSYSTEM=="block", ATTRS{model}=="ST95005620AS", RUN+="/sbin/hdparm -B 247 /dev/$kernel"You could also do something like this to apply it to all rotational disks
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", RUN+="/sbin/hdparm -B 254 /dev/$kernel"As far as the stuff in /sys, use udevadm to get stuff to put in your rule to identify it. So something like
$ udevadm info -a -p /sys/kernel/debug/vgaswiteroo I have also used a rule for my backlight setting on boot. To find stuff, once again use the udevadm
$ udevadm info -a -p /sys/class/backlight/acpi_video0 My resulting backlight rule is:
ACTION=="add", KERNEL=="acpi_video0", SUBSYSTEM=="backlight", SUBSYSTEMS=="pci", DRIVERS=="i915", ATTR{brightness}="2"For more info on writing udev rules see http://www.reactivated.net/writing_udev_rules.html but when you get to the part about the udev commands, those no longer apply, as they have now been replaced by the udevadm commands listed above. The commands are mostly correct, just instead of udevinfo, it is udevadm.
I hope this helps!
Last edited by WonderWoofy (2012-11-02 02:59:59)
Offline
I just tried udev but unfortunately it still does not work.
My `/etc/udev/rules.d/hybrid-graphics.rules` is as follow:
ACTION="add", KERNEL=="vgaswitcheroo", RUN+="echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"Anyway, thank yo.u
Offline
I think you need ACTION=="add" also, I would not try and actually run a command, but rather just have it change the contents of the file. What is the output of
$ udevadm -a -p /sys/kernel/debug/vgaswitcheroo Last edited by WonderWoofy (2012-11-02 02:15:26)
Offline
The output of `udevadm info -a -p /sys/kernel/debug/vgaswitcheroo` is as follow:
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/kernel/debug/vgaswitcheroo':
KERNEL=="vgaswitcheroo"
SUBSYSTEM==""
DRIVER==""
looking at parent device '/kernel/debug':
KERNELS=="debug"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{sched_features}=="GENTLE_FAIR_SLEEPERS START_DEBIT AFFINE_WAKEUPS NO_NEXT_BUDDY LAST_BUDDY CACHE_HOT_BUDDY NO_ARCH_POWER NO_HRTICK NO_DOUBLE_TICK LB_BIAS OWNER_SPIN NONTASK_POWER TTWU_QUEUE NO_FORCE_SD_OVERLAP RT_RUNTIME_SHARE NO_LB_MIN "
ATTRS{gpio}==""I'm trying it again with '==' (really a stupid mistake)
[EDIT]Sorry, it still doesn't work.
Last edited by caasi (2012-11-02 02:39:07)
Offline
And I tried @holomorph 's KERNEL=="card1", SUBSYSTEM=="drm", WAIT_FOR="/sys/kernel/debug/vgaswitcheroo/switch", RUN+="echo OFF > /sys/kernel/debug/vgaswitcheroo/switch" (actually I tried both with or without WAIT_FOR) but it just does not work as expected. Log is as follow:
systemd-udevd[368]: failed to execute '/usr/lib/udev/echo' 'echo OFF > /sys/kernel/debug/vgaswitcheroo/switch': No such file or directoryOffline
Seeing as the 'switch' file is not showing up as an ATTR, I am kind of at a loss here. At this point, personally I might just switch tactics, and have the command run as a service. Just a simple oneshot and probably requiring an AFTER=<something well into the boot> and wanted by the multi-user.target... I don't have this hardware, so I am unable to really help you any further. Sorry. Maybe someone else can step in here who actually has switching graphics?
Offline
RUN does not give you a shell (so your redirection doesn't work), and the semantics in the manpage note that if you don't provide an absolute path, it assumes the binary is in udev's runtime dir -- aka /usr/lib/udev.
This isn't suitable for a udev rule -- many people have done this using tmpfiles.d.
Last edited by falconindy (2012-11-02 03:22:57)
Offline
@falconindy Thank you. Yes, I find that `echo` is not found in my udev rules. But I tried tmpfiles.d yesterday and it does not work. So I focus on udev now.
How to solve it with tmpfiles.d? any related posts?
Offline
Again, udev is the wrong tool, and there's plenty of people who've used tmpfiles. If something such as the below doesn't do what you want, then you need to be more specific than "it does not work"
w /sys/kernel/debug/vgaswitcheroo/switch - - - - OFF
Offline