Joey Hess: more solar data
Entered in 6 months of the house's solar power data.
![]() |
Entered in 6 months of the house's solar power data.
![]() |
root@choco:~# cd /tmp root@choco:/tmp# wget http://downloads.openwrt.org/backfire/10.03/ar71xx/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin Connecting to downloads.openwrt.org (78.24.191.177:80) openwrt-ar71xx-tl-wr 100% ******************************* 2688k 00:00:00 ETA root@choco:/tmp# md5sum openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin 9927973ba5da65d0d52e255397452b87 openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin root@choco:/tmp# mtd -r write /tmp/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin firmware Unlocking firmware ... Writing from /tmp/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin to firmware ... Rebooting ...The device will reboot automatically when it is done. After say 30 seconds, try to connect to it using the default IPv4 address 192.168.1.1. I have connected the WAN port to the Internet and connect to the router over local network connected to the router s LAN1 input. Let s configure OpenWRT, I m calling the host choco and giving it the IPv4 address 192.168.1.46. I ll also set a good root password to disable telnet, and add some SSH keys to simplify remote login.
jas@latte:~$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
=== IMPORTANT ============================
Use 'passwd' to set your login password
this will disable telnet and enable SSH
------------------------------------------
BusyBox v1.15.3 (2010-04-06 03:14:11 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
.-----.-----.-----. .----. _
- _ -__ _ _
_______ __ _____ __ __ ________ __ ____
__ W I R E L E S S F R E E D O M
Backfire (10.03, r20728) --------------------------
* 1/3 shot Kahlua In a shot glass, layer Kahlua
* 1/3 shot Bailey's on the bottom, then Bailey's,
* 1/3 shot Vodka then Vodka.
---------------------------------------------------
root@OpenWrt:/# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root
root@OpenWrt:/# sed -i -e 's/OpenWrt/choco/' /etc/config/system
root@OpenWrt:/# sed -i -e 's/192.168.1.1/192.168.1.46/' /etc/config/network
root@OpenWrt:/# cat>/etc/dropbear/authorized_keys
ssh-rsa AAAAB3NzaC1yc2...
^D
root@OpenWrt:/# dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key
Public key portion is:
ssh-rsa AAAA... root@OpenWrt
Fingerprint: md5 45:fd:62...
root@OpenWrt:/#
You could reboot the machine here to switch from telnet to SSH, but I ll install a bunch of packages while I m at it. Run opkg update to update the package list, and then install the wireless modules for the TL-WR1043ND.
root@OpenWrt:/# opkg update Downloading http://downloads.openwrt.org/backfire/10.03/ar71xx/packages/Packages.gz. Inflating http://downloads.openwrt.org/backfire/10.03/ar71xx/packages/Packages.gz. Updated list of available packages in /var/opkg-lists/packages. root@OpenWrt:/# opkg install kmod-ath9k wpad-mini ... Configuring iw. Configuring kmod-crypto-core. Configuring kmod-crypto-arc4. Configuring kmod-crypto-aes. Configuring wireless-tools. Configuring kmod-cfg80211. Configuring kmod-mac80211. Configuring kmod-ath. Configuring kmod-ath9k. Configuring crda. Configuring wpad-mini. root@OpenWrt:/#Next I ll install some packages that will are needed for the modem.
root@OpenWrt:/# opkg install comgt kmod-usb-serial kmod-usb2 kmod-usb-uhci kmod-usb-ohci usb-modeswitch ... Configuring kmod-nls-base. Configuring kmod-usb-core. Configuring chat. Configuring kmod-usb-ohci. Configuring kmod-usb2. Configuring comgt. Configuring usb-modeswitch. Configuring kmod-usb-serial. Configuring kmod-usb-uhci. root@OpenWrt:/#Now let s reboot the machine and try to get things to really work.
root@OpenWrt:/# sync root@OpenWrt:/# rebootUse SSH to connect to the router, and don t forget the use its new IPv4 address! 3G modems are notoriously known for not acting as a modem directly. Instead they often simulate a CD-ROM that will install device driver software, for inferior operating systems. Fortunately the usb_modeswitch tool fixes the hardware for us. My Huawei E367 start up with the USB vendor/product IDs 0x12d1:0 1446, you normally find this out by looking in /proc/bus/usb/devices. Here is the output on my device:
root@choco:~# cat /proc/bus/usb/devices ... T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=12d1 ProdID=1446 Rev= 0.00 S: Manufacturer=Huawei Technologies S: Product=HUAWEI Mobile C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms root@choco:~#This means I have to go find a usb-modeswitch configuration for this device. Fortunately, I found it on my Debian Squeeze box in /etc/usb_modeswitch.d/12d1:1446 (from the usb-modeswitch-data package). There was a slight problem with the file, it didn t specify the correct USB vendor/product ID of the device after it has been switched . My Huawei E367 switches to 12d1:1506, so I add 1506 to the TargetProductList list. Here is the final configuration:
root@choco:~# cat>/etc/usb-modeswitch.conf EnableLogging=1 DefaultVendor= 0x12d1 DefaultProduct=0x1446 TargetVendor= 0x12d1 TargetProductList="1001,1406,140b,140c,1412,141b,14ac,1506" CheckSuccess=20 MessageContent="55534243123456780000000000000011062000000100000000000000000000" root@choco:~#Now you should be able to run usb_modeswitch to perform the switch :
root@choco:~# usb_modeswitch
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
Found default devices (1)
Accessing device 002 on bus 001 ...
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
No driver found. Either detached before or never attached
SCSI inquiry data (for identification)
-------------------------
Vendor String: HUAWEI
Model String: Mass Storage
Revision String: 2.31
-------------------------
USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
Product: HUAWEI Mobile
Serial No.: not provided
-------------------------
Setting up communication with interface 0 ...
Trying to send the message to endpoint 0x01 ...
OK, message successfully sent
Checking for mode switch (max. 20 times, once per second) ...
Waiting for original device to vanish ...
Original device can't be accessed anymore. Good.
Searching for target devices ...
Searching for target devices ...
Searching for target devices ...
Searching for target devices ...
Searching for target devices ...
Found correct target device
Mode switch succeeded. Bye.
root@choco:~#
The /proc/bus/usb/devices file will now contain information about the real device:
root@choco:~# cat /proc/bus/usb/devices ... T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=12d1 ProdID=1506 Rev= 0.00 S: Manufacturer=Huawei Technologies S: Product=HUAWEI Mobile C:* #Ifs= 7 Cfg#= 1 Atr=c0 MxPwr=500mA A: FirstIf#= 1 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00 I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none) E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 1 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=01 Prot=09 Driver=(none) E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=08 Driver=(none) E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=03 Driver=(none) E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=02 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms root@choco:~#Let s put that command in /etc/rc.local so that it will be run on every boot.
root@choco:~# cat /etc/rc.local # Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. /usr/bin/usb_modeswitch exit 0 root@choco:~#We are not quite ready, the usbserial module needs to be told which USB vendor/product to use. The /etc/modules.d/60-usb-serial file is used during boot to set the right parameters. You can also run rmmod followed by insmod with the proper parameters to avoid a reboot. You can use the gcom info tool to find some information about the modem. Normally you use /dev/ttyUSB0 but for some reason it does not work for me and instead I had to use /dev/ttyUSB3.
root@choco:~# cat>/etc/modules.d/60-usb-serial usbserial vendor=0x12d1 product=0x1506 maxSize=4096 root@choco:~# rmmod usbserial root@choco:~# insmod usbserial vendor=0x12d1 product=0x1506 maxSize=4096 root@choco:~# gcom -d /dev/ttyUSB3 info ##### Wireless WAN Modem Configuration ##### Product text: ==== Manufacturer: huawei Model: E367 Revision: 11.807.05.00.00 IMEI: 353613040739180 +GCAP: +CGSM,+DS,+ES OK ==== Manufacturer: huawei IMEI and Serial Number: 353613040739180 Manufacturer's Revision: 11.807.05.00. Hardware Revision: NOT Network Locked: ERROR: Customisation: NOT SUPPORT Band settings: (NOT) APN: ERROR: ##### END ##### root@choco:~#Let s configure network and wireless. The configurations files are /etc/config/network and /etc/config/wireless. Edit them using your favorite editor, or vi. I m setting up a PSK2 encrypted WLAN and I have a WDS to connect two wireless routers. Note that you need to use the correct PIN for your SIM card (here I m using 8328) and set the APN correctly (I m using bredband.tre.se ). Reboot after making these changes.
root@choco:~# cat /etc/config/network
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'ifname' 'eth0.1'
option 'type' 'bridge'
option 'proto' 'static'
option 'ipaddr' '192.168.1.46'
option 'netmask' '255.255.255.0'
#config 'interface' 'wan'
# option 'ifname' 'eth0.2'
# option 'proto' 'dhcp'
config 'switch'
option 'name' 'rtl8366rb'
option 'reset' '1'
option 'enable_vlan' '1'
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '1'
option 'ports' '1 2 3 4 5t'
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '2'
option 'ports' '0 5t'
config interface wan
option ifname ppp0
option proto 3g
option device /dev/ttyUSB0
option apn bredband.tre.se
option pincode 8328
root@choco:~# cat /etc/config/wireless
config wifi-device radio0
option type mac80211
option channel 5
option macaddr 00:27:19:fc:87:b2
option hwmode 11ng
option htmode HT20
list ht_capab SHORT-GI-40
list ht_capab DSSS_CCK-40
config wifi-iface
option device radio0
option network lan
option mode ap
option ssid Grisslan
option encryption psk2
option key notforyoutosee
config wifi-iface
option device radio0
option network lan
option mode wds
option bssid 00:1F:C6:60:D3:11
option ssid GrisslanWDS
option encryption psk2
option key thisisalsosecret
root@choco:~# reboot
root@choco:~#
Once the machine have rebooted, you can bring up the 3G connection by using ifup wan . Look at the log by using logread and tail the log in the background by doing logread -f & .
root@choco:~# ifup wan Trying to set PIN PIN set successfully root@choco:~# logread tail -20 May 21 13:41:20 choco local2.info chat[2419]: send (ATD*99***1#^M) May 21 13:41:20 choco local2.info chat[2419]: expect (CONNECT) May 21 13:41:20 choco local2.info chat[2419]: ^M May 21 13:41:20 choco local2.info chat[2419]: ATD*99***1#^M^M May 21 13:41:20 choco local2.info chat[2419]: CONNECT May 21 13:41:20 choco local2.info chat[2419]: -- got it May 21 13:41:20 choco local2.info chat[2419]: send ( ^M) May 21 13:41:20 choco daemon.info pppd[2412]: Serial connection established. May 21 13:41:20 choco daemon.info pppd[2412]: Using interface ppp0 May 21 13:41:20 choco daemon.notice pppd[2412]: Connect: ppp0 <--> /dev/ttyUSB0 May 21 13:41:24 choco daemon.warn pppd[2412]: Could not determine remote IP address: defaulting to 10.64.64.64 May 21 13:41:24 choco daemon.notice pppd[2412]: local IP address 95.209.96.115 May 21 13:41:24 choco daemon.notice pppd[2412]: remote IP address 10.64.64.64 May 21 13:41:24 choco daemon.notice pppd[2412]: primary DNS address 80.251.201.177 May 21 13:41:24 choco daemon.notice pppd[2412]: secondary DNS address 80.251.201.178 May 21 13:41:24 choco daemon.info dnsmasq[1028]: reading /tmp/resolv.conf.auto May 21 13:41:24 choco daemon.info dnsmasq[1028]: using nameserver 80.251.201.178#53 May 21 13:41:24 choco daemon.info dnsmasq[1028]: using nameserver 80.251.201.177#53 May 21 13:41:24 choco daemon.info dnsmasq[1028]: using local addresses only for domain lan May 21 13:41:25 choco user.notice rdate: Synced with ptbtime1.ptb.de root@choco:~#Hooray! Or almost so usually the first time you connect, I often get incorrect DNS servers from the server. It shows up like this in the log:
May 21 12:25:04 choco daemon.notice pppd[1157]: primary DNS address 10.11.12.13 May 21 12:25:04 choco daemon.notice pppd[1157]: secondary DNS address 10.11.12.14The exact reason why this happens is beyond me. There are patches floating around for pppd, but I haven t tried them. A common workaround is to hardcode static DNS servers (like Google DNS or OpenDNS). I have come up with my own workaround, based on the observation that when the problem has occurred it will not happen again if I disconnect and reconnect. Thus I have written a small script which is invoked whenever an interface is brought up (typically the WAN interface).
# Written by Simon Josefsson May 2011.
root@choco:~# cat> /etc/hotplug.d/iface/01-reconnect-if-dns-is-broken
case "$ ACTION:-ifup " in
ifup)
if grep -q 10.11.12.13 /tmp/resolv.conf.auto; then
(sleep 30 && ifdown wan && ifup wan) &
fi
;;
esac
root@choco:~# chmod +x /etc/hotplug.d/iface/01-reconnect-if-dns-is-broken
root@choco:~#
That s it! If you found this writeup useful, please flattr it.
To setup a virtual network lab, you get a lot of alternatives. You can
for example use GNS3, Netkit, Marionnet
or VNUML. Some of those tools, like GNS3, allow to
add some closed source equipments like a Cisco 7200 or a Juniper router.
All those tools are a great way to setup your network lab. Look at
them! If you want to setup a virtual network lab for educational
purpose, one of those should fit your purpose. However, none of those
solution were a perfect match for me. I did not want to maintain some
root filesystem. I wanted my lab to start in a few seconds. I wanted
to keep all configuration files (including the ones for the virtual
hosts) into one subdirectory of my home and be able to modify them
while the lab was running. I also wanted to be able to plug some Cisco
router using Dynamips/Dynagen.
None of the listed solution above matched all those
criteria. Therefore, I setup my own lab script with
User Mode Linux. This is not a complete solution, but is more
like a home-made solution to match one particular need. You cannot use
the final result without tweaking it. Again, look at the other
solutions first.
We will go step by step to understand how the lab was built. If you
are in a hurry, you can look at the result which is published on
GitHub.
apt-get install user-mode-linux. You get a linux
command that will run your Linux kernel as a simple process. No need
to be root.
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 | $ linux Core dump limits : soft - 0 hard - NONE Checking that ptrace can change system call numbers...OK Checking syscall emulation patch for ptrace...OK Checking advanced syscall emulation patch for ptrace...OK Checking for tmpfs mount on /dev/shm...nothing mounted on /dev/shm Checking PROT_EXEC mmap in /tmp/user/500/...OK Checking for the skas3 patch in the host: - /proc/mm...not found: No such file or directory - PTRACE_FAULTINFO...not found - PTRACE_LDT...not found UML running in SKAS0 mode Adding 5632000 bytes to physical memory to account for exec-shield gap Initializing cgroup subsys cpuset Linux version 2.6.32 (2.6.32) (root@tito) (gcc version 4.4.5 (Debian 4.4.5-10) ) #2 Thu Jan 27 12:49:46 UTC 2011 [...] console [mc-1] enabled Couldn't stat "root_fs" : err = 2 Failed to initialize ubd device 0 :Couldn't determine size of device's file registered taskstats version 1 VFS: Cannot open root device "98:0" or unknown-block(98,0) Please append a correct "root=" boot option; here are the available partitions: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0) |
init from it. Usually, you build some root file
system and give it as an argument to your UML kernel.
/bin/sh as init instead of
/sbin/init. This will be the first process to be started by our UML kernel.
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ linux init=/bin/sh rootfstype=hostfs [...] Linux version 2.6.32 (2.6.32) (root@tito) (gcc version 4.4.5 (Debian 4.4.5-10) ) #2 Thu Jan 27 12:49:46 UTC 2011 [...] VFS: Mounted root (hostfs filesystem) readonly on device 0:12. IRQ 3/console-write: IRQF_DISABLED is not guaranteed on shared IRQs IRQ 2/console: IRQF_DISABLED is not guaranteed on shared IRQs IRQ 10/winch: IRQF_DISABLED is not guaranteed on shared IRQs /bin/sh: can't access tty; job control turned off # uname -a Linux (none) 2.6.32 #2 Thu Jan 27 12:49:46 UTC 2011 x86_64 GNU/Linux # echo $$ 1 |
1 2 3 4 5 6 7 8 9 | # hostname -b R1 # export TERM=xterm # export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/local/sbin:/usr/sbin # mount -t proc proc /proc # mount -t sysfs sysfs /sys # mount -t tmpfs tmpfs /var/run -o rw,nosuid,nodev # mount -t tmpfs tmpfs /var/log -o rw,nosuid,nodev # mount -o bind /usr/lib/uml/modules /lib/modules # mount -t hostfs hostfs /home/bernat/mylab -o /home/bernat/mylab |
/proc and /sys correctly. We also turn /var/run and
/var/log as tmpfs filesystems. This will allow most daemons to run
correctly: they will be able to write runtime data in /var/run and
to write logs in /var/log. You can even launch your favorite syslog daemon.
The line about /lib/modules is to ensure that our UML kernel is able
to access its kernel modules. For example, we can now use
modprobe tun. The line about /home allows to mount the home
directory of your host inside UML. This was already the case, but
it was mounted as read-only.
One important thing to notice is that while you seem to be root inside
UML, you did not run linux as root. Therefore, when the UML kernel
tries to write a file it will still be bound by the permissions
granted by your host kernel. See this example:
1 2 3 4 | # mount -o remount,rw / # touch /tmp/test1 # touch /etc/test1 touch: cannot touch /etc/test1': Permission denied |
linux as root.
What is interesting with such a setup is that you share the filesystem
with your host. You can modify some configuration file on your host
and your UML will see the modification right away. You can also modify
a file inside UML and see the modification on your host too.
init=/bin/sh. The problem is that you don t have job control. Job
control allows you to put tasks in background and interrupt them while
they are running. It is job control that allows you to stop a program
with ^C. Here, you don t have job control. See:
1 2 | # cat ^C^C^C^C |
linux process
on your host.
Job control is a great mystery for me. I don t know how to enable it
by hand. However, getty is able to enable job control for you. Just
type this command:
1 | # exec getty -n -l /bin/sh 38400 /dev/tty0 |
/bin/sh, but you may prefer /bin/bash
since on most systems, /bin/sh is rather basic.
1 2 3 | # mkdir /var/log/nginx # /etc/init.d/nginx start Starting nginx: nginx. |
/etc/nginx. You don t want to modify this directory for all your
labs. The best way to handle this is to start Nginx with a custom
configuration file:
1 2 | # /etc/init.d/nginx stop # nginx -c /home/bernat/mylab/nginx.conf |
/etc/init.d/nginx script to control Nginx. Moreover, some
daemons do not allow to specify a configuration file. You will then
need to modify your root filesystem.
This is a pretty common problem with Live CD and it is
solved by using an union mount. This is a special kind of mount that
will merge two filesystems into one. One of the two filesystems can be
read-only and all the changes will be reported to the second
one. We will use AUFS. Ensure that you have aufs-tools
package installed. Let s start from scratch for this example.
1 2 3 4 5 6 7 8 9 10 | $ linux init=/bin/sh rootfstype=hostfs [...] # mount -n -t proc proc /proc # mount -n -t sysfs sysfs /sys # mount -o bind /usr/lib/uml/modules /lib/modules # mount -n -t tmpfs tmpfs /tmp -o rw,nosuid,nodev # mkdir /tmp/ro /tmp/rw /tmp/aufs # mount -n -t hostfs hostfs /tmp/ro -o /,ro # mount -n -t aufs aufs /tmp/aufs -o noatime,dirs=/tmp/rw:/tmp/ro=ro # exec chroot /tmp/aufs /bin/bash |
hostfs like this:
1 2 3 4 | # mount -n -t hostfs hostfs /tmp/rw -o /home/bernat/mylab/root,rw # mount -n -t hostfs hostfs /tmp/ro -o /,ro # mount -n -t aufs aufs /tmp/aufs -o noatime,dirs=/tmp/rw:/tmp/ro=ro # exec chroot /tmp/aufs /bin/bash |
/tmp/rw stays
in a tmpfs filesystem. This means that any change to the root
filesystem will be lost. I also was unable to issue a correct
pivot_root before chroot. This is not really important here.
UPDATED: It seems that there are other drawbacks to this
setup. For some reason, if you have a separate /usr partition on
your host system, you won t be able to write to it until you specify
the noxino option to AUFS. Another issue is that AUFS does not
notice most changes on the hostfs filesystem. You can fix this with
option udba=inotify. However, this is incompatible with the noxino
option. Therefore, you need to choose what is best for your
lab. You can also mount some parts of your home with hostfs (for
example, the source directory of the piece of software that you would
like to test).
Let s consider that Nginx configuration is in
/home/bernat/lab/nginx. We simply uses a symbolic link:
1 2 | # rm -rf /etc/nginx # ln -s /home/bernat/mylab/nginx /etc/nginx |
tcpdump on it.
The drawback of such interfaces is that you need to be root to create
them. The application using them does not need to be run as root.
I usually use this nifty shell function to setup TAP interfaces:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | __add_to_bridge() # Optionally, add it to given bridge [ -z "$2" ] [ -f /sys/class/net/$2/brforward ] sudo brctl addbr $2 sudo brctl stp $2 off sudo ip link set $2 up [ -f /sys/class/net/$2/brif/$1 ] # We need to check if it is in another bridge bridge=$(echo /sys/class/net/*/brif/$1 2> /dev/null \ sed 's+/sys/class/net/\([^/]*\)/.*+\1+') 2> /dev/null [ -n "$bridge" ] && \ sudo brctl delif $bridge $1 sudo brctl addif $2 $1 tap() sudo tunctl -b -u $(whoami) -t $1 > /dev/null sudo ip link set up dev $1 __add_to_bridge $1 $2 |
1 2 | $ tap tap-R1 br-R1R2 $ tap tap-R2 br-R1R2 |
1 2 3 4 | $ linux init=/bin/sh rootfstype=hostfs eth0=tuntap,tap-R1 [...] # ip link set up dev eth0 # ip addr add 192.168.0.1/24 dev eth0 |
1 2 3 4 5 6 7 8 9 | $ linux init=/bin/sh rootfstype=hostfs eth0=tuntap,tap-R2 [...] # ip link set up dev eth0 # ip addr add 192.168.0.2/24 dev eth0 # ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. Warning: time of day goes back (-13832us), taking countermeasures. 64 bytes from 192.168.0.1: icmp_req=20 ttl=64 time=0.633 ms 64 bytes from 192.168.0.1: icmp_req=21 ttl=64 time=0.157 ms |
vde2 package to make use of it. You can
run a switch using vde_switch command. You will get a console by
pressing Enter. From this console, you can configure the switch: add
ports, configure VLAN, etc.
Like for TAP interfaces, let s setup two UML connected to this
switch. The first one is like this:
1 2 3 4 | $ linux init=/bin/sh rootfstype=hostfs eth0=vde [...] # ip link set up dev eth0 # ip addr add 192.168.0.1/24 dev eth0 |
1 2 3 4 5 6 7 8 9 | $ linux init=/bin/sh rootfstype=hostfs eth0=vde [...] # ip link set up dev eth0 # ip addr add 192.168.0.2/24 dev eth0 # ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_req=1 ttl=64 time=2.93 ms Warning: time of day goes back (-8101us), taking countermeasures. 64 bytes from 192.168.0.1: icmp_req=2 ttl=64 time=0.503 ms |
Let s implement this lab. You should grab the sources first:
1 2 | $ git clone https://github.com/vincentbernat/network-lab.git $ cd network-lab/lab-redundant-vpn |
setup script which will setup the whole lab for you. You
also have one directory for each UML. Those directories only contain
configuration for the various daemons used inside UML. To make this
lab work, ensure that you have quagga (Quagga, an Internet
routing daemon supporting both OSPF and BGP) and racoon packages.
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 | case $$ in 1) # Inside UML. Three states: [...] ;; *) TMP=$(mktemp -d) trap "rm -rf $TMP" EXIT check_dependencies setup_screen # Setup switches setup_switch site1 setup_switch site101 setup_switch internet # Start VM start_vm R1 eth0=vde,$TMP/switch-site1.sock start_vm R2 eth0=vde,$TMP/switch-site101.sock start_vm V1 eth0=vde,$TMP/switch-site1.sock eth1=vde,$TMP/switch-internet.sock start_vm V2 eth0=vde,$TMP/switch-site1.sock eth1=vde,$TMP/switch-internet.sock start_vm V3 eth0=vde,$TMP/switch-site101.sock eth1=vde,$TMP/switch-internet.sock start_vm V4 eth0=vde,$TMP/switch-site101.sock eth1=vde,$TMP/switch-internet.sock start_vm I1 eth0=vde,$TMP/switch-internet.sock display_help cleanup screen -X quit ;; esac |
$$). If it is 1, this means it has
been invoked as init. Otherwise, it means it has been launched by
the user. We will see the init part later. When called, we first
check some dependencies, then we setup screen. Everything is run
inside a screen session. No multiple windows. The next step is to
setup the various switches needed for our lab. We take one switch for
each site and one switch for Internet . The function that setups the
switch just invokes vde_switch with the help of start-stop-daemon
to record the PID (to shutdown the lab properly).
Then, we start our various UML. For each of them, we need to specify
which network adapters we need. For R1 and R2, we don t use a
network adapter to connect to the internal network. We will use a
dummy0 interface. To emulate Internet, we use another UML,
I1.
For each UML, our script will be used as init. In this case, its PID
will be 1. As we have seen earlier, the script checks if it is called
as init. If it is the case, it will setup the UML. During this
setup, host specific configuration will be applied:
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 | echo "[+] Setup UML" sysctl -w net.ipv4.ip_forward=1 case $ uts in R1) modprobe dummy ip link set up dev dummy0 ip addr add 192.168.15.1/24 dev dummy0 ip addr add 192.168.1.10/24 dev eth0 setup_quagga ;; R2) modprobe dummy ip link set up dev dummy0 ip addr add 192.168.115.1/24 dev dummy0 ip addr add 192.168.101.10/24 dev eth0 setup_quagga ;; V1) ip addr add 192.168.1.11/24 dev eth0 ip addr add 1.1.2.1/24 dev eth1 ip route add default via 1.1.2.10 setup_quagga setup_racoon 1.1.2.1 1.1.1.1 192.168.0.0/19-192.168.100.0/19 ;; V2) ip addr add 192.168.1.12/24 dev eth0 ip addr add 1.1.2.2/24 dev eth1 ip route add default via 1.1.2.10 setup_quagga setup_racoon 1.1.2.2 1.1.1.2 192.168.0.0/19-192.168.100.0/19 ;; V3) ip addr add 192.168.101.13/24 dev eth0 ip addr add 1.1.1.1/24 dev eth1 ip route add default via 1.1.1.10 setup_quagga setup_racoon 1.1.1.1 1.1.2.1 192.168.100.0/19-192.168.0.0/19 ;; V4) ip addr add 192.168.101.14/24 dev eth0 ip addr add 1.1.1.2/24 dev eth1 ip route add default via 1.1.1.10 setup_quagga setup_racoon 1.1.1.2 1.1.2.2 192.168.100.0/19-192.168.0.0/19 ;; I1) ip addr add 1.1.1.10/24 dev eth0 ip addr add 1.1.2.10/24 dev eth0 ;; esac |
vtysh to get Quagga console):
1 2 3 4 5 6 7 8 9 10 11 | R1# show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - ISIS, B - BGP, > - selected route, * - FIB route C>* 127.0.0.0/8 is directly connected, lo O 192.168.1.0/24 [110/10] is directly connected, eth0, 00:25:42 C>* 192.168.1.0/24 is directly connected, eth0 O 192.168.15.0/24 [110/10] is directly connected, dummy0, 00:25:42 C>* 192.168.15.0/24 is directly connected, dummy0 O>* 192.168.115.0/24 [110/20] via 192.168.1.11, eth0, 00:02:24 * via 192.168.1.12, eth0, 00:02:24 |
1 2 3 4 5 6 7 8 9 10 11 12 | V3# show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - ISIS, B - BGP, > - selected route, * - FIB route K>* 0.0.0.0/0 via 1.1.1.10, eth1 C>* 1.1.1.0/24 is directly connected, eth1 C>* 127.0.0.0/8 is directly connected, lo O 192.168.15.0/24 [110/20] via 192.168.101.14, eth0, 00:04:26 B>* 192.168.15.0/24 [20/20] via 192.168.1.11 (recursive via 1.1.1.10), 00:07:16 O 192.168.101.0/24 [110/10] is directly connected, eth0, 00:07:30 C>* 192.168.101.0/24 is directly connected, eth0 O>* 192.168.115.0/24 [110/20] via 192.168.101.10, eth0, 00:07:18 |
1 2 3 4 | R1# ping -I 192.168.15.1 192.168.115.1 PING 192.168.115.1 (192.168.115.1) from 192.168.15.1 : 56(84) bytes of data. Warning: time of day goes back (-459129us), taking countermeasures. 64 bytes from 192.168.115.1: icmp_req=1 ttl=62 time=1.10 ms |
ip link set down eth1 on V1). The previous multipath route on R1
is now a single route through V2. Moreover, V3 has lost its BGP
route to V1 and is now using its OSPF route through V4:
1 2 3 4 5 6 7 8 9 10 11 | V3# show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - ISIS, B - BGP, > - selected route, * - FIB route K>* 0.0.0.0/0 via 1.1.1.10, eth1 C>* 1.1.1.0/24 is directly connected, eth1 C>* 127.0.0.0/8 is directly connected, lo O>* 192.168.15.0/24 [110/20] via 192.168.101.14, eth0, 00:10:13 O 192.168.101.0/24 [110/10] is directly connected, eth0, 00:13:17 C>* 192.168.101.0/24 is directly connected, eth0 O>* 192.168.115.0/24 [110/20] via 192.168.101.10, eth0, 00:13:05 |
This has been several months since I didn t use much my laptop, an
Asus S5N: it was crippled by a short battery life and was hit by
several bugs, most of them targeting the i855GME graphic chipset
thanks to the use of GEM and KMS in the latest Xorg. I did
not want to invest too much in a laptop and I have found
a rebate from Lenovo for Thinkpad Edge series. Voil , I have a
Thinkpad Edge 11 .
Here is the configuration that I bought:
1 | # dd if=debian-testing-amd64-netinst.iso of=/dev/sdb |
/usr
in the root partition since having a separate /usr is less and less
supported, especially with piece of software like udev.
The partitioning tool in Debian installer do not allow to resize
volumes, you need to destroy them and recreate them as well as their
content. However, this is still faster than writing a patch for this.
When the installation is finished, the laptop boots on a 2.6.38
kernel, asks for the passphrase to decrypt the LUKS volume and display
the login prompt a few seconds later.
/etc/apt/sources.list to get unstable:
deb http://ftp.fr.debian.org/debian/ unstable main deb-src http://ftp.fr.debian.org/debian/ unstable main deb http://ftp.fr.debian.org/debian/ experimental main contrib non-free
/etc/apt/preferences.d/experimental:
Package: * Pin: release experimental Pin-Priority: 101
zsh, my favourite shell with my hand-made maturating
configuration. I should put it on
GitHub one day.mg, is the editor that I use to quickly edit a configuration
file. I don t like vi. I have used jed for a long time but its
default configuration can be cumbersome and it misses some emacs keybinding.emacs, my work environment. I use it as a text editor and mail
reader (with Gnus). I don t use it as a
browser nor as a terminal. As for zsh, I have my configuration
files ready to be copied anywhere.fvwm, my window manager since quite some time. I use
fvwm-crystal on top of it. My configuration is
described in another post. I also use conky.rxvt-unicode, a terminal. It has a very good terminal emulation
and some fancy features like transparency (using compositing or
not). It is light and fast and allows to search in the
backbuffer. It can use a client/server system that will close all
your windows when the server crashes. This almost never happens.unison, a synchronisation tool that allows me to keep the same
files on my different computers.gdm3 is the only display manager that is able to talk correctly
to ConsoleKit and get the rights set correctly without adding
yourself to a lot of groups.rpcbind and nfs-common. I use ferm to setup a simple
firewall. Here is my ferm.conf:
domain (ip ip6) table filter chain INPUT policy DROP; mod state state INVALID DROP; mod state state (ESTABLISHED RELATED) ACCEPT; interface lo ACCEPT; proto tcp dport ssh ACCEPT; chain OUTPUT policy ACCEPT; mod state state (ESTABLISHED RELATED) ACCEPT; chain FORWARD policy DROP;
unison will then sync my configuration files and my documents. After
this step, my environment is ready.
lspci and lsusb, everything seems pretty easy to get supported.
Here is lspci output:
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02) 00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02) 00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06) 00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06) 00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06) 00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06) 00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06) 00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06) 00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6) 00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06) 00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 06) 00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06) 00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06) 03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03) ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02) ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02) ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02) ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02) ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02) ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
lsusb output (I disabled the broadband modem in the BIOS and
therefore, it does not appear here):
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 003: ID 0bda:0158 Realtek Semiconductor Corp. USB 2.0 multicard reader Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller Bus 002 Device 003: ID 5986:01a7 Acer, Inc Lenovo Integrated Webcam
thinkpad_acpi will handle most of the
perks under the hood.
I do not use a complete desktop like Gnome. I usually prefer to use
command line tools and put them in .xsession for persistence. There
is usually some graphical utility to do the same thing. There are
however some configuration steps that are now far easier to do with a
graphical tool. Since I use X all the time, I just rely on those tools
when necessary.
lshw output, I see that I already have the latest BIOS
available. No need to update then. In case you need to update, yours,
ThinkWiki has a documentation to upgrade. You can find
memdisk image in syslinux package.
A very recent Linux distribution with kernel 2.6.33 and Intel Xorg driver 2.11 or newer is recommended. Note that XVideo (Xv) playback at certain frame sizes does not work properly unless you have at least version 2.12 of the Intel Xorg driver.With Debian Wheezy, you get version 2.15. Therefore, configuring the graphic card is just a matter of installing
xserver-xorg-video-intel
and that s all. No /etc/X11/xorg.conf needed.
HDMI and VGA outputs are detected without configuring anything. They
can be enabled with xrandr. I did not try if it was possible to use
both of them at the same time.
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192 LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 256mm x 144mm 1366x768 60.0*+ 50.0 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) DP1 disconnected (normal left inverted right x axis y axis)
i965-va-driver
package. Here is the output of vainfo:
libva: libva version 0.32.0 libva: va_getDriverName() returns 0 libva: Trying to open /usr/lib/dri/i965_drv_video.so libva: va_openDriver() returns 0 vainfo: VA API version: 0.32 vainfo: Driver version: i965 Driver 0.1 vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileH264Baseline : VAEntrypointVLD VAProfileH264Main : VAEntrypointVLD VAProfileH264High : VAEntrypointVLD
ffmpeg-hw=1
in your ~/.config/vlc/vlcrc. We are then greeted by this:
[0x2629040] avcodec decoder: Using VA API version 0.32 for hardware decoding.
xinput
command. Here is the output of xinput list:
Virtual core pointer id=2 [master pointer (3)] Virtual core XTEST pointer id=4 [slave pointer (2)] SynPS/2 Synaptics TouchPad id=11 [slave pointer (2)] TPPS/2 IBM TrackPoint id=12 [slave pointer (2)] Virtual core keyboard id=3 [master keyboard (2)] Virtual core XTEST keyboard id=5 [slave keyboard (3)] Power Button id=6 [slave keyboard (3)] Video Bus id=7 [slave keyboard (3)] Power Button id=8 [slave keyboard (3)] Integrated Camera id=9 [slave keyboard (3)] AT Translated Set 2 keyboard id=10 [slave keyboard (3)] ThinkPad Extra Buttons id=13 [slave keyboard (3)]
xinput list-props will give you additional information
on each input device listed above. You can then configure any settings
using xinput set-prop. For example, if you want to enable scrolling
by using the edges of the touchpad and enable palm detection, you can
use the following commands:
1 2 | $ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Edge Scrolling' 8 1 1 0 $ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Palm Detection' 8 1 |
1 | $ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Off' 8 1 |
man 4 synaptics. The same applies
for the trackpoint but the correct manual page is man 4 evdev. For
example, if you want to enable scrolling using the middle button, use:
1 2 | $ xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1 $ xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2 |
~/.xsession.
xinput list. Therefore, your window manager or any other application
can intercept them and act upon. You can use evtest to check which
key triggers which event on which keyboard.
The acpid daemon listen on those keyboards and can also trigger some
actions. For example, it will run ibm-wireless.sh when you hit the
wireless toggle. By default, this will enable or disable your wireless
card. But you can configure the script to use a multistate toggle and
disable or enable the bluetooth card as well.
~/.asoundrc:
pcm.!default type pulse ctl.!default type pulse
firmware-iwlwifi package. Then, iwlagn module needs to be
loaded. You can check with rfkill list that the wireless card has
not been disabled. iw list will then give the status:
Wiphy phy0 Band 1: Capabilities: 0x872 HT20/HT40 Static SM Power Save RX Greenfield RX HT20 SGI RX HT40 SGI No RX STBC Max AMSDU length: 3839 bytes No DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 4 usec (0x05) HT RX MCS rate indexes supported: 0-15, 32 TX unequal modulation not supported HT TX Max spatial streams: 1 HT TX MCS rate indexes supported may differ Frequencies: * 2412 MHz [1] (14.0 dBm) * 2417 MHz [2] (14.0 dBm) * 2422 MHz [3] (14.0 dBm) * 2427 MHz [4] (14.0 dBm) * 2432 MHz [5] (14.0 dBm) * 2437 MHz [6] (14.0 dBm) * 2442 MHz [7] (14.0 dBm) * 2447 MHz [8] (14.0 dBm) * 2452 MHz [9] (14.0 dBm) * 2457 MHz [10] (14.0 dBm) * 2462 MHz [11] (14.0 dBm) * 2467 MHz [12] (14.0 dBm) (passive scanning, no IBSS) * 2472 MHz [13] (14.0 dBm) (passive scanning, no IBSS) Bitrates (non-HT): * 1.0 Mbps * 2.0 Mbps (short preamble supported) * 5.5 Mbps (short preamble supported) * 11.0 Mbps (short preamble supported) * 6.0 Mbps * 9.0 Mbps * 12.0 Mbps * 18.0 Mbps * 24.0 Mbps * 36.0 Mbps * 48.0 Mbps * 54.0 Mbps max # scan SSIDs: 20 Supported interface modes: * IBSS * managed * monitor
iwlagn 0000:03:00.0: Detected Intel(R) Centrino(R) Wireless-N 1000 BGN, REV=0x6C iwlagn 0000:03:00.0: device EEPROM VER=0x15d, CALIB=0x6 iwlagn 0000:03:00.0: Device SKU: 0X9 iwlagn 0000:03:00.0: Valid Tx ant: 0X1, Valid Rx ant: 0X3 iwlagn 0000:03:00.0: Tunable channels: 13 802.11bg, 0 802.11a channels iwlagn 0000:03:00.0: irq 44 for MSI/MSI-X iwlagn 0000:03:00.0: loaded firmware version 128.50.3.1 build 13488
ifup and ifdown commands,
even for servers. It seems that this is not something impossible and
therefore, I think it has become flexible enough to ensure most of the
configuration tasks I need.
hci_usb module will
take care of it. It supports AD2P and can be used to listen to music
with a compatible headset. hciconfig will tell us if the chipset is working.
Again, bluetooth is easier to configure with a graphical
tool. BlueZ, the bluetooth stack in Linux, uses DBus to
communicate with other applications. The command line tools have been
deprecated and therefore, you need to fight with some DBus binding to
pair your computer to your headset.
gnome-bluetooth package comes with an applet which allows you to
quickly pair to any device. If you install
pulseaudio-module-bluetooth package, any bluetooth headset should
work out of the box.
msiexec as instructed (I did have to
execute the installation program first, otherwise, msiexec tells
that the file is invalid). I choosed the default firmware since my
laptop is unlocked. ThinkWiki page explains which firmware to
choose in which situation.
The package gobi-loader needs to be installed. The firmware files
amss.mbn, apps.mbn and UQCN.mbn should be placed in
/lib/firmware/gobi. They will be loaded by udev. To avoid to
reboot, I used this command:
1 | # /lib/udev/gobi_loader -2000 /dev/ttyUSB0 /lib/firmware/gobi
|
rfkill list that your WWAN card is not blocked. I did
not test the GPS part that needs to be enabled on Windows.
uvcvideo module is correctly loaded and you should have something
like this in your dmesg:
uvcvideo: Found UVC 1.00 device Integrated Camera (5986:01a7)
cheese is a small application that can be used to check if the
webcam operates as expected.
uswsusp package which will also pull pm-utils. You
will get pm-suspend and pm-hibernate commands.
pm-suspend will enable suspend to memory. On resume, the system
takes a whole minute to become operational. I get the following message:
r8169 0000:09:00.0: eth0: unable to apply firmware patch PM: resume of devices complete after 60786.035 msecs PM: Finishing wakeup.
firmware-realtek package solves this issue. It should
also be solved by a future kernel. I also have this message when I
come back from sleep:
[drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed... render ring idle [waiting on 9297, at 9297], missed IRQ?
i915.semaphores=1 as a kernel parameter but the X server is still
slow. It seems that running powertop restores the original
speed. This is a known problem.
On sleep, the battery loses 2% every 6 hours. This allows you to keep
your laptop on sleep for several days if needed.
pm-hibernate enable suspend to disk. The suspend part works well but
on resume, the kernel freezes after reading back the image into
memory. There are some documentation to debug this problem
but I prefer to wait for 2.6.39 which may just solves this issue.
cpufrequtils
package will slow down the processor when it is not used by using the
ondemand governor. The frequency will drop from 1.33 GHz to 666 MHz.
Several tools are then available:
pm-utils package comes with scripts to enable some powersaving
features. Those scripts are run on ACPI events (for example, when
you unplug the AC adapater). There is no way to put the laptop to
sleep after two hours of inactivity for example. You need something
like sleepd to handle this part. I have found nothing that could
dim the screen on inactivity.laptop-mode-tools is also a set of script to be run on ACPI
events. It is therefore somewhat superseded by pm-utils.gnome-power-manager is a daemon that makes use of
upowerd. Despite its name, you can run it outside of the Gnome
environment. It will put your laptop to sleep on inactivity and
will dim the screen when needed. All other functionalities are
handled to upowerd. This seems the way to go on today Linux desktops.upowerd will call at some point pm-powersave
from pm-utils. This allows to run scripts when unplugging the AC
adapter. There are some scripts shipped in
/usr/lib/pm-utils/power.d. You can add your own in
/etc/pm/power.d. Some scripts are configurable. For example, if you
create /etc/pm/config.d/local and put SATA_ALPM_ENABLE=true in it,
this will enable SATA ALPM mode on battery.
You can check what needs to be done with powertop or go to a website
like Less Watts to get some tips on what to configure to
get a better battery life.
Without adding any script, I get 5 hours of battery life with the
laptop doing almost nothing. Lenovo tells that you should get 6 hours
of battery life. I think that on moderate workloads, you should get 4 hours.
As previously announced in Ganneff s blog and Debian News, a special funding for DebConf11 is available for Debian Developers and Debian Maintainers who have either never attended a DebConf before, or who have not been to a DebConf since DebConf7 (in Scotland).
How to apply
Email the DebConf Newbies Team (newbies@debconf.org) providing the following information:
There is actually some buzz around Gnome 3
and the new release of Ubuntu switching to Unity. I thought
this was a good occasion to make this small post to tell that I still
uses FVWM whose latest version was released a month ago.
FVWM is a very old window manager. So old that nobody really knows
what the F stands for. It comes with a ugly configuration by default
and can be configured to look even uglier. However, FVWM is
powerful and highly configurable. Moreover, it is pretty lightweight.
fvwm-crystal. If you are running Debian or Ubuntu, there
is a package for this. This is a set of powerful configuration files
for FVWM which add a lot of goodies and themes. Unfortunately, the
project site seems to have disappared. You can still grab the
sources from your nearest Debian mirror.
While those configuration files were great, I did not like to have
such a complex desktop with all those icons and menus. However, what
is great with fvwm-crystal is you can overlay your own
configuration. If a file is present in your home directory, it will
take precedence over the one installed on the system. So, I just wrote
a new recipe.
What you may want to steal from my configuration is the ability to
alter the configuration depending on the fact that you are using one
or two screens. With one screen, you get:
With two screens, the organization is different. The two icon managers
at the bottom are on their own screens. The pager is between the two
screens and the other elements are on the upper left of the right screen.
If I am using a single screen and I plug another one, I do something
like this to get my setup updated:
1 2 | $ xrandr --output VGA-1 --auto --output DVI-I-1 --auto --right-of VGA-1 $ killall trayer ; FvwmCommand Restart |
.xsession, not through FVWM.
1 | $ ./build-wallpaper.py -d ~/.fvwm/wallpapers -c -t ~/tmp/mywallpaper.png
|
python-xpyb
and python-imaging.
UPDATE: Thomas Adam pointed to Nitrogen, a
graphical wallpaper utility supporting multi-head setups. It is a
great tool if you want to set manually your wallpaper but it does not
allow to select a random one.
Nowadays, I grab most of my wallpapers from
InterfaceLIFT.
IPv6 adoption is increasing, and along with it come a new set of behaviours and defaults that system administrators and users must learn and become familiar with. I was recently caught out by Linux s handling of IPv6 router advertisements (RAs) when forwarding is also enabled on the interface. It took me a while to figure out and searching for obvious terms (such as those in the first half of the title of this post) didn t immediately yield useful answers, so here is my attempt to help shed some light on the subject.
By default Linux will ignore IPv6 RAs if the interface is configured to forward traffic. This is in line with RFC2462 which states that a device should be either a Host or a Router. If you re forwarding packets you re a router and you re therefore expected to be sending RAs, not receiving them. This policy does make a certain amount of sense but there are obviously situations where it can be useful to accept RAs and still forward packets over the interface[0]. The confusing part is that the Linux IPv6 stack allows the accept_ra sysctl to be set to 1 (enabled) at the same time as the forwarding sysctl is set to 1, yet all incoming RAs are ignored with no hint as to why. If you re not aware that the default behaviour is to ignore RAs when forwarding is enabled it looks very much like autoconfiguration has simply broken.
The key piece of information is that makes everything as clear as mud is realising that the forwarding and accept_ra sysctl s are not simple boolean enabled/disabled flags like many of their brethren. There are instead three possible values for each, all clearly documented in sysctl.txt, when you take the time to read it. Ironically the documentation states the type of the values as BOOLEAN even though they re not at least it helped me to feel better about my hasty assumption that the sysctl s were boolean values.
accept_ra BOOLEANThe documentation for
Accept Router Advertisements; autoconfigure using them. Possible values are:
0 Do not accept Router Advertisements.
1 Accept Router Advertisements if forwarding is disabled.
2 Overrule forwarding behaviour. Accept Router Advertisements
even if forwarding is enabled. Functional default: enabled if local forwarding is disabled.
disabled if local forwarding is enabled.
forwarding is similar, but much longer, so you can refer to the link above to see it.
Conclusion: If you want to autoconfigure IPv6 addresses on an interface that you re also forwarding IPv6 traffic over, you need to set accept_ra to 2.
No doubt there are more IPv6 quirks and defaults like this waiting to trap me in the future
My previous website was generated (dynamically) with mod_autoindex,
a module from Apache targeted at rendering an index page for the files
contained in a directory. Pretty basic (but themable). Here is a new
revamped web site using Hyde, a static
web generator written in Python.
Yes, finally, I decided to upload my Debconf 10 pictures. Not to my own gallery, as usual, because it is apparently broken (viewing
pictures works but upload plugins aren't). So, they are on Debconf
gallery site.
So, please enjoy a few more gazillion of weird Debconf pictures.
Sorry to the Debconf
10 official report editors: I should have done
this before so that you have pictures
of Debconf runners.
I ve been a little sick the last days and decided to be productive instead of just drinking tea all the time.The result are some (10) squashed bugs from pkg-games, and one long standing nmu.adonthell#624998 LP#765984
After numerous contributions from many of you, the DebConf team has finally released the DebConf10 Final Report. It s a 46-page document which
gives the reader an idea about the conference as a whole. It includes descriptions of talks, DebCamp and Debian Day activities, personal impressions, attendee and budgeting numbers, the work of various teams, social events, funny pictures and so on. If you attended Debconf10, the report will refresh some of your remarkable memories and bring you closer to the organization team work. If not, it will certainly encourage you to be part of future Debian events :)
The report is available in two PDF sizes and can be downloaded from Debconf media website. Enjoy!
the DebConf team
Since this has been a major request from users for a long time, I can only cool with the idea of seeing the Debian project support a rolling release. However I m not pleased with the proposed ideas, since they don t actually include any serious plan to make this happen. Sorry guys, but a big GR that says We want a
This is my monthly summary of my Debian related activities. If you re among the people who support my work, then you can learn how I spent your money. Otherwise it s just an interesting status update on my various projects.
GNOME 3 packaging
Right after the GNOME 3 release, I was eager to try it out so I helped the pkg-gnome team to update some of the packages. I did some uploads of totem, totem-pl-parser, gvfs, mutter, gnome-shell, gnome-screensaver. I also kept people informed via my blog and prepared a pinning file for adventurous users who wanted to try it out from experimental (like me).
One month later, I m still using GNOME 3. There are rough edges still, but not so many. And I m starting to get used to it.
Debian Rolling planning
Debian Rolling is a project on my TODO list for quite some time. I decided it was time to do something about it and started a series of articles to help clarify my ideas while getting some early feedback. My goal was to prepare a somewhat polished proposal before posting it to a Debian mailing list.
But as usual with Murphy s law, my plan did not work out as expected. Almost immediately after my first post the discussion started on debian-devel:
At this point it s a discussion thread of several hundreds of messages (there are several screens of messages like the one above). Many of the sub-threads have been interesting, but the general discussions mixed too many different things so that there s no clear outcome yet. Lucas Nussbaum tried to make a summary.
Obviously I must adjust my plan, there s lots of feedback to process. I accepted to drive a DEP together with Sean Finney to help structure the part of the discussion that focuses on allowing development to continue during freezes. But I m also eager to fix the marketing problem of testing and have the project recognize that testing is a product in itself and that end-users should be encouraged to use it.
Package Tracking System maintenance
The Package Tracking System is an important tool for Debian developers, and it has been broken by some change on the Bug Tracking System. I worked around it quite quickly so that few people noticed the problem but Cron kept reminding me that I had to properly fix it.
I ended up doing it last week-end. While working on the PTS, I took the opportunity to merge a patch from Jan Dittberner to enhance the news RSS feed that the PTS provides. And I also integrated information from backports.debian.org (thanks to Mehdi Dogguy for reminding me #549115).
Multiarch update
Not much new this month. I fixed two bugs in the multiarch dpkg branch thanks to bug reports from Ubuntu users (LP 767634, LP 756381). I m still waiting on Guillem Jover finishing his review of the multiarch branch. I m pinging him from time to time but it looks like multi-arch is no longer in his short term priority list. 8 comments Liked this article? Click here. My blog is Flattr-enabled.
The above sign was prominently displayed at a fair that was recently run by the Banyule Council. We have had some discussions in the Linux community about what policies should be used in regard to photography at events, it seems that this is a precedent for being able to opt-out of public photography.
Last week, I announced the activation of Uyghur language in Debian
Installer. For once, I even went further: I rebuilt all D-I packages
that include localization (at least for i386/amd64 architectures) and uploaded them.
As a consequence, D-I daily builds now allow previewing how an install
done in Uyghur can be like.
For this, please go to the Debian Installer
development page, download the netboot ISO image
(not netinst) and launch D-I with "suite=unstable" passed as
argument when booting the ISO image.
You should end up with something like this, this or this. There are
a few glitches, still: for instance, as the font we chose has no Bold
variant, the screens "titles" do not use an Uyghur font but an Arabic
or Persian one. As a consequence, glyphs ar enot properly joined
together. I'm investigating this issue with Uyghur translators and
we're trying to choose an appropriate font among the gazillion that have been created by UKIJ.
Please notice that Uyghur looks like Arabic but, according to those
who can read Arabic, is really different from Arabic (or Persian).
I hope that this great work by Gheyret Tohti, Abduqadir Abliz and
other people working on this will give ideas to other so-called
"minorities", here or there in the world, who want to be able to
install Debian in their language.
There is still a lot of work to do, such as having end-user software
localization for Uyghur and, then, a uyghur-desktop task, but this is
at least the first language that gets added for wheezy.
In case you would be wondering, the current
count of activated languages in D-I is 71.
svn-all-fast-export --identity-map authors.txt --rules pkg-ace.rules svn-pkg-aceHere's the content of the pkg-ace.rules configuration file that was used:
create repository pkg-ace end repository match /trunk/ repository pkg-ace branch master end match match /(branches tags)/([^/]+)/ repository pkg-ace branch \2 end matchThe author mapping file authors.txt being:
markos = Konstantinos Margaritis <email-hidden> mbrudka-guest = Marek Brudka <email-hidden> pgquiles-guest = Pau Garcia i Quiles <email-hidden> tgg = Thomas Girard <email-hidden> tgg-guest = Thomas Girard <email-hidden>The tool sample configuration file merged-branches-tags.rules recommends to post-process tags, which are just a branch in SVN. That's why the configuration file above treats branches as tags. The conversion was indeed fast: less than 1 minute.
svn tags as branches:
Branches are marked with green rectangles, and tags with yellow arrows.
What we have here (expected given our configuration of the tool) are
branches (e.g. 5.4.7-5) corresponding to tags, and tags matching the SVN
tagging commit (e.g. backups/5.4.7-5@224). We'll review and fix this.
merged code that did not appear as such:
Branches that were not merged using svn merge look like they were not
merged at all.
commits with wrong author:
Before being in SVN, the repository was stored in CVS. When it was imported
into SVN, no special attention was given to the commit author. Hence I
got credited for changes I did not write.
obsolete branches:
The tool leaves all branches, including removed ones (with tag on their end)
so that you can decide what to do with them.
missing merges:
The branch 5.4.7-12 was never merged into the trunk!
#!/usr/bin/env ruby # # retag.rb # # Small script to create an annotated tag, specifying commiter as well as # date, and tag comment. # # Based on Scott Chacon "Custom Importer" example. # # Arguments: # $1 -- tag name # $2 -- sha-1 revision to tag # $3 -- committer in the form First Last <email> # $4 -- date to use in the form YYYY/MM/DD_HH:MM:SS def help puts "Usage: retag <tag> <sha1sum> <committer> <date> <comment>" puts "Creates a annotated tag with name <tag> for commit <sha1sum>, using " puts "given <committer>, <date> and <comment>" puts "The output should be piped to git fast-import" end def to_date(datetime) (date, time) = datetime.split('_') (year, month, day) = date.split('/') (hour, minute, second) = time.split(':') return Time.local(year, month, day, hour, minute, second).to_i end def generate_tag(tag, sha1hash, committer, date, message) puts "tag # tag " puts "from # sha1hash " puts "tagger # committer # date +0000" print "data # message.size \n# message " end if ARGV.length != 5 help exit 1 else (tag, sha1sum, committer, date, message) = ARGV generate_tag(tag, sha1sum, committer, to_date(date), message) end
me@mymachine$ echo 6a6d48814d0746fa4c9f6869bd8d5c3bc3af8242 11cf74d4aa996ffed7c07157fe0780ec2224c73e 898ad49b61d4d8d5dc4072351037e2c8ade1ab68 >> .git/info/grafts
#!/bin/sh br="HEAD" TARG_NAME="Raphael Bossek" TARG_EMAIL="hidden" export TARG_NAME TARG_EMAIL filt=' if test "$GIT_COMMIT" = 546db1966133737930350a098057c4d563b1acdf -o \ "$GIT_COMMIT" = 23419dde50662852cfbd2edde9468beb29a9ddcc; then if test -n "$TARG_EMAIL"; then GIT_AUTHOR_EMAIL="$TARG_EMAIL" export GIT_AUTHOR_EMAIL else unset GIT_AUTHOR_EMAIL fi if test -n "$TARG_NAME"; then GIT_AUTHOR_NAME="$TARG_NAME" export GIT_AUTHOR_NAME else unset GIT_AUTHOR_NAME fi fi ' git filter-branch $force --tag-name-filter cat --env-filter "$filt" -- $br(Script edited here; there were much more commits written by Raphael.)
Important
It's important to realize that the whole selected branch history is rewritten, so all objects id will change. You should not do this if you already published your repository.
Hint
Once git filter-branch completes you get a new history, as well as a new original ref to ease comparison. It is highly recommended to check the result of the rewrite before removing original. To shrink the repo after this, git clone the rewritten repo with file:// syntax -- git-filter-branch says it all.
Add graft points where needed.
Clean tags and branches. Using git tag -d, git branch -d and the Ruby script above it was possible to recreate tags. During this I was also able to add missing tags, and remove some SVN errors I did -- like committing in a branch created under tags/.
Remove obsolete branches.
Merge missing pieces. There were just two missing debian/changelog entries. I did this before git filter-branch because I did not find a way to use the tool correctly with multiple heads.
Fix commit author where needed. Using the shell script above Raphael is now correctly credited for his work.
| [1] | http://lists.alioth.debian.org/pipermail/pkg-ace-devel/2011-March/002421.html |
| [2] | available in Debian as svn-all-fast-export |
Next.