Ritesh Raj Sarraf: Debian Boot time
- Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
- 8 GiB RAM
- nVIDIA Optimus
- Samsung SSD Drive
- BTRFS File System
- SystemD Init
To experiment with network stuff, I was using
UML-based network labs. Many alternatives exist, like
GNS3, Netkit, Marionnet or Cloonix. All of them are
great viable solutions but I still prefer to stick to my minimal
home-made solution with UML virtual machines. Here is why:
make defconfig,
removed everything that was not necessary, added what I needed for my
lab (mostly network stuff) and added the appropriate options for VirtIO drivers:
CONFIG_NET_9P_VIRTIO=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM_VIRTIO=y CONFIG_VIRTIO=y CONFIG_VIRTIO_RING=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_MMIO=y
$LINUX is the appropriate bzImage):
kvm \ -m 256m \ -display none \ -nodefconfig -no-user-config -nodefaults \ \ -chardev stdio,id=charserial0,signal=off \ -device isa-serial,chardev=charserial0,id=serial0 \ \ -chardev socket,id=con0,path=$TMP/vm-$name-console.pipe,server,nowait \ -mon chardev=con0,mode=readline,default \ \ -kernel $LINUX \ -append "init=/bin/sh console=ttyS0"
-display none). A serial port is defined and
uses stdio as a backend1. The kernel is configured to use
this serial port as a console (console=ttyS0). A VirtIO console
could have been used instead but it seems this is not possible to make
it work early in the boot process.
The KVM monitor is setup to listen on an Unix socket. It is possible
to connect to it with socat UNIX:$TMP/vm-$name-console.pipe -.
/dev/root as the mount tag to solve this problem. I keep using an
initrd in this post but the lab on Github has been updated
to not use one.
Here is how to build a small initial ramdisk:
# Setup initrd setup_initrd() info "Build initrd" DESTDIR=$TMP/initrd mkdir -p $DESTDIR # Setup busybox copy_exec $($WHICH busybox) /bin/busybox for applet in $($ DESTDIR /bin/busybox --list); do ln -s busybox $ DESTDIR /bin/$ applet done # Setup init cp $PROGNAME $ DESTDIR /init cd "$ DESTDIR " && find . \ cpio --quiet -R 0:0 -o -H newc \ gzip > $TMP/initrd.gz
copy_exec function is stolen from the initramfs-tools package
in Debian. It will ensure that the appropriate libraries are also
copied. Another solution would have been to use a static busybox.
The setup script is copied as /init in the initial ramdisk. It will
detect it has been invoked as such. If it was omitted, a shell would
be spawned instead. Remove the cp call if you want to experiment manually.
The flag -initrd allows KVM to use this initial ramdisk.
kvm \ $ PREVIOUS_ARGS \ -fsdev local,security_model=passthrough,id=fsdev-root,path=$ ROOT ,readonly \ -device virtio-9p-pci,id=fs-root,fsdev=fsdev-root,mount_tag=rootshare
$ ROOT can either be / or any directory containing a complete
filesystem. Mounting it from the guest is quite easy:
mkdir -p /target/ro mount -t 9p rootshare /target/ro -o trans=virtio,version=9p2000.u
/target/ro. I have
used version=9p2000.u instead of version=9p2000.L because the
later does not allow a program to mount() a host mount
point2.
Now, you have a read-only root filesystem (because you don t want to
mess with your existing root filesystem and moreover, you did not run
this lab as root, did you?). Let s use an union filesystem. Debian
comes with AUFS while Ubuntu and OpenWRT have migrated to
overlayfs. I was previously using AUFS but got errors on some
specific cases. It is still not clear
which one will end up in the kernel. So, let s try
overlayfs.
I didn t find any patchset ready to be applied on top of my kernel
tree. I was working with David Miller s net-next tree. Here
is how I have applied the overlayfs patch on top of it:
$ git remote add torvalds git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git $ git fetch torvalds $ git remote add overlayfs git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git $ git fetch overlayfs $ git merge-base overlayfs.v15 v3.6 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d $ git checkout -b net-next+overlayfs $ git cherry-pick 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d..overlayfs.v15
CONFIG_OVERLAYFS_FS in .config. Here is how
I configured the whole root filesystem:
info "Setup overlayfs" mkdir /target mkdir /target/ro mkdir /target/rw mkdir /target/overlay # Version 9p2000.u allows to access /dev, /sys and mount new # partitions over them. This is not the case for 9p2000.L. mount -t 9p rootshare /target/ro -o trans=virtio,version=9p2000.u mount -t tmpfs tmpfs /target/rw -o rw mount -t overlayfs overlayfs /target/overlay -o lowerdir=/target/ro,upperdir=/target/rw mount -n -t proc proc /target/overlay/proc mount -n -t sysfs sys /target/overlay/sys info "Mount home directory on /root" mount -t 9p homeshare /target/overlay/root -o trans=virtio,version=9p2000.L,access=0,rw info "Mount lab directory on /lab" mkdir /target/overlay/lab mount -t 9p labshare /target/overlay/lab -o trans=virtio,version=9p2000.L,access=0,rw info "Chroot" export STATE=1 cp "$PROGNAME" /target/overlay exec chroot /target/overlay "$PROGNAME"
$ HOME and the lab directory from host:
kvm \ $ PREVIOUS_ARGS \ -fsdev local,security_model=passthrough,id=fsdev-root,path=$ ROOT ,readonly \ -device virtio-9p-pci,id=fs-root,fsdev=fsdev-root,mount_tag=rootshare \ -fsdev local,security_model=none,id=fsdev-home,path=$ HOME \ -device virtio-9p-pci,id=fs-home,fsdev=fsdev-home,mount_tag=homeshare \ -fsdev local,security_model=none,id=fsdev-lab,path=$(dirname "$PROGNAME") \ -device virtio-9p-pci,id=fs-lab,fsdev=fsdev-lab,mount_tag=labshare
# Setup a VDE switch setup_switch() info "Setup switch $1" screen -t "sw-$1" \ start-stop-daemon --make-pidfile --pidfile "$TMP/switch-$1.pid" \ --start --startas $($WHICH vde_switch) -- \ --sock "$TMP/switch-$1.sock" screen -X select 0
mac=$(echo $name-$net sha1sum \ awk ' print "52:54:" substr($1,0,2) ":" substr($1, 2, 2) ":" substr($1, 4, 2) ":" substr($1, 6, 2) ') kvm \ $ PREVIOUS_ARGS \ -net nic,model=virtio,macaddr=$mac,vlan=$net \ -net vde,sock=$TMP/switch-$net.sock,vlan=$net
-net user flag or using slirpvde on a special switch. I
prefer the latest solution since it will allow the VM to speak to each others.
kvm \ $ PREVIOUS_ARGS \ -gdb unix:$TMP/vm-$name-gdb.pipe,server,nowait
vmlinux file at the root of the source tree and run GDB on it. The
kernel has to be compiled with CONFIG_DEBUG_INFO=y to get the
appropriate debugging symbols. Then, use socat with the Unix socket
to attach to the remote debugger:
$ gdb vmlinux GNU gdb (GDB) 7.4.1-debian Reading symbols from /home/bernat/src/linux/vmlinux...done. (gdb) target remote socat UNIX:$TMP/vm-$name-gdb.pipe - Remote debugging using socat UNIX:/tmp/tmp.W36qWnrCEj/vm-r1-gdb.pipe - native_safe_halt () at /home/bernat/src/linux/arch/x86/include/asm/irqflags.h:50 50 (gdb)
net/ipv6/route.c, just add
CFLAGS_route.o = -O0 to net/ipv6/Makefile, remove
net/ipv6/route.o and type make.
gdb as usual. Your
$HOME directory is available and it should be therefore
straightforward. However, if you want to perform some remote
debugging, that s quite easy. Add a new serial port to KVM:
kvm \ $ PREVIOUS_ARGS \ -chardev socket,id=charserial1,path=$TMP/vm-$name-serial.pipe,server,nowait \ -device isa-serial,chardev=charserial1,id=serial1
gdbserver in the guest:
$ libtool execute gdbserver /dev/ttyS1 zebra/zebra Process /root/code/orange/quagga/build/zebra/.libs/lt-zebra created; pid = 800 Remote debugging using /dev/ttyS1
$ libtool execute gdb zebra/zebra GNU gdb (GDB) 7.4.1-debian Reading symbols from /home/bernat/code/orange/quagga/build/zebra/.libs/lt-zebra...done. (gdb) target remote socat UNIX:/tmp/tmp.W36qWnrCEj/vm-r1-serial.pipe Remote debugging using socat UNIX:/tmp/tmp.W36qWnrCEj/vm-r1-serial.pipe Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 0x00007ffff7dddaf0 in ?? () from /lib64/ld-linux-x86-64.so.2 (gdb)
I am moving into an office. And as any proud husband and father,
I want to have photos of my wife and daughter on my desk. The year
being 2012, I did not hike to the photo shop to get a print framed,
but instead thought to myself that I should put a digital photo
frame onto my table.
This idea exposed me to the ridiculous world of consumer
electronics. It led me to conclude that digital picture frame
designers need to be whacked with cluebats.
Step by step
Once accepted, the thought of a digital photo frame developed
into a product definition along the following lines: my idea photo
frame would connect to my Wifi-network, and obtain the photos
on-the-go from a folder exposed via HTTP or CIFS, and then go on to
display them in random order, incorporating new photos as it
encounters them.
With this in mind, I went to the shops, and since I believe in
specialised retailers and want to support them, my first stop was
Foto Sauter at Sendlinger
Tor. Unfortunately, none of the frames they had came with Wifi, so
I decided to look further. I vehemently oppose to the business
practices of the Metro group, thus
skipped Saturn and MediaMarkt, and eventually ended up at Conrad.
They had a frame with Wifi! I jumped for joy, until I read the
manual: pictures can be obtained from Flickr and Picasa.
Period.
All other models on the Internet seem to be similarly limited,
including the new Sony S-frame.
The night before, Penny had
researched the field a bit and came to the conclusion that the
S-frame would be the best product available. This led me to scratch
Wifi off my requirements list and get a model that would read
photos off a USB stick.
I went back to the photo store and bought a "Sony S-frame", only
to discover that it cannot show photos in random order. It
has three viewing modes (single photo, collage, single photo with
clock), and a random mode, but guess what: the random
mode randomly switches the viewing modes, which then display the
photos in lexicographical order.
How stupid is that???
I returned the product and left the store after discovering that
none of their products could do random playback.
I went back to Conrad and found an "Intenso MediaCreator" (what
media does it create???), which displayed the photos seemingly
randomly.
But at home I found out that the "random" order is always the
same, probably because the bright engineer that programmed this
thought it was better to sort filenames by last letter and call it
random, than to figure out a way to roll a dice on the device.
I wrote to the support team and asked them. The response was
that the desired functionality (random selection) is not possible
and won't be made available.
So I am returning the product.
Gah!
Would someone please tell me about a digital
picture frame (8 inch or so) that can display images in random
order, ideally loading them off a CIFS share via Wifi?
Or is it really the case that consumer electronics are
completely useless these days, by which I mean that "consumers"
have dumbed down so far to buy this crap?
Update: a lot of people wrote in suggesting to
invest in a cheap Android tablet. Some suggested Raspberry Pis in USB host mode
(emulating the USB stick and hence the source of the images,
provided that the frame doesn't cache). Other suggestions included
the
Samsung SPF-85V which can display images according to an RSS
feed but needs Microsoft for that (or
maybe not), and the community-developed, Linux-based
Joggler.
Regarding the non-random order on the Intenso frame, Paul
Hedderly postulated that the order comes from the filesystems (FAT
order) and can be changed by writing the files differently.
/tmp on the target and then executes that like
so:
$SHELL -c /tmp/ansible/ansible-1350291485.22-74945524909437/command
Correct me if I am wrong, but there is zero need for
this shell indirection. My attempts at finding an answer on IRC
were met by user "daniel_hozac" with a reason along the lines of
"it's needed, believe me", and on the mailing list, I am told that
only the shell can execute a script by parsing the interpreter line
at the top of the module.
Finally, the raw execution
module also executes using the shell
And there a few other design decisions that I can't quite
explain, around the command-line switch --sudo see
the aforementioned message
In short: running a command like
ansible -v arnold.madduck.net -a "/usr/bin/apt-get update" --sudo
does not invoke apt-get with sudo, as
one might like; it invokes the shell that runs the Python script
that runs the command. Effectively therefore, you need to allow
sudo shell execution, and for proper automation, this
has to be possible without a password. And then you might just as
well allow root logins again.
The author seems to think that "core behaviour" is that sudo
allows all execution and that limiting the commands to run is not a
use-case that Ansible will support. Apparently, I was the first to
ever suggest this.
There are always ways around (e.g. skip --sudo and
just use sudo as the command, simply ignore the
useless shell invocation and trust that your machine can handle it,
but when such design decisions remain incomprehensible and get
defended by the project people, then I am hesitant to invest more
time on principle.
As you may know, when Phil Zimmermann published PGP, his goal was to counter
the wide spying possibilities the development of electronic communications
offered to the authorities, by promoting the general use of encryption so that
1. governments would not be able to restrict it afterwards and 2. it becomes
possible to encrypt messages for privacy without drawing suspicion.
Now, cryptography has made its way and is widely use, but mostly for
commercial website and only sparsely for mail. Indeed, contrary to signing,
encrypting a message requires that the recipient has a crypto key and is able
and willing to use it to decrypt your message.
To alleviate this problem, I thought that it would be useful to have a way,
when sending a message, to tell your recipients that you would like that they
encrypt their answers, because you are able and willing to get encrypted mail.
I think the most relevant way to do that would be by adding a dedicated header
field:
Encryption-Desired: PGPIn that header, one would be able to indicate what protocols he accepts. I suggest a comma-separated list, with the following possible values: PGP (or PGP/MIME and PGP/traditional for people that only accept one of these two PGP formats), S/MIME. For instance:
Encryption-Desired: PGP/MIME, S/MIMEIt may be useful to be able to indicate that you either always wish your messages to be encrypted, or that it is only for this message's replies. If this is really relevant, it would take two distinct headers:
Encryption-Desired and Reply-Encryption-Desired.
Any thought about that proposal? Next thing to do, determine how to have that
standardized at IANA and how to promote it.
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <email>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2012-10-12 11:14+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <email>\n"
"Language-Team: LANGUAGE <ll>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Title #
#, no-wrap
msgid "Retro-style live webcam of our couch"
msgstr ""
#. type: Plain text
#, no-wrap
msgid "\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid "\n"
msgstr ""
#. type: Title ##
#, no-wrap
msgid "Here's my office - Live!"
msgstr ""
#. type: Plain text
msgid "I generally work from home, sitting in our big red couch."
msgstr ""
#. type: Plain text
msgid "Last fall, when I told this to"
msgstr ""
#. type: Title ##
#, no-wrap
msgid "Technical setup"
msgstr ""
#. type: Plain text
#:
#, no-wrap
msgid "[[!graph src="""\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"rankdir=LR\n"
"webcam -> motion -> stream;\n"
msgstr ""
#. type: Plain text
msgid ""
"Most of my work is in trying to avoid ways things might go wrong which so "
"often happens when computers are involved."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"What if \n"
" * messages are delayed or lost?\n"
" * a chain of messages arrive out of order?\n"
" * messages are sent faster than they can be delivered?\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Copenhagen Carpool]: http://www.kobenhavnsdelebiler.dk/\n"
" "K benhavns Delebiler"\n"
msgstr ""
#. type: Title ##
#, no-wrap
msgid "Reliable conversation"
msgstr ""
#. type: Plain text
msgid ""
"Human conversation is most reliable when using plain speak. Slang, sarcasm "
"or jokes raise the risk of misunderstandings. This is quite similar in "
"computer conversation."
msgstr ""
#. type: Plain text
msgid ""
"When surfing the Web, you normally "GET" a web page or "POST" new data "
"like a search query. The words "GET" and "POST" are "plain speak" of "
"the World Wide Web defined as a principle called "[REST][]" or "
""RESTful design"."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"rankdir=LR\n"
""fetch document" -> website [label="GET", dir="back"];\n"
""provide info" -> website [label="POST"];\n"
msgstr ""
#. type: Plain text
msgid ""
"I use the [Kannel][] tool to talk directly to the phones. When an sms "
"arrives on the phone, Kannel "GET"s it to the calendar. That's weakly "
"expressed better if it had "POST"ed the message instead."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"rankdir=LR\n"
""provide sms info" -> "calendar" [label="GET" style="dotted"];\n"
msgstr ""
#. type: Plain text
msgid ""
"Kannel is a quite reliable tool, but not RESTful in conversations. That "
"requires extra attention at other parts of the setup to avoid breakage in "
"special situations."
msgstr ""
#. type: Plain text
msgid "That worries me."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Kannel]: http://www.kannel.org/\n"
" "Kannel: Open Source WAP and SMS Gateway"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[REST]: http://en.wikipedia.org/wiki/REST\n"
" "Representational State Transfer"\n"
msgstr ""
#. type: Title ##
#, no-wrap
msgid "Each car has a blog"
msgstr ""
#. type: Plain text
msgid ""
"So I setup a gateway from Kannel to RESTful conversation. And choose "
"classic blogging as style of conversation:"
msgstr ""
#. type: Bullet: ' * '
msgid "The carpool fleet is a blogroll"
msgstr ""
#. type: Bullet: ' * '
msgid "each car has a blog"
msgstr ""
#. type: Bullet: ' * '
msgid "each sms emitted from a car is a blog entry"
msgstr ""
#. type: Plain text
msgid ""
"Blogging comes in two flavors, [RSS][] and [Atom][]. Both cover "
"distribution of messages. I use Atom because it is newest and coolest, and "
"because it also covers creating and editing meesages with the [AtomPub][] "
"extension."
msgstr ""
#. type: Plain text
msgid ""
"AtomPub allows the calendar to create an empty message which then "
"triggers an sms from the car which "fills it in.""
msgstr ""
#. type: Plain text
msgid ""
"AtomPub also let the calendar "PUT" tags onto existing messages, to mark "
"them as processed, read etc., and let an admin or a cleanup script "
""DELETE" outdated entries or blogs. The words "PUT" and "DELETE" are "
"RESTful conversation as well."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Atom]: http://en.wikipedia.org/wiki/Atom\n"
" "Atom"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[RSS]: http://en.wikipedia.org/wiki/RSS\n"
" "RSS"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[AtomPub]: http://en.wikipedia.org/wiki/AtomPub\n"
" "AtomPub"\n"
msgstr ""
#. type: Title ##
#, no-wrap
msgid "The system is dancing!"
msgstr ""
#. type: Plain text
msgid "My sms-to-blog gateway is written in [Perl][], using the [Dancer][] toolkit."
msgstr ""
#. type: Plain text
msgid ""
"Dancer makes it simple to setup a RESTful web conversation, and when I "
"contacted the authors on [IRC][], they swiftly added support for the "
"non-RESTful quirk that I needed."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"rankdir=LR\n"
"phone -> "sms gateway" [dir="both"];\n"
""sms gateway" -> "blog gateway" [dir="both", style="dotted"];\n"
""blog gateway" -> calendar [dir="both"];\n"
msgstr ""
#. type: Plain text
msgid ""
"My sms-to-blog gateway is not yet ready, but basic routines work. The "
"[project is public][], and code is [Free Software][]."
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Perl]: http://en.wikipedia.org/wiki/Perl\n"
" "Perl"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Dancer]: http://www.perldancer.org/\n"
" "Dancer: Perl web development framework"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[IRC]: http://www.perldancer.org/irc\n"
" "IRC Chat system (Internet Relay Chat)"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[project is public]: git://source.delebilfonden.dk/msg/\n"
" "Kannel-to-AtomPub Gateway"\n"
msgstr ""
#. type: Plain text
#, no-wrap
msgid ""
"[Free Software]: http://www.debian.org/social_contract#guidelines\n"
" "The Debian Free Software Guidelines (DFSG)"\n"
msgstr ""
Yesterday I went to FES Iztacala, the faculty where I worked between 1999 and 2003. It's nice to go visit some good friends (even if to talk for work issues). It is somewhat far from my usual roaming area (~25Km straight to the North), so I cannot do it as often as I'd like. But anyway - I had to be at work early in the morning, but leaving from here a bit early for lunchtime, and leaving home at ~14:30, I managed to arrive to Iztacala in ~75 minutes. Sustained cycling for 20 Km/h, even counting stops at traffic lights on the way, yay!
Anyway, had a productive and fun evening there, but around 18:00 I decided to head back before night got me Specially for the first part of the way, as I'm not familiar with Atzcapozalco. Alejandro suggested me to go by the recently (some months ago) opened cycle path that covers 4Km and almost exactly crosses the delegation (each of the 16 constitutive parts of Distrito Federal, where an important part of Mexico City is located).
The cycle path is a good initiative... But I must say, I'm very very glad I took it still with good daylight. As well as the Recreative cyclepath that goes to the South, until the border of Morelos state, this one was built over abandoned rail tracks. Good use for a vacant and useless public space Rail tracks which lay unclaimed in the city are uncomfortable to walk, and useless for anything else, so they basically mean a useless 2m-wide strip of common grounds. So, I welcome any initiatives that make it into a useful space again! And two meters are just enough for a comfortable cycling path - Yes, which will surely be shared with pedestrians, and sometimes becomes uncomfortable. But lets try it!
However... When rail tracks are decomissioned and cycle paths built over them... the metal should be dismounted! Not only because of economic concerns (good metal used for rail tracks is much more expensive and useful than asphalt), but because if it stays there, it just becomes a danger. Specially, as is the case, if the asphalt is just deep enough to sometimes cover the tracks And sometimes not.
Had I known, I would have taken several photographs of important mistakes in the rail layout. I know I was very close to having an accident at least once (this means, I lost balance and miraclously managed to slow down from ~15Km/h by running with the bike between my legs!), and got in uncomfortable situations several more times. For a good portion of the track, there is a train track running at about of its width, so I had to constantly ring the bell or shout whenever I saw pedestrians As changing from side to side to route around them would put both them and me in danger. Towards the Southern part of the cycle path, as it is a much more active industrial area, there are many places where multiple tracks cross each other under the thin asphalt, sometimes completely unpaved. In one of those points I even decided to step down of the bike and make ~20m walking.
This cycle path seems like it was done in a great hurry to present a successful project to the Politicians in Charge, without much thought on what it requires to be really a good project. It provides, yes, a very useful and good mobility solution for cyclists in the North-West. But it is too dangerous... And I am not sure whether I'd take it again. Probably not.
So, all in all...
For writing tests for GVFS (current tests, proposed improvements) I want to run Samba as normal user, so that we can test gvfs smb backend without root privileges and thus can run them safely and conveniently in a make check environment for developers and in JHBuild for continuous integration testing. Before these tests could only run under gvfs-testbed, which needs root.
Unlike other servers such as ssh or ftp, this turned out surprisingly non-obvious and hard, so I want to document it in this blog post for posterity s benefit.
Running the server
Running smbd itself is mainly an exercise of figuring out all the options that you need to set; Alex Larsson and I had some fun figuring out all the quirks and hiccups that happen between Ubuntu s and Fedora s packaging and 3.6 vs. 4.0, but finally arrived at something working.
First, you need to create an empty directory where smbd can put all its databases and state files in. For tests you would use mkdtemp(), but for easier reading I just assume mkdir /tmp/samba here.
The main knowledge is in the Samba configuration file, let s call it /tmp/smb.conf:
[global] workgroup = TESTGROUP interfaces = lo 127.0.0.0/8 smb ports = 1445 log level = 2 map to guest = Bad User passdb backend = smbpasswd smb passwd file = /tmp/smbpasswd lock directory = /tmp/samba state directory = /tmp/samba cache directory = /tmp/samba pid directory = /tmp/samba private dir = /tmp/samba ncalrpc dir = /tmp/samba [public] path = /tmp/public guest ok = yes [private] path = /tmp/private read only = noFor running this as a normal user you need to set a port > 1024, so this uses 1445 to resemble the original (privileged) port 445. The
map to guest line makes anonymous logins work on Fedora/Samba 4.0 (I m not sure whether it s a distribution or a version issue). Don t ask about dir vs. directory , that s an inconsistency in Samba; with above names it works on both 3.6 and 4.0.
We use the old smbpasswd backend as shipping large tdb files is usually too inconvenient and brittle for test suites. I created an smbpasswd file by running smbpasswd on a real Samba installation, and then using pdbedit to convert it to a smbpasswd file:
sudo smbpasswd -a martin sudo pdbedit -i tdbsam:/var/lib/samba/passdb.tdb -e smbpasswd:/tmp/smbpasswdThe result for password foo is
myuser:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:AC8E657F83DF82BEEA5D43BDAF7800CC:[U ]:LCT-507C14C7:which you are welcome to copy&paste (you can replace myuser with any valid user name, of course). This also defines two shares, one public, one authenticated. You need to create the directories and populate them a bit:
mkdir /tmp/public /tmp/private echo hello > /tmp/public/hello.txt echo secret > /tmp/private/myfile.txtNow you can run the server with
smbd -iFS -s /tmp/smb.confThe main problem with this approach is that smbd exits ( Server exit (failed to receive smb request) ) after a client terminates, so you need to write your tests in a way to only run one connection/request per test, or to start smbd in a loop. Running the client If you merely use the
smbclient command line tool, this is rather simple: It has a -p option for specifying the port:
$ smbclient -p 1445 //localhost/private Enter martin's password: [enter "foo" here] Domain=[TESTGROUP] OS=[Unix] Server=[Samba 3.6.6] smb: \> dir . D 0 Wed Oct 17 08:28:23 2012 .. D 0 Wed Oct 17 08:31:24 2012 myfile.txt 7 Wed Oct 17 08:28:23 2012In the case of gvfs it wasn t so simple, however. Surprisingly, libsmbclient does not have an API to set the port, it always assumes 445. smbclient itself uses some internal libcli API which does have a way to change the port, but it s not exposed through libsmbclient. However, Alex and I found some mailing list posts ([1], [2]) that mention
$LIBSMB_PROG, and it s also mentioned in smbclient s manpage. It doesn t quite work as advertised in the second ML post (you can t set it to smbd, smbd apparently doesn t speak the socket protocol over stdin/stdout), and it s not being used anywhere in the current Samba sources, but what does work is to use good old netcat:
export LIBSMB_PROG="nc localhost 1445"with that, you can use smbclient or any program using libsmbclient to talk to our test smb server running as user.
A few days ago I wrote an article about the lawsuit the producers of ColonHelp are trying against Wordpress in the attempt to silence a blogger who wrote some unfavourable and science-based articles on his blog.
In case you tried to use git-buildpackage and wanted to use cowbuilder as a builder, you might have ran into the errorsudo: sorry, you are not allowed to preserve the environment
Defaults env_keep += HOME
Cmnd_Alias PBUILDERS = /usr/sbin/pbuilder, /usr/sbin/cowbuilder
%pack ALL=PBUILDERS
Defaults! PBUILDERS setenv
* In case you re not watching my twitter (and other social medias), I ve moved to none other than Bangalore. I m working with credativ. So, hello all DDs there!
* On running front, I m back to track from today. Planning to run Bangalore Ultra 50K next month and then Mumbai Marathon (SCMM) in January 2013. BLR Ultra registration should be done in next 1-2 days.
* It is challenging to stay along after four and half years of staying with family (and out of it 3 years of working from home!). I hope to move them here as soon as some things are fixed and start enjoying real life.
I have a Macbook3,1 with the following SATA controller:
00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03)
This chip can work either in AHCI or IDE mode. Even though (in numbers) AHCI and IDE should have similar performance, I have found that AHCI mode is much better. Specially when the disk is under heavy siege by more than one application.
The catch is that Macbooks turn off AHCI when booting in BIOS mode, which is the mode I use for GNU/Linux. I understand this also affects Windows.
Pictured: a girl after enabling AHCI on her Linux Macbook
After some googling I found this post that explains how to activate AHCI mode using GRUB2.
The fix is to just add a setpci call on your GRUB configuration. To be safe you can test it by going into command line mode in GRUB, and doing something like this:
> lspci
You can add this to your GRUB configuration, and avoid losing it on upgrades, by adding a script like this to /etc/grub.d/:
(check for the ID for IDE mode, in my case 8086:2828)
> setpci -d 8086:2828 90.b=40
> lspci
(The 2828 ID is now gone, replaced by 8086:2829, AHCI/SATA mode)
I understand this is also relevant for newer Macbooks and standard PC hardware, so you might want to do some googling. The easy way to know if you are on the right mode is to run
#!/bin/sh
set -e
## Enable SATA (AHCI) mode on macbook 3,1
echo "setpci -d 8086:2828 90.b=40"
lspci -nn on a regular terminal (not GRUB) and see if you have a SATA controller that is in the wrong mode.
My last post
explained how I retrieved and corrected data from snapshot.debian.org so that
dose3 was able to parse it. In this post I will cover some surprising results I
found when using my tools on those Packages and Sources files from 2005 until
today.
For each pair of Packages and Sources files I did the following:
Build-Depends: huge (>= 1.0) [i386 arm] <!embedded !bootstrap>, tiny
The work Patrick McDermott did for his GSoC project over the summer already
uses above syntax.
There may be a situation where you want to create a Debian source package without having to unpack the upstream source. One case is where you store your debian/ directory in a version control system of its own and to build your package, you pass the .dsc file to a tool like pbuilder or some remote builder. Now a modern debian source package is just a text file (the .dsc file) that references two tarballs, one being the upstream source and the other being the Debian directory. Thanks to Niels Thykier on #debian, I found the magic invocation of dpkg-source that allows you to create the .dsc directly from the two tarballs, the control file and the changelog:
> apt-get source --download-only -t experimental haskell-mtl Reading package lists... Done Building dependency tree Reading state information... Done NOTICE: 'haskell-mtl' packaging is maintained in the 'Darcs' version control system at: http://darcs.debian.org/darcs/pkg-haskell/haskell-mtl Need to get 18.8 kB of source archives. Get:1 http://http.debian.net/debian/ experimental/main haskell-mtl 2.1.2-1 (dsc) [1616 B] Get:2 http://http.debian.net/debian/ experimental/main haskell-mtl 2.1.2-1 (tar) [13.7 kB] Get:3 http://http.debian.net/debian/ experimental/main haskell-mtl 2.1.2-1 (diff) [3509 B] Fetched 18.8 kB in 0s (22.3 kB/s) Download complete and in download only mode > cp ./haskell-mtl_2.1.2-1.dsc ./haskell-mtl_2.1.2-1.dsc-orig > tar xzf haskell-mtl_2.1.2-1.debian.tar.gz > dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" -b / haskell-mtl_2.1.2.orig.tar.gz haskell-mtl_2.1.2-1.debian.tar.gz dpkg-source: info: using source format 3.0 (custom)' dpkg-source: info: building haskell-mtl in haskell-mtl_2.1.2-1.dsc > diff -u haskell-mtl_2.1.2-1.dsc haskell-mtl_2.1.2-1.dsc-orig --- haskell-mtl_2.1.2-1.dsc 2012-10-13 15:09:00.031695856 +0200 +++ haskell-mtl_2.1.2-1.dsc-orig 2012-10-13 15:08:47.267696329 +0200 @@ -1,3 +1,6 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + Format: 3.0 (quilt) Source: haskell-mtl Binary: libghc-mtl-dev, libghc-mtl-prof, libghc-mtl-doc @@ -23,3 +26,11 @@ Files: 943c110524d96126bfa0e61f7df1ebcd 13723 haskell-mtl_2.1.2.orig.tar.gz dda5ded58a8d009ecddeed68058ca787 3509 haskell-mtl_2.1.2-1.debian.tar.gz + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iEYEARECAAYFAlBzRQIACgkQ9ijrk0dDIGwymwCfW87jwCv5ZvAXPBwh0LbvYLP9 +n+wAn3TCJwPRuBDEWRYmcv3Opn1Kb9+F +=/Llc +-----END PGP SIGNATURE-----As you can see, the resulting .dsc file is identical to the original one, so this approach works. The parameter to -b does not matter as long as it is some existing directory. Of course you can easily shoot yourself and others in the foot, almost as easily as hand-editing the .dsc file... but if you know what you are doing, then this can be quite handy. Next to do: Write a tool that takes an unpacked Debian directory as an argument, packs it, finds the original tarball using uscan and creates the .dsc file. Would this be something that people would want in the devscripts package?
Interactively installing Debian virtual machines with virt-install without having to
download anything in advance can already be done by pointing it to a Debian
mirror via --location. But you can also add files to the initrd after downloading
using --initrd-inject. Upstreams
intended use is for kickstart files but we can also feed it a preseed.cfg to
automate the whole installation:
virt-install --connect=qemu:///system \
--location=http://ftp.us.debian.org/debian/dists/stable/main/installer\-i386 \
--initrd-inject=/path/to/preseed.cfg \
--extra-args="auto" \
--name d-i --ram=512 \
--disk=pool=default,size=5,format=qcow2,bus=virtio
preseed.cfg is a regular preseed file (as described in the Debian
Wiki) in your local filesystem. I'm using this one for Squeeze and Wheezy VMs. It must be named
preseed.cfg in order for d-i to pick it up from the initrd. This also works for
URLs like qemu+ssh://<remotehost>/system/ since virt-install uses libvirt's
streaming API to upload the kernel and modified initrd to the remote host.
In case you're running this on an i386 you'll need this fix which already
sits in experimental.
This blog is flattr enabled.
If you have two or more available gpg keys that can be used for the same identity (e.g.: 'John Doe <john@doe.com>') that you might use to add entries to changelogs of packages, you might end up in situations where git-buildpackage or other similar tool might want to sign packages with the wrong key.echo 'DEBSIGN_KEYID=0x0123ABCD' >> ~/.devscripts
[DEFAULT]
builder = debuild -i -I -k1234ABCD
...
this week I focussed mostly on bugs where conffiles are modified in
maintainer scripts. thanks to the recipe in debconf-devel(7) many
cases are not so hard to solve.
Next.