Archive for the ‘Linux/Unix’ Category

Two Post Rack

Sunday, August 31st, 2008

This is a rare sneak peak into the state of the art data center that houses my blog.

OK, it’s really just my basement, but use your imagination!

Pipe Viewer

Wednesday, February 13th, 2008

A colleague at work showed me this utility for viewing statistics on information flow through pipes. It is really slick.

OpenOffice and Active Directory?

Wednesday, January 9th, 2008

I tried to start OpenOffice today on my Red Hat 5 workstation and nothing happened. Starting from the command line I saw this error:

(soffice.bin:14419): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (118141)

The user id (118141) is my Active Directory login mapped to a local UID on my Linux workstation. To make a long story short, the ncsd daemon was not running and getpwuid_r() exhibited strange (to me at least) behavior. Starting ncsd immediately let OpenOffice start.

In the process of testing this I whipped up this C program to test the getpwuid_r() function.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <pwd.h>

int main(int argc, char *argv[]){
if(argc != 2){
exit(1);
}
uid_t me = atoi(argv[1]);
struct passwd pwbuf;
char buf[2048];
struct passwd *pwbufp;

int ret = getpwuid_r(me, &pwbuf, buf, 2048, &pwbufp);

if(ret == 0){
printf("OK %s\n", pwbuf.pw_name);
} else {
printf("Failed, returned %d\n", ret);
}

exit(0);
}

I observed that when the ncsd daemon not running getpwuid_r() would return info correctly for entries in /etc/passwd but not others. Any uid not in /etc/passwd would be returned as if it was the last entry in /etc/passwd. For example, the last entry on my workstation happens to be uid 26, user postgres. Any uid that I passed to the check program that did not exist in /etc/passwd was returned as postgres. Weird. I didn’t investigate any further once Google provided the ncsd hint.

Tips using screen

Thursday, September 20th, 2007

http://gentoo-wiki.com/TIP_Using_screen