Entered in 6 months of the house's solar power data.
![]() |
Entered in 6 months of the house's solar power data.
![]() |
This week, I continued triaging bugs in the samba source package. The
result is interesting
Many bugs are tagged "moreinfo", most of them being old bugs, many
likely to be user error....or something fixed for quite a while. So, I
expect the bug count to decrease again. Moreover, I did a call for
translations 10 days ago, so about 10 bugs are indeed transaltion
updates which will be closed in next upload.
Samba upstream also released their 3.6.0rc1 version this week, and 53
hours after the annoucement, it landed in Debian experimental.
I pushed tasksel 3.02 in git. Indeed, I upload it quite a while ago
and forgot to push the release and tags. I'm not entirely used to git,
as it seems..:-)
On l10n front, I launched a Smith review for ntfs-3g and launched a call for translations matlab-support (and got
thanks from maintainer).
Finally, after last week push, the French team completed to
translation of package descriptions for the top500 packages in popcon.
As a consequence, I moved the target further and we nos have
"Popcon600" on
the stats page. French now reached rank 3 in the DDTP.
Old blog entries popped out from my laptop after a restore where I
couldn't restore file dates. Sorry..:-)
After my rehearsal
from yesterday, I finally booked my flights to Edinburgh for Debconf 7.
I'll fly from CDG terminal F on June 15th 16:15 (AF5052) and will fly back
to CDG on June 24th 09:05 (AF5051). The return flight is somewhat more
expensive than later flights (about 30EUR more) but much more convenient for
me.
See you in EDI, ladies and gentlemen...
New pictures again (I leave tomorrow for holidays, so I hurry up). Again
among my favourite ones, pictures of people
just socializing. Amaya once wrote that Debconf is more about
socializing than hacking and I couldn't agree more.
... I just learned how to use Mercurial after Daniel converted his darcs
repository for aptitude to Mercurial.
Being such a VCS wizard when you're told to be the DD with
no programming skills is kinda scary...:-)
There are some
bloggers who I'm really happy to see back in the blogosphere.
Geez, I got a Nokia M770 for
X-Mas. /me does the geek dance.
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 |
With the final package, fcoe-utils, clearing the NEW packages queue, the Open-FCoE project's Fibre Channel over Ethernet stack is now in the Debian archive. I had anticipated to have access to FCoE hardware by the time the packaging would complete but that didn't work out. It has been delayed, hence the packages are in experimental. If you have access to FCoE hardware, please test and provide your feedback.
A while ago, we got another machine for hosting Alioth and so we
started thinking about how to use that machine. It's a used machine
and not massively faster than the current hardware, so just moving
everything over wouldn't actually get us that much of a performance
upgrade.
However, Alioth is using FusionForge, which is supposed to be able to
run on a cluster of machines. After all, this was originally built
for SourceForge.net, which certainly does not run on a single host.
So, a split of services is what we'll do.
This weekend, we're having a sprint in Collabora's office in
Cambridge, actually implementing the split and doing a bit of general
planning for the future.
Last afternoon (Friday), European time, we started the migration. The
first step is to move all the data off the Xen guest on wagner, where
Alioth is currently hosted. This finished a few minutes ago; it turns
out syncing about 8.5 million files across almost 400G of data takes a
little while.
The new host is called vasks and will host the database, run the main
apache and be the canonical location for the various SCM
repositories.
We are not decomissioning wagner, but it'll be reinstalled without Xen
or other virtualisation which should help performance a bit. It'll
host everything that has lower performance requirements such as cron
jobs, mailing lists and so on.
I'll try to keep you all updated and feel free to drop by #alioth on
irc.debian.org if you have any questions.
I have just pushed out version 0.17 of Obnam,
my backup application.
My personal Debian repository
has binaries for squeeze in i386, amd64, and armel architectures.
A summary of the changes:
run-benchmark script now works with the new version of seivot.
The only benchmark size is one gibibyte, for now, because Obnam's too
slow to do big ones in reasonable time. As an aside, the benchmark
script got rewritten in Python, so it can be made more flexible.--log-max and --log-keep options
in the manual page. The default location for the log file is now
~/.cache/obnam/obnam.log for people, and
/var/log/obnam.log for root.--repository option now has the shorter alias -r, since it
gets used so often.obnam force-lock now merely gives an error message, instead of a
Python stack trace, if the repository does not exist.
cpio(1) takes the list of files to archive on its standard
input, allowing a very high control but requiring to use another utility
such as find(1) to archive an entire tree;tar(1) usually takes the list of file to archive on its
command line, and browses directories recursively be default.pax(1), that can be used either in cpio-like or tar-like style.
This specification also defined a pax interchange format, which these vile
trolls derived from tar!
Now, considering the actual practice, you can notice that tar has won, and that almost nobody uses pax.
Almost every free software project I know release tarballs, not cpio archives.
This is probably the reason why the GNU tar utility has evolved much more than
GNU cpio: tar now integrates seamlessly with compressors such as gzip, bzip2 or
xz, autodetecting the compression format when needed whereas cpio has no such
features as far as I know. However, cpio is notably used by the Linux kernel
for its initial memory file system, aka initrd.
tar and cpio drawbacks
Now I come to the title of this article: I personally prefer the cpio format
over tar, although I usually use tar because of the advanced features of GNU
tar. In fact, tar suffers from a drawback that usually has to be worked around:
it cannot store any type of file. There exist seven file types: regular files,
directories, symbolic links, character devices, block devices, FIFOs and Unix
sockets. Well, tar can only represent six of them, and misses the ability to
store sockets. Thus, if you try to archive your entire filesystem with tar, you
may get the following output:
tar: /var/spool/postfix/private/rewrite: socket ignored tar: /var/spool/postfix/private/bsmtp: socket ignoredIf you try the same with cpio, you will see that sockets get archived without any problem. Given that the tar format has a type byte, with one reserved value, I am surprised that its 2001 revision did not use it for sockets, but for some reason it did not. In practice, programs that use sockets work around this problem by creating them at startup. To be honest, I must mention that cpio also has one significant drawback: when a file has several links, it gets copied several times in the archive. Edit: It appears that archiving sockets is completely pointless, given that they must be unlinked if they exist, and then created before they are used by a program. Thus, the question becomes: why does cpio support sockets?
I needed a way to generate a list of commands in make automatically. I was using $(foreach i,$(list),cmd $i;), that is, a semicollon to intercalate commands. The problem with this approach is that if the first command fails, make would not detect the error. After searching for a while, I found the solution on this link. It's possible to create a newline in make functions using this technique. The code ended up being:
define \n
endef
target:
$(foreach i,$(list),cmd $i$(\n))
The host name
sethostname() and gethostname()
functions and their command-line wrapper hostname(1). It can be
used by several programs, for instance by the mail server to determine what it
should use as its HELO name.
In fact, the host name has two forms: the short one and the fully qualified
one. For instance, a host can have muscadet as its short name
muscadet and muscadet.example.com as its fully qualified
one. From these two forms, a third information can be deduced: the domain name,
which is the full name without its first component.
The system host name can be set as either the short name or the fully
qualified name. When the full name is used, the short one can be easily
deduced, by keeping only its first component. When the short name is used, the
full name must be determined by using a more complex heuristic that takes more
time and can fail for several reasons.Determining the short and the fully qualified host name
The command hostname(1) is able to give both the short and the
full host name, and also the domain name that can be deduced from them:
/etc/hosts, the DNS
or a more exotic name system depending on your configuration./etc/hostname
and set at boot time by the hostname.sh init script. The local
hosts table /etc/hosts also contains it, in both forms, for a
loopback IPv4 address 127.0.1.1. It is asked at installation time: the most
common practice is to give the short host name; you are then asked for the
domain name. But you have the option to give the fully qualified domain name,
which has the effect to skip the domain name question.
Using a fully qualified system host name
I used to define short system host names, and I switched to fully qualified
ones about a year ago. I saw no drawback, but I did see benefits. Postfix, by
default, uses the system host name to determine its variables
myhostname and mydomain that are used for stuff like
the HELO name and the mail domain name. Well, with a short system host name, it
fails, and you get default myhostname = muscadet.localdomain and
mydomain = localdomain, so you have to set them explicitly in its
configuration file, thus duplicating information. Whereas with a fully
qualified system host name, it just works, and you can rely on the default
values, that will stay in sync if you have to change you host name.
To sum up, it is perfectly possible to use a fully qualified name as the
system host name, even though it does not seem to be a common practice. In
fact, according to my experience, it is even advisable, as it eases the
configuration of programs that rely on the host name, such as mail servers.
Edit: As noticed by Javi, the hostname(1) manpage ends by saying without explaination that /etc/hostname should contain the short host name and not the full one. There may by some drawbacks by doing so but I was not able not identify them.
Particularly around local government, but also some not-for-profits and universities, I m trying to persuade people to stop using huge Blind Carbon Copy (BCC) lists that they keep in their address book and switch over to using mailing list manager software. Our co-op even gives some simple mailing list hosting away with web hosting. I think good mailing list software is better because:
Firstly: If you want to buy a computer to run Linux on, don't buy a Mac.
This year Debconf is a bit off the beaten track, so there is a bit of anxiety in the participants flights to Banja Luka are quite expensive (I d guess we have packed the relevant dates pretty full already) and other options are going via Zagreb or Ljubljana, but there people do not yet have all the info on how they will be able to get from, for example, Zagreb airport to the Debconf venue in Banja Luka, if their plane lands at 22:30 and get back if the departure time is 06:30. There is hope that the organising team will provide the info on how to use the local buses and arrange a Debconf bus for people arriving late and departing early, but that has not been 100% confirmed yet.
In light of all this, I really dug deep into all possible options and found an option that is far more fun and relaxing for me and almost the same price. So I will be travelling to Paris on the morning of July 16th, then staying overnight there (never been in Paris before!), then take a late morning flight to Zagreb where I ll be around noon (plenty of time to get to Banja Luka) and then on the final day of the conference I can got to Zagreb at any time, stay there overnight (never been to Zagreb too!) and around noon next day fly back home via Budapest (just a 2 hour break there). This way I will get to see two more cities, save me a lot of stress and also not bother the organizers too much. Next.