A Debian/Devuan service dedicated to Thinkpads X200
my-x200
- A Debian/Devuan service dedicated to Thinkpads X200 Copyright (C) 2021 Robert Alessi alessi@robertalessi.net
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
my-x200
is a simple script primarily designed to make the distinctive whining noise of Thinkpads X200 disappear. But it can also be used on other laptops.
It is written to be used on Devuan GNU+Linux but it should work on other Debian-based distributions.
make debian
.my-x200
.deb
package as root with dpkg -i
./etc/default/my-x200
.Alternatively, a .deb
file ready to be installed and its associated .dsc
source package file are provided in this repository. Once these two files and the corresponding two source files .orig.tar.gz
and debian.tar.xz
are downloaded in the same directory, it is advisable to verify the signature like so:—
my-x200
master tarball: http://git.robertalessi.net/my-x200/snapshot/my-x200-master.tar.gzgpg --recv-keys 8085C8C7
dscverify --keyring ~/.gnupg/pubring.gpg my-x200_<ver>.dsc
(Replace <ver>
with the actual release number.)For a good GPG cheat sheet, see here.
Once installed, my-x200
is configured by editing /etc/default/my-x200
.
It is also possible to leave /etc/default/my-200
untouched. In this case, my-x200
can source its configuration from one or more *.conf
files written in a specific directory /etc/default/my-x200.d/
which is to be created. This is the recommended method for these files cannot be affected by subsequent updates.
Set the variable is_thinkpad_x200
to yes
(which is the default value). The default frequency rate should work. It may be changed by modifying the value of PWMFREQ_RATE
.
/etc/default/my-x200
also provides a “Privacy Settings” section: if enable_privacy
is set to true
, then the wired internet interface that may or may not be connected to the internet will have its MAC address spoofed at startup. (The wireless interfaces must also be spoofed, but this can be handled by wpa_supplicant
: see below.) Additionally, my-x200
will delete /var/lib/dhcpcd/duid
, and use /proc/sys/kernel/random/boot_id
to generate a new DUID-LLT-based file with an updated timestamp. A new DUID is generated each time the computer is started.
It must be noted that when enable_privacy
is set to true
my-x200
turns off the wifi radio at computer startup and each time it is put to sleep. The wifi radio has to be turned on or turned back on manually by pressing Fn-F5
.
Finally my-x200
has the ability to backup essential files or directories—for instance to a backup disk mounted inside the dock. Of course, the backup process is triggered on certain conditions only:
/etc/default/my-x200
file.dobackup
file must be present in the backup directory.Then, once these conditions are met, the backup process is triggered whenever the service is stopped.
The command
rc-update
that is used below refers toopenrc
. Other init systems use other commands. Please adapt.
It is advisable to use my-x200 in conjunction with wpa_supplicant
and dhcpcd
only. In addition, wpagui
and dhcpcd-gtk
are also recommended to be able to configure the network from systray applets. If so, wicd
may be disabled: as root, simply do rc-update del wicd
.
wpa_supplicant
For this to work properly, it is important to have these lines in /etc/wpa_supplicant/wpa_supplicant.conf
:
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
mac_addr=1
preassoc_mac_addr=1
(For additional security, do (as root) chmod 700 /etc/wpa_supplicant
)
dhcpcd
And these settings in /etc/dhcpcd.conf
:
hostname "localhost"
hostname_short
/etc/network/interfaces
Finally, /etc/network/interfaces
should look like this:—
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet manual
# wlan interface
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
To disable avahi
, do (as root):
rc-update del avahi-daemon
chmod -x /etc/network/if-up.d/avahi-daemon
In addition to the usual arguments, namely start
, stop
, restart
and force-reload
, /etc/init.d/my-x200
accepts two further arguments, as follows:—
/etc/init.d/my-x200 refresh
to reset the frequency rate of the screen to the default value. This is to be used in the hopefully rare cases when the noise becomes perceptible again. Unprivileged users may perform this action by pressing the ThinkVantage
button./etc/init.d/my-x200 initbackup
. If backuping be set as described above, /etc/init.d/my-x200 initbackup
can be used to trigger a backup round immediately, that is without having to shut down the system for the first backup round to happen.More information in my-x200
initd file: http://git.robertalessi.net/my-x200/tree/my-x200.confd