Archive for the ‘unix’ Category

Beyond the standards

Monday, December 27th, 2010

If you do any sort of unix shell script-y-ness, you know all about STDIN, STDOUT, and STDERR. If you are a semi-advanced and above user, you know their numeric equivalents (0,1,2) and how they show up, or are implied, in some commands (ls -la 2>errs.go.here). Well it turns out there are defined slots for file descriptors 3-9 3-19, mostly left adrift on the sea of lost inside knowledge. Learning about them, it’s the first I have heard of how any process spawned by exec automatically inherits fd5, so you should avoid using it.

It definitely provides a possible explanation of why an external program being run with stdout and stderr redirected can still print a progress message on-screen.

UPDATE: Advanced Unix Programming by Marc J Rochkind says there are 20 fd’s available.

AIX uh-oh

Tuesday, November 9th, 2010

One of the AIX boxes wasn’t responding to status checks this morning via STAF. I’ve had problems with people shutting down the wrong slice on the AIX shared hardware server, so that’s my first assumption, but the box is telnetable still, so that’s not it.
First thing I notice is how slow my telnet session is to respond. I do a “netstat -a”, and get a bus error (core dump). Well that’s not good. “df -k” doesn’t show anything obvious; what should be mounted is listed as so. Hrm. “fsck -fy” fails with “Unable to read superblock (TERMINATED)”, and “errpt -a” gives back “-bash: /usr/bin/errpt: There is an input or output error.”

Sounds like a hardware failure. Here’s hoping it’s only something throwaway like /tmp, but I’m not holding my breath since it’s probably all the same physical disk slice underneath.

No Inodes for U!

Tuesday, October 12th, 2010

Background process at work wasn’t working, start going through the debug steps to figure out what’s gone wrong.  Box has 93GB free in /home, so that should be all good, but log has a bunch of ” No space left on device” errors, hrm.

df -h  Use%= 46

df -i iUse%  = 100

d’oh.

Rsync, Mac OS X, and external USB drives

Monday, October 4th, 2010

For the last year or so, I’ve had two 1tb external USB drives, one attached to a winPC at work, the other to a MacPC at home.  I kept them synchronized with rsync over ssh, and had silently been bemoaning the lack of consistent support for extended characters.  Lots of “file vanished” type errors.

Recently, the USB drive at home started ejecting itself; seemed like a sign of impending overall failure, so I went and bought a replacement drive, 2tb ’cause it was on sale.  When I got it home, I had to reformat it before the Mac could write to it (in fairness, the box did mention this, I just didn’t read the box), so I went with journaled MacFS.  Today’s sync is taking extra time because it’s finally started successfully transfering the files with embedded extended chars, ala “Bj\#224rk”.  All this time, I assumed the problem was poor character set support in the mac version of rsync, turns out it was more of a FAT filesystem problem.  Learn something every day.

Or maybe rsync just discovered a new way of duplicating files.  d’ohwell.

Dedicated Stupidity

Sunday, September 19th, 2010

The last several days, someone has been trying to ssh into my home box.  It seems like a really haphazard attack.  They are using an attack system that spawns multiple attack IP addresses, but they aren’t spawned automatically, and there are big gaps between when I block one IP address, and when he starts attacking from a new one.  I’m tempted to put together a honeypot, and see what someone with so little knowledge does once they get access to a machine.

Jamie Zawinski quote

Thursday, September 9th, 2010

“Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.”

NIS finally!

Friday, June 25th, 2010

Trying to setup an NFS/NIS pair of systems at work has been driving me nuts.  All the HOWTO guides kept referencing an /etc/sysconfig/network file that is a directory on my systems.  I guessed, correctly, that what they wanted in those files should go into the /etc/sysconfig/network/ifcfg-eth0.   Everything else seemed pretty much straightforward, but connections would fail with the NIS client unable to even see the NIS server.

In my /var/log/messages, I saw

Jun 23 12:41:02 machinename ypserv[23456]: refused connect from x.x.x.x:35684 to procedure ypproc_domain_nonack (domainname,;0)

It turned out I needed to add to my /var/yp/securenets file.  When I first opened it up, in only had 127.0.0.0.  After I added a netmask for my subnet (255.255.0.0   x.x.0.0), things went much more smoothly.

And after all that, it turns out that the customer problem had nothing to do with NFS or NIS, it was a simple permissions issue of 755 vs 775.  d’oh.  If only they had sent the logs first, instead of last.