PaPer - Paranoies Personals - Blog d'en Sergi Pons Freixes » Arch Linux http://www.cub3.net/blog Pensaments, idees, i altres paranoies que em pasen pel cap. Mon, 20 Jan 2014 09:43:16 +0000 en-US hourly 1 http://wordpress.org/?v=4.2.7 Improving battery life http://www.cub3.net/blog/improving-battery-life/ http://www.cub3.net/blog/improving-battery-life/#comments Sun, 10 Jun 2012 17:20:38 +0000 http://www.cub3.net/blog/?p=835 For sure you have heard or read, at least once, recommendations about how to improve the battery life of a laptop, mobile phone, or whatever gadget.  But I’ve detected that several times that recommendations are wrong, and they do more harm than benefit to a laptops battery. That’s because battery technology has been changing along the years, and the methods of taking care of them also. So, I’ll try to summarize some of the most basic up-to-date tips to increase the life of a laptop’s battery. Before applying them, just check that you battery is of lithium-ion (Li-ion) type.

Li-ion battery

The tips of this post are only applicable to Lithium-ion batteries.

PowerTOP

The easiest and faster way of improving the power efficiency of the laptop, is at software level. With the PowerTOP application we can not only monitor which software is responsible of our CPU cycles and hard disk spinning, but also  (and more important) tune several parameters related with the energy. For example, enable the auto-suspend of an external USB device when not in use, or an energy saving feature of the wireless card.

PowerTOP screenshot

That’s the PowerTOP tunables section on my laptop, with some settings not optimized.

After playing with it, you will probably notice that the settings are not saved, and after rebooting you have to run PowerTOP and set everything again. Solution: if you run PowerTOP with the –html option, it will generate an HTML (surprise!) report with all the command line instructions to set each tunable. So, then you only have to add these commands to an init script (for example, /etc/rc.local on Arch Linux), and you’re done!

Just a last tip: do not enable autosuspend for an external mouse… it’s really annoying.

Charging cycle

If you are like me and usually run your laptop connected to AC, your battery it’s probably almost always charged at 100%. This is not good. But but be optimal, is having it charged at max of ~85%, and then let it discharge by its own until it reaches ~35%.  About “telling” you laptop to follow this charging cycle, I only know how to do it with Thinkpads, which is setting:

echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 80 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh

 

having Tp smapi installed. Details about how to implement it on a script can be found on the ArchWiki.

Actually, the best way of keeping a battery in an optimum state, when not in use, is having it at 40% of it’s charge and storing it on the fridge. If you try that, please put it on a sealed plastic bag, with some rice to absorb humidity!

 

 

 

 

]]>
http://www.cub3.net/blog/improving-battery-life/feed/ 0
Simple virtual user mail system on Debian http://www.cub3.net/blog/simple-virtual-user-mail-system-on-debian/ http://www.cub3.net/blog/simple-virtual-user-mail-system-on-debian/#comments Sun, 05 Feb 2012 20:21:01 +0000 http://www.cub3.net/blog/?p=554 On this post I will explain how to set-up an  e-mail server on Debian using Postfix, Cyrus, Courier, PAM, PostfixAdmin and Roundcube. I’m not going to explain nothing completely new or revolutionary neither reinvent the wheel. To be clear, what I did to implement the server was following this guide: Simple Virtual User Mail System. But, it’s for Arch Linux, so if we want it to work on Debian there are several changes that we have to take into account. So, instead of repeating everything, I will just highlight the changes.

Installation

The packages I installed were:

gamin postfix postfix-mysql courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules php-auth-sasl sasl2-bin libpam-mysql

I think that these are enough (with its dependences) to get a working system. I’m not 100% sure because I documented this part a posteriori, after playing a bit around installing/uninstalling things.

Configuration

Postfix

On /etc/postfix/master.cf I used:

submission inet n - - - - smtpd
 -o smtpd_tls_security_level=encrypt
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject
 -o milter_macro_daemon_name=ORIGINATING

The file /etc/postfix/transport did not exist, so before

postmap /etc/postfix/transport

I did

touch /etc/postfix/transport

Courier

All the references to

/etc/authlib/

and

/etc/courier-imap/

must be changed to

/etc/courier/

On /etc/courier/authdaemonrc, instead of

MYSQL_MAILDIR_FIELD maildir

we must use

MYSQL_MAILDIR_FIELD     concat('/home/vmail/',maildir)

Cyrus

Instead of editing /etc/conf.d/saslauthd we have to edit /etc/default/saslauthd to say:

START=yes
MECHANISMS="pam"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"

Instead of /usr/lib/sasl2/smtpd.conf we have to edit /etc/postfix/sasl/smtpd.conf to:

pwcheck_method: saslauthd
 mech_list: plain login
 saslauthd_path: /var/run/saslauthd/mux
 log_level: 7

Rouncube

To make the directories writable to the server, we have to use:

chown -R www-admin:www-admin temp logs

rc.conf

There is no rc.conf to control boot services on Debian. All the services installed on this guide are automatically startup at bootup, so nothing to do here.

The end

And that’s all. With that we should have a working mail server, using MySQL to store user’s info, mail storage on the filesystem, PostfixAdmin to manage accounts and aliases and a nice webmail with Roundcube.


 

 

]]>
http://www.cub3.net/blog/simple-virtual-user-mail-system-on-debian/feed/ 0
Find outdated packages installed from AUR http://www.cub3.net/blog/find-outdated-packages-installed-from-aur/ http://www.cub3.net/blog/find-outdated-packages-installed-from-aur/#comments Fri, 26 Mar 2010 22:51:03 +0000 http://www.cub3.net/blog/?p=356 If you don’t use Yaourt to manage packages installed from AUR, you will find useful this script from Edgar Kalkowski. It checks all installed packages (including those from the AUR) for updates but does not do any automatic update attempt like yaourt does.

]]>
http://www.cub3.net/blog/find-outdated-packages-installed-from-aur/feed/ 0
How to find the uninstalled package that will provide xxx http://www.cub3.net/blog/how-to-find-the-uninstalled-package-that-will-provide-xxx/ http://www.cub3.net/blog/how-to-find-the-uninstalled-package-that-will-provide-xxx/#comments Fri, 26 Mar 2010 01:28:38 +0000 http://www.cub3.net/blog/?p=352 I’m cleaning my e-mail, but I’ve discovered that I have a lot of mails from the Arch Linux mailing list which I’m just archiving because they contain useful tips and howtos. So, in order to delete them without losing these pearls of information, I’ll put them in the blog under the Arch Linux category for easy reference.

The first one: Maybe you are interested in a concrete file, but you don’t know which package contains it. pacman -Ss just search package names and not the contents, so it’s not helpful. The solution is pkgfile from pkgtools.

]]>
http://www.cub3.net/blog/how-to-find-the-uninstalled-package-that-will-provide-xxx/feed/ 0
Configuring the Touch screen for Lenovo X200T http://www.cub3.net/blog/configuring-the-touch-screen-for-x200t/ http://www.cub3.net/blog/configuring-the-touch-screen-for-x200t/#comments Thu, 05 Feb 2009 15:35:28 +0000 http://www.cub3.net/blog/?p=167 One of the first things you would like to try on a Tablet PC would be the Touch Screen. Having it working on the Lenovo X200T is as easy as:

  1. Install the Linux Wacom drivers. On Arch Linux, you can find it on AUR.
  2. Configure the X.Org server to use it. I post my xorg.conf file as an example:


Section "ServerLayout"
Identifier "X.org Configured"
Screen "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "stylus" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
InputDevice "touch" "SendCoreEvents" # Only a few TabletPCs support this typeEndSection

EndSection

Section “Files”
ModulePath “/usr/lib/xorg/modules”
FontPath “/usr/share/fonts/misc”
FontPath “/usr/share/fonts/100dpi:unscaled”
FontPath “/usr/share/fonts/75dpi:unscaled”
FontPath “/usr/share/fonts/TTF”
FontPath “/usr/share/fonts/Type1″
EndSection

Section “Module”
Load “dri”
Load “xtrap”
Load “dbe”
Load “glx”
Load “extmod”
Load “freetype”
EndSection

Section “InputDevice”
Identifier “Keyboard0″
Driver “kbd”
Option “XkbLayout” “es”
EndSection

Section “InputDevice”
Identifier “Mouse0″
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/input/mice”
Option “ZAxisMapping” “4 5 6 7″
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “stylus”
Option “Device” “/dev/ttyS0″ # SERIAL ONLY
Option “Type” “stylus”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “eraser”
Option “Device” “/dev/ttyS0″ # SERIAL ONLY
Option “Type” “eraser”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “cursor”
Option “Device” “/dev/ttyS0″ # SERIAL ONLY
Option “Type” “cursor”
Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
EndSection

Section “InputDevice”
Driver “wacom”
Identifier “pad”
Option “Device” “/dev/ttyS0″ # SERIAL ONLY
Option “Type” “pad”
EndSection

# Uncomment the following section if you you have a TabletPC that upports touch
Section “InputDevice”
Driver “wacom”
Identifier “touch”
Option “Device” “/dev/ttyS0″ # SERIAL ONLY
Option “Type” “touch”
Option “ForceDevice” “ISDV4″ # Serial Tablet PC ONLY
# Adding manual calibration, since proper calibration seems impossible.
Option “BottomX” “915”
Option “BottomY” “940”
Option “TopX” “48”
Option “TopY” “90”
EndSection

Section “Monitor”
#DisplaySize 260 160 # mm
Identifier “Monitor0″
VendorName “LEN”
ModelName “4011”
Option “DPMS”
EndSection

Section “Monitor”
Identifier “HDMI-1″
Option “Ignore” “True”
EndSection

Section “Monitor”
Identifier “HDMI-2″
Option “Ignore” “True”
EndSection

Section “Device”
Identifier “Card0″
Driver “intel”
VendorName “Intel Corporation”
BoardName “Mobile 4 Series Chipset Integrated Graphics Controller”
BusID “PCI:0:2:0″
Option “monitor-HDMI-1″ “HDMI-1″
Option “monitor-HDMI-2″ “HDMI-2″
EndSection

Section “Screen”
Identifier “Screen0″
Device “Card0″
Monitor “Monitor0″
DefaultDepth 24
Option “RandRRotation” “on”
SubSection “Display”
Modes “1280×800″ “1024×768″ “800×600″ “640×480″
EndSubSection
EndSection

Section “Extensions”
Option “Composite” “Enabled”
EndSection

And thats’s all! With just these two steps you can use your pen or your finger to control the screen :)

]]>
http://www.cub3.net/blog/configuring-the-touch-screen-for-x200t/feed/ 4
Installing Linux on Lenovo X200 Tablet http://www.cub3.net/blog/installing-linux-on-lenovo-x200-tablet/ http://www.cub3.net/blog/installing-linux-on-lenovo-x200-tablet/#comments Thu, 22 Jan 2009 19:49:10 +0000 http://www.cub3.net/blog/?p=165 Eventually, I am the proud owner of a Lenovo X200 Tablet :).

My distro

The distribution I have chosen is Arch Linux. It’s not an “everything works without having edit configuration files” distribution, but with a laptop with special hardware (i.e., tablet pc), you end doing it anyway. In addition to this, I like its principles, the community (AUR, forums, mailing lists) around it, and the wiki :).

Base installation

The laptop does not have a optical drive so we can install booting from USB or from network via PXE. First I tried the simplest case: boot from a USB drive. But the last stable (this word is not appropriate on a rolling release distribution, but I expect you will understand the idea) installer release does not include drivers for the Ethernet or the Wifi, leading to a almost useless installation. So, I used a “non-official” boot image with the kernel 2.6.28, which supports all my networking options. But, I didn’t discovered why, but this image doesn’t boot on my laptop. The screen goes blank with the message “Boot Error”. Then, I tried to boot from network using this newer image (fortunately, I have a home server that could provide DHCP and PXE), following this guide, and everything worked fine. From this point, everything worked as expected and leaded to a full operational base system with network capabilities.

Apart from the network drivers issue, I spent A LOT of time trying to shrink the Windows partition to gain space for the Linux. The problem was that it had some unmovable files near the end of the partition, that limited how much could it be resized. After playing with several defragmentation tools (even some of them commercial software in trial version mode), I could gain enough space to be happy :).

On next posts I’m going to talk about how to configure the system to use most of the hardware (rotation and touch screen, special buttons, bluetooth, etc.).

]]>
http://www.cub3.net/blog/installing-linux-on-lenovo-x200-tablet/feed/ 2