Specific configuration for a testing laptop

Some specific things to tweak on our example Debian testing laptop

Author: Francesco Poli
Contact: invernomuto@paranoici.org
Version: 0.25
Copyright: Expat license
Notice:

Copyright (c) 2011-2024 Francesco Poli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About this document
Web form HyperText Markup Language
Source form reStructuredText
Web stylesheet Cascading StyleSheets
Build directives Makefile

Contents

Summary of previous episodes

In another document (HTML, reST) you saw how to install a Debian testing base system on a laptop. You also found references to other general workstation documents to follow in order to tune the system. Now it's time to perform some laptop-specific configuration tweaking.

Fixing the boot process

Our example laptop experiences a delay in the boot process, while waiting for /dev to be fully populated. It waits for 120 seconds and then times out and goes on with the normal boot sequence.

This seems to be caused by the acer_wmi kernel module, which is supposed to support the Acer BMA150 accelerometer: the accelerometer seems to be recognized and a joystick-like device file is created (/dev/input/js0), but it does not seem to be really accessible. As soon as the package for joystick support is installed (see the document about games, HTML, reST), the joystick calibration restore automatism tries to probe /dev/input/js0 and waits for a reply, until the time out occurs.

In order to work around this issue, you may prevent the acer_wmi kernel module from being loaded:

# echo "blacklist acer_wmi" > /etc/modprobe.d/acerwmi-blacklist-local.conf
# update-initramfs -u

Starting from next reboot, this delay should not occur.

Network management

Network management on a laptop is slightly trickier than on a workstation/desktop or server machine: on a laptop different network interfaces are commonly used in different situations, and you cannot count on having the same network link always available.

Wired and wireless network

Install the following network management daemon:

# aptitude --without-recommends install connman-gtk \
  iw wireless-regdb wpasupplicant+M

Temporarily shut the ConnMan daemon down:

# service connman stop

Then, bring the Ethernet network interface down:

# ifdown eth0

and edit the configuration file for network interfaces, until it looks like:

# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

Now, start the ConnMan daemon:

# service connman start

The Ethernet network should be brought up and configured automatically (via DHCP), if available. If this fails to happen, and/or in order to manage other less trivial connections (such as wireless networks), a user may start a ConnMan UI:

$ connman-gtk

or:

$ connmanctl

You may use the UI to configure connections (for instance wireless ones) and enable/disable them.

Please note that /etc/resolv.conf should have been set as a symlink to /run/connman/resolv.conf. If this failed to happen, you should be able to rectify the situation by issuing the following commands:

# mv /etc/resolv.conf /tmp
# systemd-tmpfiles --create /usr/lib/tmpfiles.d/connman_resolvconf.conf

By default, ConnMan will wait for at most 120 s on boot for a network link to be established. This will slow down the boot process, whenever no (Ethernet) network is available. If you want to avoid this delay and accept booting with the network down, you may disable the service:

# systemctl disable connman-wait-online.service

If you want to have the graphical ConnMan UI started on each Fluxbox session you open, so that it runs in the systray, configure it by clicking on the Settings button: uncheck "Use fsid with openconnect", check "Use status icon", and check "Launch to tray by default". Then insert the following two lines into your regular user's ~/.xsession file (between MANAGER and HANG POINT):

$ grep -A 1 'network management client' ~/.xsession
# start network management client
connman-gtk &

HSDPA modem network

In order to use a USB HSDPA modem (a so-called "Internet key"), install the following PPP configuration tool and run it:

# aptitude install pppconfig
# pppconfig

Choose "Create" from the main menu. You'll be asked to choose a name for the ISP: enter a concise name for your mobile Internet provider (for instance: "tim" for the Italian TIM mobile phone operator, "vodafone" for the Italian Vodafone mobile phone operator, and so forth...). Select "Dynamic" DNS, and "PAP" authentication method. Username and password are irrelevant: enter "foo" and "bar". Enter your modem maximum connection speed (in bit/s) as modem port speed (for instance: "7200000"). Select "Tone" method of dialing, and enter the phone number to dial (which depends on your provider: "*99#" for TIM, "*99***1#" for Vodafone, ...). Answer "No" when asked whether you want to have the modem port identified automatically, and enter "/dev/ttyUSB0" as modem port. From the summary screen, select "Advanced" to modify advanced settings. Select "Modeminit" and enter "ATX3" as modem initialization string (we will have to modify it later on). Back to the advanced settings menu: select "Previous" in order to return to the summary menu; select "Finished", "Ok" and "Quit".

Now edit the chatscript file ($PROVIDER is the concise name you chose for your provider):

# vim /etc/chatscripts/$PROVIDER

and modify the modeminit section so that it looks like:

# modeminit
'' 'ATX3'
'' 'AT&F Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'' 'at+cgdcont=1,"IP","provider.url"'

where "provider.url" is a provider-specific URL ("ibox.tim.it for TIM, "web.omnitel.it" for Vodafone, ...).

In order to let the USB HSDPA modem to be seen primarily as a USB serial device, install the following package:

# aptitude install usb-modeswitch

and restart the udev daemon:

# service udev restart

Now, after plugging your USB HSDPA modem into a USB port, you may start a PPP connection with:

$ pon $PROVIDER

and stop it with:

$ poff

Please note that a regular user must belong to the dip group, in order to be authorized to use these commands.

System monitor

In order to address laptop-specific needs, the configuration file for Conky should be adapted. You may use the following configuration file:

$ cat ~/.config/conky/conky.conf
-- vim: syntax=lua

conky.config = {
    background = false, -- do not fork in the background
    font = '-*-terminus-*-r-*-*-12-*-*-*-*-*-iso10646-*', -- X font (w/o Xft)
    use_xft = false, -- do not use Xft
    update_interval = 2.0, -- update interval (in seconds)
    total_run_times = 0, -- run forever
    own_window = true, -- do not use root window, create own window instead
    own_window_type = 'override', -- desktop own window
    own_window_transparent = true, -- use pseudo transparency
    double_buffer = true, -- use double buffering
    minimum_width = 380, -- minimum width of text area
    draw_shades = true, -- draw shades
    draw_outline = false, -- do not draw outlines
    draw_borders = false, -- do not draw borders around text
    draw_graph_borders = true, -- draw borders around graphs
    stippled_borders = 8, -- stippled borders?
    border_inner_margin = 3, -- border margins and width
    border_outer_margin = 0,
    border_width = 1,
    default_color = 'white', -- default colors
    default_shade_color = 'black',
    default_outline_color = 'black',
    alignment = 'top_right', -- placement
    gap_x = 8, -- gap between borders of screen and text
    gap_y = 64,
    no_buffers = true, -- subtract file system buffers from used memory
    cpu_avg_samples = 2, -- number of cpu samples to average
    net_avg_samples = 2, -- number of net samples to average
    override_utf8_locale = true, -- need to force UTF8
    use_spacer = 'left', -- add spaces to keep things from moving about
    text_buffer_size = 640, -- set buffer size (in bytes) for exec outputs
    if_up_strictness = 'address', -- set if_up check strictness
};

-- stuff to be formatted on screen
conky.text = [[
${color green}Host:$color $nodename - $sysname $kernel on $machine
$hr
${color green}Time:$color ${time %a, %d %b %Y %T %z}${color green} - Unix time:$color ${time %s} s
${color green}Uptime:$color $uptime
${color green}Load Average:$color $loadavg${color green} - Processes:$color $processes${color green} - Running:$color $running_processes
${color green}CPU usage         %CPU   %MEM   RAM usage         %CPU   %MEM
${color} ${top name 1} ${top cpu 1} ${top mem 1}  ${top_mem name 1} ${top_mem cpu 1} ${top_mem mem 1}
${color} ${top name 2} ${top cpu 2} ${top mem 2}  ${top_mem name 2} ${top_mem cpu 2} ${top_mem mem 2}
${color} ${top name 3} ${top cpu 3} ${top mem 3}  ${top_mem name 3} ${top_mem cpu 3} ${top_mem mem 3}
${color green}CPU Clock Frequencies:$color ${freq 1} MHz  ${freq 2} MHz
${color green}CPU Usage:$color $cpu % ${cpubar 6,100}${color green} - Disk I/O:$color $diskio/s
${color lightgrey}${cpugraph 30,190 0000ff ff0000} ${diskiograph 30,190 0000ff ff0000}
${color green}RAM Usage: $color $mem/$memmax - $memperc % ${membar}
${color green}Swap Usage:$color $swap/$swapmax - $swapperc % ${swapbar}
$hr
${color green}Core 0 Temp.:$color ${hwmon coretemp temp 2 1 273} K${color green} - Core 1 Temp.:$color ${hwmon coretemp temp 3 1 273} K
$hr
${color green}Network Ports:$color ${tcp_portmon 1 65535 count}
${if_up        eth0}${color green} eth0 - Upstream:$color ${upspeedf  eth0} KiB/s${color green} - Downstream:$color ${downspeedf  eth0} KiB/s
${color lightgrey}${upspeedgraph  eth0 30,190 0000ff ff0000} ${downspeedgraph  eth0 30,190 0000ff ff0000}
$endif${if_up wlan0}${color green}wlan0 - Upstream:$color ${upspeedf wlan0} KiB/s${color green} - Downstream:$color ${downspeedf wlan0} KiB/s
${color lightgrey}${upspeedgraph wlan0 30,190 0000ff ff0000} ${downspeedgraph wlan0 30,190 0000ff ff0000}
$endif${if_up  ppp0}${color green} ppp0 - Upstream:$color ${upspeedf  ppp0} KiB/s${color green} - Downstream:$color ${downspeedf  ppp0} KiB/s
${color lightgrey}${upspeedgraph  ppp0 30,190 0000ff ff0000} ${downspeedgraph  ppp0 30,190 0000ff ff0000}
$endif$hr
${color green}Filesystems:
${color green} /     $color${fs_used     /}/${fs_size     /} ${fs_bar     /}
${color green} /boot $color${fs_used /boot}/${fs_size /boot} ${fs_bar /boot}
${color green} /home $color${fs_used /home}/${fs_size /home} ${fs_bar /home}
${color green} /tmp  $color${fs_used  /tmp}/${fs_size  /tmp} ${fs_bar  /tmp}
${color green} /usr  $color${fs_used  /usr}/${fs_size  /usr} ${fs_bar  /usr}
${color green} /var  $color${fs_used  /var}/${fs_size  /var} ${fs_bar  /var}
$hr
${color green}${execi 50 ddate}
${color green}${execi 65000 fortune -s | tr -d '\b' | cowsay}
]];

Audio settings

The soundcard's volume levels may be adjusted by your regular user:

$ alsamixer

Set values according to the following table:

Item Mute Value Left Right
Master OO 88 N/A N/A
Headphone OO N/A 51 51
Speaker OO N/A 100 100
PCM N/A N/A 100 100
Mic OO N/A 44 44
Mic Boost N/A N/A 51 51
S/PDIF OO N/A N/A N/A
Beep MM N/A 0 0
Capture N/A CAPTUR 70 70
Auto-Mute Mode N/A Enabled N/A N/A
Internal Mic OO N/A 44 44
Internal Mic Boost N/A N/A 0 0

Power management

Install a power management daemon:

# aptitude install xfce4-power-manager

If you want to have this daemon started on each Fluxbox session you open, insert the following two lines into your regular user's ~/.xsession file (between MANAGER and HANG POINT):

$ grep power ~/.xsession
# start power management daemon
xfce4-power-manager --daemon

You can configure the daemon's settings, by selecting Power manager settings from the menu that pops up when you right-click on its systray icon, or, alternatively, by issueing the following command:

$ xfce4-power-manager-settings

In the "General" tab, choose "Ask" "When power button is pressed", "Do nothing" "When sleep button is pressed", "Do nothing" "When hibernate button is pressed", check "Handle display brightness keys", choose "Lock screen" on battery and "Lock screen" plugged in "When laptop lid is closed", check "Show notifications" and "Show system tray icon". In the "System" tab, choose "System sleep mode" "Hibernate" on battery and "Suspend" plugged in, set "When inactive for" Never on battery and Never plugged in, "Critical battery power level" 10 %, choose "On critical battery power" "Ask", and check "Lock screen when system is going for sleep". In the "Display" tab, check "Handle display power management", set "Black after" 3 Minutes on battery and 30 Minutes plugged in, "Put to sleep after" 5 Minutes on battery and 35 Minutes plugged in, "Switch off after" 7 Minutes on battery and 45 Minutes plugged in, "On inactivity reduce to" 20 % on battery and 80 % plugged in, and "Reduce after" 120 Seconds on battery and Never plugged in.

Hardware event management

In order to handle some hardware events, install the following package:

# aptitude install acpi-support radeontool_

On-the-fly video output reconfiguration

In order to be able to temporarily reconfigure video outputs (screen, external monitors, external video projectors, ...) on the fly, install the following GUI program:

# aptitude install arandr