aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: cdc5be05518e565ecabcda59b58f2d17a4a4c1b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
author:
- Robert Alessi
title: 'The my-x200 package – README file'
subtitle: 'A Debian/Devuan service dedicated to Thinkpads X200'
---

License and Disclamer
=====================
`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.

Overview
========
`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](https://www.devuan.org/) but it should work on other
Debian-based distributions.

Installation
============

1. Clone this repository locally.
2. Do `make debian`.
3. Install the generated `my-x200` `.deb` package as root with `dpkg
   -i`.
4. Edit `/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:—

1. Download the `my-x200` master tarball: <http://git.robertalessi.net/my-x200/snapshot/my-x200-master.tar.gz>
2. Import the developer's [public PGP
   key](https://pgp.ocf.berkeley.edu/pks/lookup?search=0x1773e9248085c8c7),
   like so: `gpg --recv-keys 8085C8C7`
3. Verify the signature: `dscverify --keyring ~/.gnupg/pubring.gpg
   my-x200_<ver>.dsc` (Replace `<ver>` with the actual release
   number.)

For a good GPG cheat sheet, see [here](https://guides.library.illinois.edu/data_encryption/gpgcheatsheet).

Configuration
=============
Once installed, `my-x200` is configured by editing
[`/etc/default/my-x200`](http://git.robertalessi.net/my-x200/tree/my-x200.confd).

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.

Noise Removal
-------------
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`.

Privacy Settings
----------------
`/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.

Backup
------
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:

1. The option must be enabled in the `/etc/default/my-x200` file.
2. The disk must be mounted.
3. An (empty) `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.

Recommended Settings
--------------------
> The command `rc-update` that is used below refers to `openrc`. 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
````

Do Not Use
----------
1. NetworkManager
2. acpi-support (but acpi-support-base is fine and needed)
3. Avahi

To disable `avahi`, do (as root):

````
rc-update del avahi-daemon
chmod -x /etc/network/if-up.d/avahi-daemon
````

Usage
=====
In addition to the usual arguments, namely `start`, `stop`, `restart`
and `force-reload`, `/etc/init.d/my-x200` accepts two further
arguments, like so:—

1. `/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.
2. `/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.

Further Information
===================
More information in `my-x200` initd file:
<http://git.robertalessi.net/my-x200/tree/my-x200.confd>