2011-11-14

Solaris 11 default route

Q: How to add a default gateway on a Solaris 11 system?

A:
      route -p add default 192.168.1.1



Explanation: If you happened to be a Solaris administrator since version 2.3, like me, you were used to create a file
 
      /etc/defaultrouter 

But not any more! The "route -p" certainly is a good thing, I'll remember that.

2011-11-08

flatten a gnu tar archive

Problem:

I have a tar file with a deep directory hierarchy but only some files in it. I want to extract the files into my current directory and not care for subdirectories. Filenames do not conflict. The gnu tar option --remove-components does not handle this well.

Solution:

Fortunately, there is a very general gnu tar option --transform:
    tar --extract --transform='s/.*\///' --show-transformed-names --file=foo.tar
This deletes pathname up to the first slash character, resulting in the desired effect.

Example:

$ mkdir -p a/b/c/d/e/f/g/h/i
$ echo "hi there" >  a/b/c/d/e/f/g/h/i/foobar
$ tar cvf foo.tar a
a/
a/b/
a/b/c/
a/b/c/d/
a/b/c/d/e/
a/b/c/d/e/f/
a/b/c/d/e/f/g/
a/b/c/d/e/f/g/h/
a/b/c/d/e/f/g/h/i/
a/b/c/d/e/f/g/h/i/foobar
$ tar --extract --transform='s/.*\///' --show-transformed-names --verbose --file=foo.tar
a
b
c
d
e
f
g
h
i
foobar
$ cat foobar
hi there 

2011-03-03

Repairing Windows XP

Repairing Windows XP (e.g. because disk was moved into new box).
  • first make sure the administrator account has a password
  • download the latest service pack and current patches to disk, e.g. with the help of a Linux live system
  • make a backup copy of %SYSTEM32%\WPA.DBL and WPA.BAK
  • boot from Windows CD, preferrably a recent one
  • you may have to enter the administrator password
  • select install (not "R" for repair console)
  • select repair ("R")
  • if installation of some files fails with a bogus error message, skip
  • if you can not boot any more, try to boot safe mode
  • install service pack and pachtes (may replace files that you skipped before)
  • restore WPA ("Windows Product Activation") files
  • check activation state: oobe/msoobe /a
bingo

PEAR installation on Windows

Unbelievable but true, there is no native PEAR for Windows.



PEAR is a vastly successful standard library collection for the even more successful PHP server side web programming language. Almost every website nowadays uses a PEAR module or two. Entire web frameworks use PEAR and and its distribution/installation system.

That is was written on Unix by Unix nerds and is used on Unix webserver hosts should not make it unfriendly to Windows users. But it does.

Unbelievable but true, there is no PEAR.msi to be downloaded anywhere from the web. For the simple reason that no one has cared to wrap it. I am writing this in March 2011. It feels like stone age.

Get me right. I am not a Windoze luser computer newbie. And I do all my work (paid and unpaid) on Linux and other Unixes. Nevertheless, I think this disrespect of the PEAR community for the other worlds out there is nothing less than atrocious.

2010-12-15

finding non-meta data in a source repository

Working with a source code repository on the command line. I want to search all files in my checkout, but not the ".dotfile" metadata from the repository mechanism. The Unix "find" command has a -prune option whose function is hard to remember. So here for the record, that's how it is used for that purpose:

find . \( -name .svn -o -name CVS \) -prune -o -type f -print

keywords: unix, linux, programming, search, find, exclude, revision control, cvs, subversion

2010-08-03

upgrade glibc

As I mentioned in an earlier post, I am a Unix person crazy enough to attempt upgrading the core C library, glibc, by hand. The first, naive attempt failed, of course: simply copying the new library files over the old ones renders the system unusable.

Here I found a helpful text by Dave Storrer which helped me navigate around the most dangerous cliffs.

Here is an outline:

  1. compile glibc (current version 2.11.2)
  2. install it into a temporary directory
  3. remove ld.so.cache
  4. rename the critical library files, i.e. those having the version number 2.11.2 in the name
  5. install everything in the final destination
  6. rename the new files back, one by one...
  7. ...immediately linking them with the command "/sbin/ldconfig -l ..."
  8. don't strip any library symbols

2010-03-31

unexpected reloc type 0x0e

  • unexpected reloc type 0x0e
  • error while loading shared libraries: libc.so.6: cannot handle TLS data

You're not going to upgrade a the libc of a running Linux system, are you?. - If you are, you know what I am talking about. In the process, you might have gotten one or more of the above error messages.

Try this simple remedy: ldconfig

Switching forth and back between glibc versions:
  • ln -sf libc-2.11.1.so libc.so.6 
  • ldconfig
  • sln libc-2.3.5.so libc.so.6 
  • ldconfig
Where sln is a statically linked version of ln.