Details

This time on the show, optimizing your Linux install for better battery life - Darren reports. Then, Encrypt all the things! I'm setting up local encryption volumes that play well with cloud sync services like spideroak and dropbox. Plus, RSS podcasts from YouTube - is it possible? All that and more, this time on Hak5!

Download HD Download MP4

Linux Laptop Battery Optimizations

#Upgrade to SSD and Optimize
make a backup of your fstab
sudo cp /etc/fstab{,.bak}disable writing last access time and enable TRIM by adding "noatime,nodirtime,discard" to drive options in /etc/fstab
#Don't use swap until physical memory is full.
sudo cat /proc/sys/vm/swappiness
sudo echo 0 > /proc/sys/vm/swappiness
#add to rc.local and check free memory
free
#Create RAM disk for temp filesystem
df -h
#Find avail for tempfs, now edit /etc/fstab and add
tmpfs /tmp tmpfs defaults,noatime,size=512M,mode=1777 0 0
tmpfs /var/spool tmpfs defaults,noatime,size=512M,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,size=512M,mode=1777 0 0
# If you don't care about log files after reboots
tmpfs /var/log tmpfs defaults,noatime,size=512M,mode=0755 0 0
# the mode is the file permission. this is a single user system
# size=512M - size isn't allocated immediately, used as needed

#Powertop
sudo apt-get install -y powertop; sudo powertop
#Laptop-Mode
Prevents HDD from spinning up constantly - allows it to sleep by buffering write in memory
#Configured by laptop-mode-tools
sudo apt-get install laptop-mode-tools
Configured by /etc/laptop-mode/laptop-mode.conf

#ENABLE_AUTO_MODULES=1
I have a solid-state disk (SSD) in my machine. Should I enable any of the disk-related parts of laptop-mode-tools, or are they irrelevant?
They may be relevant, because (a) laptop mode will reduce the number of writes, which improves the lifetime of an SSD, and (b) laptop mode makes writes bursty, which enables power saving mechanisms like ALPM to kick in. However, your mileage may vary depending on the specific hardware involved. For some hardware you will get no gain at all, for some the gain may be substantial.

#LMT is not just for the storage device. It covers almost all I/O Controller devices on your box.
And for SSDs, yes, there’s no need to spin down. But for long, LMT has had the ability to detect a SSD device and just skip it.
Verify that its enabled
sudo cat /proc/sys/vm/laptop_mode

#enable latop-mode with:
sudo update-rc.d laptop-mode defaults

#CPU Frequency
The CPU frequency scaling indicator shows you the current speed of your CPU and lets you control its policy – for example, you can force a certain CPU speed, enable power-saving mode, or enable high-performance mode.
sudo apt-get install indicator-cpufreq
#Launch the indicator by running the following command after installing it:
indicator-cpufreq&
#Fan Speed
http://blog.burntsushi.net/lenovo-thinkpad-t430-archlinux
#This is specific to the Thinkpad T430 though thinkfan may work for your machine
cat /proc/acpi/ibm/fan
cat /sys/devices/virtual/thermal/thermal_zone0/temp
sudo apt-get install thinkfan
sudo touch /etc/modprobe.d/thinkfan.conf
sudo nano /etc/modprobe.d/thinkfan.conf

#add the following
options thinkpad_acpi fan_control=1
#edit the /etc/thinkfan.conf file
sudo nano /etc/thinkfan.conf
*VGASwitcheroo
/etc/rc.local:
echo 'OFF' > /sys/kernel/debug/vgaswitcheroo/switch
# Disables discrete graphics

#Lightweight Desktop Environment
i3 http://i3wm.org/
LXDE http://lxde.org/
#Low Power OS
WattOS - http://www.planetwatt.com/blogs/1/15/watt-os-r6-new-release-info

Encrypt Cloud Storage with EncFS

Trust No One Approach
TrueCrypt container - good, complicated, reuploads the whole container if there is a change.
EncFS - creates an encrypted file for each file that you upload. Only reuploads that one file for a change.
Install on Ubuntu with: sudo apt-get install encfs
To create a new encrypted volume: encfs ~/Dropbox/encrypted ~/Private - this creates the encrypted folder in dropbox, and the private folder where you will be able to access decrypted files.
Choose paranoia mode or expert mode upon setup.
Create a password that you will always remember.
To Use:
Place files in the Private folder. Dropbox will sync an encrypted version in the dropbox/encrypted folder. You can use the encfs command on multiple comps to use encrypted files on each comp.
Ignore the encrypted folder- don't place files in there- else they won't be encrypted. Don't delete or lose the encfs.xml file- this is your key to acces encrypted files.
Run encfs command upon restart or next log in- this ensures others cant access files unless they have your pw for encfs. If Private looks empty, encfs isn't mounted.
Use gnome-encfs to automatically mount encfs for each log in."

Feedback

Nathan says: I've been watching hak5 for over a year now, and love the show. Today, I noticed that while using Comodo's 'secure DNS' I got a warning page, that prevented me from getting to hak5.org Needless to say, I changed the DNS settings on my computer. (just had them for testing in the first place..)

Yoram says: I usually download Hak5 episodes via iTunes, and watch them offline. Is there a way to load ThreatWire episodes via iTunes (I.e. - is there an RSS)? If not - I there a way hack something? Looking forward to following another great show of yours.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

9 Comments

  • Josh 1 year ago

    Yo guys love the show! For better battery performance could you not actually have no hard disk at all and just run the optimised OS off of a USB? Surely this would save a couple of Watts as the USB is usually running over the south-bridge right? (This may vary depending on the architecture of the machine though I guess). Also, if you have any optical drives, removing them could save some Watts. :)

  • Mnemonic 1 year ago

    Keepvid.com is what I like to use for saving clips.

  • Brent 1 year ago

    Just an FYI there is a typo in the show notes:
    “nodirtime” should be “nodiratime”

  • Sami 1 year ago

    There is nice gui for encfs on linux also, cryptkeeper, founds on ubuntu repository.

  • For power management on the finger tips on my laptop I use an app called jupiter. you can find it on Ubuntu reps.
    I am using Mint 14 on an ACER5830GT, and after doing all the stuff from this episode, plus using jupiter and bumblebee to manage the second video card (NVIDIA GT520M), I got to 13W, but I have 2 drives one SDD for the OS’s and one HDD for data.
    Another tip is keep the brightness low, this saves me 1.5 W. The wireless is still the vilan with around 2 to 3 watts.
    Keep up the good work.
    Cheers,

  • zach 1 year ago

    This is exactly what I’ve been looking for. Switched to Linux Full time and the power management was driving me A little crazy.

  • EazyVG 1 year ago

    A very good video and overview with tips.

    FYI: I am currently running kernel 3.4.28 (openSUSE 12.2) and my battery consumption is quite good (tip: #powertop tunables=good), idling at around 7-8W with screen @60% and Wireless=On.
    Apart from powertop tunables, no other tweaks.

  • James 1 year ago

    Was reading up on fsab and found that the noatime option in fstab will enable nodiratime function as well. Putting in both is redundant.

    nodiratime = disables writes on directories but not files.
    noatime = disables writes for both files and directories.

    https://wiki.archlinux.org/index.php/Fstab#atime_options

    Cheers

  • rakudave 1 year ago

    Warning: When using a tmpfs for /var/spool your crontab will disappear every time you reboot. Took me some time to realize why my crontab was misteriously vanishing from time to time (they are stored in /var/spool/cron/crontabs/, at least in *buntu).