Posted by Kenneth Kalmer
on September 30, 2009
More as a reminder to myself for when I need this again, but I’m sure everyone needs this at least once.
Having screwed up my kernel configs for my VirtualBox Gentoo image, I needed a serial console to catch the boot messages scrolling past in order to see if all the required hardware was being loaded by the kernel. I’ve never done this on a physical machine before but I am converted now and will acquire a USB to serial port converter in the near future…
Using this article as a base you need to do the following:
- Enable serial ports for your virtual machine
- Select “Host Pipe”
- Enter /tmp/vboxconsole as the filename
- Use netcat to read the console: nc -U /tmp/vboxconsole
When booting you need to amend your grub boot line to have the following at the end:
console=ttyS0,38400
Making it look something like this:
kernel=/kernel-2.6.30-r6 root=/dev/sda3 console=ttyS0,38400
Proceed to boot and look at netcat to see the entire boot output scroll past without disappearing into thin air when the kernel panics.
Man, I love virtualization. I tested this on Mac OS X 10.5 with VirtualBox 3.0.6, but it should work on any *nix platform. Some more Gentoo serial console madness can be found on the old Gentoo Wiki.
Posted by Kenneth Kalmer
on March 20, 2009
I was busy merging work back and forth between topic branches today and by accident miss-merged a 700-line spec. Everything else was fine (or so I hope) except this one file. I couldn’t use git revert, since that would mean I’ll have to redo all the merges I made.
So in panic I googled and read several man pages, coming to the following conclusion that worked quite well:
- Find the offending commit with git log or git log -p, not the revision number prior to the catastrophic change.
- View the file at that point in time with git show SHA-ID:path/to/file
- Replace current copy with git show SHA-ID:path/to/file > path/to/file
- Verify the damage has been undone with git diff
- Commit
- Breathe
Git is a double edged sword, it is extremely powerful and useful, but can be a real pain in the behind. I love git, and will not easily be convinced to move to something else.
Posted by Kenneth Kalmer
on November 21, 2008
I hit a barrier last night where my virtual machine I use for Rails development ran out of space. I quickly checked around and saw my current Rails project had 800MB in log files (thanks autospec).
So I decided to quickly cook up this little bash script that I run from my top level working directory, and have it clear all the log files, in all my Rails projects.
Hope it helps.
Posted by Kenneth Kalmer
on October 23, 2008
Just a quickie to tell you about my (first) latest gist: http://gist.github.com/19021
Basically search through the postfix maillog for a pattern, extract the postfix message id from each matched line, and then search through the log file for each corresponding line.
This rebuilds your original search with some more context, and makes it a snap to trace a message through its lifecycle…