Cyril Brulebois: Debugging using netconsole
Now that we have KMS, it happens things go bad enough that when X goes
down, one can no longer access any console to see what
happened. Mainly, one can distinguish between two cases.
Here s an example: Patient s IP is
Because one might not have a second machine handy, it s also possible
to go through a router and send stuff across the internet.
Here s an example: Patient s IP is
- The good one: the machine is still accessible over the
network. Unfortunately, that requires having a spare machine to ssh
into the first machine, but that means one can run
dmesg, look into X logs, possibly run X insidegdband see where it breaks (becauseglibcsbacktraceisn t exactly an excellent tool to get the idea of what s going on and that s the tool used in X to print a backtrace in the log through a signal handler). - The bad one: the machine is no longer accessible over the network. Likely, the kernel is in such a bad shape that one is never going to know what happened. Usually, writing logs to disc didn t happen, so logs won t magically show up at next reboot.
netconsole. As far as limitations are
concerned, one shall note that it s UDP only, and over Ethernet (in
other words: no wireless). The good news is that it can usually make
the last crucial lines available.
Let s call the crashy machine a patient and the logging machine a
doctor.
One should keep in mind that if something goes wrong while configuring
the netconsole module, it can be unloaded at anytime through:
sudo modprobe -r netconsole
Easy case: on a local network
Here s an example: Patient s IP is 192.168.0.1, doctor's IP is
192.168.0.2.
Doctor setup
What one needs on the receiving side: only netcat. A tiny warning,
there are several implementations. Here s the appropriate syntax:
# netcat-traditional:
nc -l -u -p 6666 tee ~/netconsole.log
# netcat-openbsd:
nc -l -u 6666 tee ~/netconsole.log
The nc command is handled through the alternatives system, one can
use update-alternative --config nc to pick the appropriate one if
several netcat-* packages are installed. To list the current one, an
easy way is readlink -f $(which nc).
Using tee means that incoming messages are going to be printed, both
to the standard output and to the specified file.
Running as non-privileged user is sufficient.
Patient setup
Now, to have the patient send stuff to the doctor, a simple modprobe
is needed:
sudo modprobe netconsole netconsole=@/,6666@192.168.0.2/
What happens here? One requests the netconsole module to be loaded,
and one specifies the parameters. Details can be read in the Linux
kernel documentation (Documentation/networking/netconsole.txt), but
concentrating on the points of interest here:
- 192.168.0.2: The doctor s IP.
- 6666: The UDP port to which packets are sent. 6666 is the default and can be omitted.
[2920549.188090] console [netcon0] enabled
[2920549.188102] netconsole: network logging started
Slightly harder case: over internet
Because one might not have a second machine handy, it s also possible
to go through a router and send stuff across the internet.
Here s an example: Patient s IP is 192.168.0.1, connecting to
internet through a router, which IP is 192.168.0.254. The doctor,
available over the internet, is 192.0.32.10.
Doctor setup
Exactly the same as in the previous case. The main issue one can run
into is firewalls at this point. That s why one may want to switch
from the default 6666 port to another one which wouldn t be
filtered. One can think of 53 (DNS), but that means running nc as
root since it s a privileged port (below 1024).
Patient setup
Routing is also possible, but that requires an extra parameter: the
MAC address of the router. To obtain it, one can use the arp
command:
/usr/sbin/arp 192.168.0.254
Supposing it returned the 01:02:03:04:05:06 address, loading the
module becomes:
sudo modprobe netconsole netconsole=@/,6666@192.0.32.10/01:02:03:04:05:06
Now, if you re running into firewall-related issues, you can change
the source for the UDP packets. The default is 6665, but assuming you
want to send from an unfiltered 1234 port, that becomes:
sudo modprobe netconsole netconsole=1234@/,6666@192.0.32.10/01:02:03:04:05:06
On the drive back home from BelHac I thought about the configuration problem in Haskell: The issue is finding a convenient way to work with values that are initialized once and used in many places all over the code.
Assume you have a large module of pure code that, using many custom functions and combinators, parses some data structure. Later you noticed that somewhere far down in the parser, you need to react differently depending on some user preferences say, his preferred language. The usual solution is to add a new parameter to that function and, in consequence, to each and every function that calls or might call directly or indirectly this function. This is often very inconvenient.
Other solutions include:
I've always loathed cheap particle board and peg bookcases, and when I
broke one while reorgaising the living room at the Hollow today, I finally
found a good use for them. They're great fun to chop up with an axe, and
make for a very hot fire in the stove later.
I released
I blogged back in August about my
At
Security is more than bug fixing. Security fixing/updating, the thing most people are exposed to, is reactive security . However, a large area of security work is proactive where defensive abilities are put in place to try and catch problems before they happen, or make classes of vulnerabilities unexploitable. This kind of security is what a lot of people don t understand, and I think it s important to point out so the distinction can be clearly seen.
In the Linux kernel, there s yet another distinction: userspace proactive security and kernel proactive security. Most of the effort in kernel code has been protecting userspace from itself (things like Address Space Layout Randomization), but less attention has been given to protecting the kernel from userspace (currently if a serious enough flaw is found in the kernel, it is usually very
Sometimes I really want to know how Eclipse implements one feature or another, because Eclipse sometimes feels like magic. Usually it turns out they are also just cooking with water.
Most open source code is easily available by checking out a project from some SCM. For eclipse it is not as easy. But there is a nice
Debian mailing lists' standard policy is to allow posts from
unsubscribed users. That of course fits our standards for opened
development but has the drawback of allowing a lot of spam to reach
our mailing lists.
This spam also clutters the mailing lists archives.
However, 1.5 years ago, listmasters established a
My recent experience with
For some reason, 60G of free space on my notebook suddenly turned into 60G of movies. Bownian motion, perhaps.
Unfortunately, in this particular case, I absolutely don't like to let a movie (or book, for that matter) unfinished, so I watched
My wife has been pestering me for months to get a replacement for our dead Epson inkjet printer (which didn t last long, mind you). To avoid the nightmare of printer support, which, unless you buy a high-end professional printer which does everything plus the coffee, is usually somewhere between disaster and works sometimes , we spent a long time on manufacturers websites to choose wisely the model.
We chose the HP Laserjet P1102, which, 


Thank you,
My fellow Republicans and I got a nice early Diwali present on Tuesday. ~65 seats in the House ~6 in the senate, ~18 governorships and control of ~20 state legislatures. (Some races haven't been formally called yet.) A few disappointments though. no majority in the Senate and Harry Reid and Barney Frank were not defeated. Still overall its an election to celebrate. Here are a few thoughts.
The Election System Is An Embarassment
Once again there are several races where the outcome is in doubt because of technical problems with voting. Whatever politics we have, can we agree that it is damn stupid that we still can't get something as simple as counting ballots right?
Prediction: The 2012 Republican presidential candidate will come from the Tea Party.
While I may be a Republican, I am also a Cosmopolitan East Coast Elitist so the Tea Party didn't move me much. There were a couple of cases (NY and DE atleast) where their candidates were subpar and cost us victory but the best of the new Republicans also came out of this movement. I would rather vote for one of them than Romney, Huckabee, McCain, Gingrich etc. (With the exception of Sarah Palin who is just too polarizing I'm afraid.) The Tea Party itself will subside in a few years as all populist movements do. (Ask the Hope'n'changers.)
Young People Are Dumb
Part of leftist mythology is the idea that one day "the kids" are going to rise up against the mean old corporate overlords. It ain't going to happen. There was a huge upsurge in first time voters in 2008 but that was because Obama was a novelty act not because they had suddenly discovered the merits of Keynesianism. Now Obama is old and busted so they won't vote anymore. (Not until they have kids and a mortgage sometime in the future.) They'll spend time make cool ironic signs for the
Today, Zoe is six months old. The last three months certainly feel like
they've taken their time, but a lot has happened.
Developmentally, she's doing great. She's now in the 70th percentile for
height (up from around the 25th percentile), and 31st percentile for weight
(up from the 25th percentile). She cut her bottom front teeth a few days
ago. Crawling is imminent, I'd say. She can already scoot around in reverse,
and by a combination of shuffling and rolling, doesn't seem to be having
problems moving around the floor.
We started her on solids at five months, and she's taken like a duck to
water to pureed pumpkin, sweet potato, beans, zucchini, apple, pear, banana
and avocado. Speaking of water, she's also decided she likes to drink water
from our glasses whenever she sees us doing it. Hilarity usually ensues,
closely followed by a change of outfit.
She's sleeping well, only waking up once a night under normal circumstances,
and that wake-up is getting later and later. She loves her baths. She usually
lets out a series of loud sighs as soon as we put her in the bath.
She got her first cold a couple of weeks ago. It coincided with her first
day in ad hoc daycare, but Sarah and I were both sick as well, so I think
it's more likely that she caught the cold from us than from daycare. She's
still battling it, but it hasn't really bothered her all that much. She's
just a bit snotty. The
About a month ago, at the end of August, I finished a 10-day Vipassana meditation course. This was probably one of the more extreme activities I have ever participated in, and it's well worth a blog post.
I found out about the course in a ridiculously trivial way, by following a link in a Reddit comment (I wonder if I could track down that comment...). The