I recently switched from Debian to Fedora on my laptop, a Sony Vaio VPCY11S1E. A bit of an experiment: I decided that I knew too little of the Red Hat world and because I do admin some RHEL-based boxen I should learn more. And whats the best way to learn? Right, using it. To throw myself in the deep end I also decided the DE of choice would be GNOME 3, which comes by default on Fedora.
To be fair, I’m not totally new to both Fedora and GNOME 3. But the last Fedora I tried was Fedora Core 2, almost 10 years ago, back in the days when I was just getting acquainted with Linux and had little to no clue what everything was. And GNOME 3 I gave a whirl when version 3.0 was just released, which clearly wasn’t a finished product: it was unstable, the workflow was awkward so that left a bad taste in my mouth. I migrated to XFCE and KDE soon after and used those ever since.
In this blog I’m not going to bore you with the installation of Fedora, you can try that yourself. This is more of a log of system tweaks performed after installation, for my own documentation purposes and perhaps to help others out, especially with the brightness issue.
Non-functioning Brightness keys
The following fix seems to work for most people:
Edit GRUB2 kernel boot line:
Re-create the GRUB2 config:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot to boot with the changed kernel boot parameters
Check if the kernel was actually started with the new parameter:
The output should contain the
acpi_backlight=vendor you added earlier.
- Test your backlight? If it works now, enjoy!
But for my laptop it still did not behave as it should. Seems I’m not most people, and my laptop is not most laptops…
What backlight devices do I have?
# ls /sys/class/backlight/
Seems I have two: One from the Intel
i915 module and another from the
My bet was that the system was now using the
sony backlight device
To test this theory I tried to set the brightness using the command line. First I retrieved the current setting, followed by the maximum defined by the module, and setting a value somewhere in between. This should change my brightness… or not…
# cat /sys/class/backlight/sony/brightness
# cat /sys/class/backlight/sony/max_brightness
# echo 2 > /sys/class/backlight/sony/brightness
Aaaannd… nothing happened.
Let’s have a look at the
intel_backlight and try the same thing:
# cat /sys/class/backlight/intel_backlight/brightness
# cat /sys/class/backlight/intel_backlight/max_brightness
# echo 1400000 > /sys/class/backlight/intel_backlight/brightness
Hey presto! My brightness just lowered. So, this driver works for me… why is my system not using this? How can I instruct it to use this backlight device instead? Telling X.org about it seems like a good place to start. So I started to do some digging, and came across an interesting bit on the Arch Linux Wiki - Intel Graphics.
I created ‘/etc/X11/xorg.conf.d/20-intel.conf’ and filled it with:
Option "Backlight" "intel_backlight"
Reboot once more.
Now I had a working backlight slider and I could control my brightness using the Fn+F5/F6 keys on my (older) Sony Vaio Y (VPCY11S1E) series laptop. Two years after using two shell scripts that were called when I pressed Super+F5/F6 and changed the brightness for me by calculating the current value and lowering/increasing it by a percentage.
The rest of my hardware worked “out-of-the-box”, so I was done fixing stuff. On to tuning!
/etc/fstab for an SSD
My SSD supports the TRIM command to clear freed blocks, most SSDs do nowadays, but you can check with:
# hdparm -I /dev/sda | grep TRIM. Clearing blocks that have been freed in the file-system helps prevent degradation of the write speed of the SSD.
The Fedora aligns partitions automatically, so there’s no need to worry about that. But you do need to enable the
discard option so the kernel and file-system actually use TRIM. Another option you can set is
noatime, which disables writing access times to files. You probably do not need those anyway, and if you really do, the default
relatime will do. I tend to set
noatime for everything but my
/home, which I keep on
/etc/fstab with your favorite editor. You can replace
vi with your favorite,
nano is my recommendation for beginners.
And change the 4th column to reflect these changes. Don’t touch your UUIDs, because those are (or should be) unique to you.
UUID=dde35b21-e6f1-4057-b495-5463b863acab / ext4 defaults,discard,noatime 1 1
UUID=b7653d9a-27fd-4e21-96a3-98a2f22c9cbb /boot ext4 defaults,discard,noatime 1 2
UUID=30ee7116-69a7-4726-b4d2-4a3d85c1c16e /home ext4 defaults,discard,relatime 1 2
UUID=977b62bd-d69d-4e05-a6dc-1646006b33be swap swap defaults 0 0
Check your changes for mistakes, and if you’re happy save the file.
To activate the new settings you can re-mount all the partitions you changed, or you could reboot. I did the first like this:
$ sudo mount -o remount /
$ sudo mount -o remount /boot
$ sudo mount -o remount /home
mount to see if the file-systems are mounted with the new options.
Tune the kernel boot parameters for an SSD
By default the kernel’s I/O scheduler is
cfq, which stands for Completely Fair Queuing. This is a complex scheduler that favors real-time reads and puts other types of I/O on a queue, to handle them off in an intelligent order when using a conventional hard drive. This all has to do with latency, of which a spinning disk has loads compared to an SSD. If you use only an SSD, like I do, you can change the global I/O scheduler by configuring the kernel boot parameters. I set mine to
noop, but you can also try
deadline. They do not differ much in terms of performance, and to find minor differences you will have to run benchmarks.
Edit GRUB2 configuration to alter the kernel boot line:
elevator=noop to the
GRUB_CMDLINE_LINUX= line, and save the file.
Regenerate the GRUB2 configuration, or do this at the end of this blog:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Next boot the I/O scheduler will be changed to
You can also change it on the fly. For example for device /dev/sda:
# echo noop > /sys/block/sda/queue/scheduler
Because this is a laptop, I do like to save power where I can do so easily. Which comes down to instructing the kernel and it’s modules to enable certain power-saving options.
A list of the options I use in alphabetical order:
i915.i915_enable_rc6=3 , this option enables the use of deep power down states for the GPU. I believe this is on by default for more recent Intel GPUs, but it is not for pre-Sandy Bridge hardware and also not for my onboard Intel GMA X4500MHD (integrated graphics in the Intel GM45 chipset), because it can cause stability issues. I do not experience any issues with this enabled, and it really helps save energy for me. If you have not tried this, start off with setting
1 instead of
1 works, try
3, when that also works you can try
7. Each enables a deeper sleep state, there are 3 of them, and option
7 enables them all. I use
3 on my laptop, because
7 is not stable for me.
i915.lvds_downclock=1 , tries to save power by downclocking the LVDS refresh rate. If your system does not support this, you might experience some screen flicker. Power saved by this is quite marginal, but every little bit helps when you’re working on battery power.
snd_hda_intel.power_save=10 , this sets the time out after which the Intel HDA sound system will power down parts of the audio codec and audio bus. Also check if the check for this timeout has been enabled at all with
cat /sys/module/snd_hda_intel/parameters/power_save_controller which should return an
Y. If you experience a click sound now and then, this can be due to the power saving. If it’s really annoying, you can always disable power saving by setting this value to
I again open the GRUB2 configuration file:
And add these options to my
GRUB_CMDLINE_LINUX. Now my complete line looks like this:
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rhgb quiet acpi_backlight=vendor elevator=noop i915.i915_enable_rc6=3 i915.lvds_downclock=1 snd_hda_intel.power_save=10"
Save the file and regenerate the GRUB2 configuration (again):
# grub2-mkconfig -o /boot/grub2/grub.cfg
And reboot to test the tweaks. Done!
I hope these tweaks are helpful to someone else as well.