slaniel | Uncategorized | Sunday, October 23rd, 2005
Can someone explain to me why egrep reads as follows on my machine?
#!/bin/sh exec grep -E ${1+"$@"}
I’ve been looking around for what the ${1+"$@"} syntax means, and I can’t seem to find it — not even on the endlessly useful Advanced Bash Scripting Guide. I would have thought that egrep would just be
#!/bin/sh grep -E "$@"
but presumably there’s some good reason why it’s not. Any ideas?
slaniel | Uncategorized | Sunday, October 23rd, 2005
A friend called me today in somewhat of a panic, because his company’s ext3 hard-disk partition, which sits on top of a RAID-5 drive and houses an Oracle database, suddenly disappeared without a trace. It’s as though the partition never existed. He asked me whether I knew enough about the innards of ext3 to help him figure out where the data went. I don’t. I could probably Google around a bit and start fumbling my way toward the answer (which is, sadly, the way that I learn a lot of stuff), but I didn’t know it offhand. And he understandably needed information right away.
It’s possible that his master boot record disappeared. Any number of other low-level explanations are possible. But
Could any of the Linux geniuses out there suggest a general method for approaching a problem like this?
If I wanted to get that level of detailed knowledge of ext3, in a very systematic way, what would you suggest? Which books should I read? My company is quite supportive when it comes to buying me books that advance my career, so certainly this kind of knowledge is the sort that they’d pay for. A little googling suggests that maybe Managing RAID on Linux or System Performance Tuning are places to start, though there may be better ones.
Speaking of which, I get the sense that NFS isn’t the best solution for large-scale networked storage. As my boss and I discussed on Friday, everyone talks about using the Andrew File System, but few people seem to do it. And it seems to be one of those immensely complicated products that no one knows in all its details. But I may have a good reason to use it at work over the next few months, so I wonder whether now is the time to dive in. CMU is certainly filled with people who could point me in the direction of learning it.
P.S.: Recovering lost ext2 Linux filesystems seems like it could be helpful.
P.P.S.: And there’s a book called simply Linux Filesystems that seems promising. Though it’s published by Sams, which I’ve always viewed with suspicion; their books don’t have the signal-to-noise ratio of O’Reilly books. Plus the back cover describes OpenAFS as “a version of IBM/Transarc’s networked filesystem that was recently released into the public domain by IBM.” I find it extraordinarily unlikely that IBM made it public domain. Maybe they released it under the IBM Public License, but I really doubt it’s public domain. I could be wrong, though.
slaniel | Uncategorized | Friday, October 21st, 2005
Here at work, I just discovered that another server I need to work on is running Mandrake. I hate Mandrake. But that’s not really the point. The point is that there are now Mandrake, Debian, Gentoo, and FreeBSD machines to figure out. Not to mention the Windows machines, and the desirability of authenticating Linux machines against a Windows domain.
This is irritating. Maybe a long-term project for me will be to switch everything over to Debian. Though by that point, I’ll probably be comfortable with all the OSes here.
slaniel | Uncategorized | Friday, October 21st, 2005
I’m trying to figure out what the equivalents of various Debian commands are in FreeBSD. I’ll include them here as I figure them out. For now they’re just questions:
apt-cache policy [package name]
In Debian, lists the currently installed version of a given package, and which versions are available in the Debian system.
dpkg --get-selections
List all packages that have been installed, uninstalled, or purged.
dpkg -L [package name]
List all the files installed for [package name].
dlocate [filename]
Among installed Debian packages, find all those that contain [filename]. Because it’s searching packages that are installed on the local disk, it’s much faster than apt-file, below.
apt-file search [filename]
Among all Debian packages, installed or otherwise, find all those that contain [filename].
P.S. (3 Nov 2005): Random Wikimedia-using guy, I think I love you.
Comments Off
slaniel | Uncategorized | Thursday, October 20th, 2005
Tom DeLay turns himself in to be booked:
Rep. Tom DeLay turned himself Thursday in at the Harris County sheriff’s bonding office, where he was photographed, fingerprinted and released on bond on state conspiracy and money laundering charges.
(Via ThinkProgress)
Someone out there: please, please, please post Delay’s mugshots.
P.S. (2:49 p.m.): I love technology, always and forever.
slaniel | Uncategorized | Thursday, October 20th, 2005
I got a machine here at work up and running in under an hour the other day with Debian. Specifically, I downloaded a 180-meg net-install image, burned it to a CD, rebooted to that CD, and installed the rest of the packages — including servers, graphical environment, word processor, etc. — off the web in less than an hour. It would have taken less time with a faster connection; I think I was getting about 200 K/sec. Of course it would have been even faster had I downloaded everything I needed ahead of time and installed from local CDs.
I suspect that a net install or a Live CD — such as Ubuntu Live — is the fastest way to explain the charm of Linux to new users. “Let’s stop talking about how cool this thing is. Let me just show you.”
Comments Off
slaniel | Uncategorized | Thursday, October 20th, 2005
No terrorist events to draw people’s eyes away from his domestic failings . . . Iraq war going badly . . . much of his administration under indictment . . . Miers nomination probably dead in the water . . . What is a failure of a president to do? How about start a war with Syria?
slaniel | Uncategorized | Thursday, October 20th, 2005
If I’m not mistaken, the Soviet Union used to require its citizens to register their typewriters, because each typewriter had a distinct signature — a distinct deformation in the letters pressed onto each page, for instance. When I read that years ago, I lamented the Soviet police state. Thankfully, now I can lament the American one.
Comments Off
slaniel | Uncategorized | Thursday, October 20th, 2005
I installed MediaWiki — the software that runs Wikipedia — for a client here at work the other day, and I have discovered a really irritating bug that’s “Documented” (in that someone commented on the wiki). It seems that if you customize the sidebar, the customization doesn’t show up on a given page until you edit and save that page. There’s some sort of caching issue here. Presumably there’s a way to flush the entire cache and rebuild it at once. Again, I’ll hunt around for a while to fix this, and post whatever I discover here.
P.S.: Easy enough. Just set a variable to invalidate the cache after a certain timeout. The puzzling bit is that the timeout appears to be infinite by default.
The caching also ought to be smarter. If I update the template by changing one of the files included within it, some portion of the cache ought to be invalidated — not the whole thing, just the part that contains the nav bar that I’ve changed. MediaWiki doesn’t seem to do this yet.
P.S.: Maybe not so fast. I’m a little confused: it looks like the $wgCacheEpoch variable is set to a specific time, as opposed to a time interval. That is, rather than saying “expire the cache every hour,” you have to specify “expire the cache now.” And presumably you then have to change $wgCacheEpoch every time you want to expire the cache. That doesn’t make sense, so I clearly must not understand what’s going on.
P.P.S. (20 Oct 2005): MediaWiki recommends deleting the cache through a little hacked-together script. The hack works like so:
- Download the Special:Allpages Wiki page.
- Find the portion of the Allpages source that lies between
<!-- start content --> and <!-- end content -->. - Within that portion, grab all the
a href chunks. - Visit each of those links with
?action=purge appended to the end.
It works, but wouldn’t work for a large site. In particular, imagine running that script over the contents of the Wikipedia itself. By now it has to be up to a few million pages. Presumably there’s some way, using just the local filesystem, to delete the cache. I’d hope that there’s just a local directory that one can rm -R.
slaniel | Uncategorized | Thursday, October 20th, 2005
For some reason it’s been exceedingly hard to answer a very simple question: I want my daemon — particularly the mailman daemon — to launch at startup. How do I do that?
It turns out to be fairly simple: FreeBSD runs any script in /usr/local/etc/rc.d with the start argument. In particular, since mailman is in the FreeBSD ports area, it automatically installs a mailman.sh file in /usr/local/etc/rc.d. Voilà: mailman runs at startup.
My next question is how FreeBSD determines the order in which daemons run at startup. Obviously certain daemons have to start before others; networking, for instance, must start before any daemon that requires a network connection. Linux — I believe starting with Red Hat — has “runlevels” to solve this problem. I believe runlevel 3, for instance, is mostly networking. So then any daemon that starts after level 3 is going to have networking available. The question then is how to decide on the ordering of particular daemons within a given runlevel (since some daemons during the networking runlevel, for instance, may need to start before others).
Anyway, this is my latest question in the FreeBSD learning curve that I’m on.
P.S. (25 Oct 2005): Neat. I figured out how FreeBSD determines the run order for scripts in /usr/local/etc/rc.d: it uses rcorder(8). See below for the manpage (since I know you’re endlessly fascinated by the FreeBSD boot process).
(more…)
slaniel | Uncategorized | Wednesday, October 19th, 2005
Yes. Hell yes. The corruption moves higher and higher.
And is it really possible that Cheney pushed this without Bush’s knowledge?
slaniel | Uncategorized | Wednesday, October 19th, 2005
I’m using mailman under FreeBSD, and I have been charged with figuring out why it’s not working. Initially it wasn’t working because the permissions were set incorrectly: mailman expected to be invoked as user ‘nobody’, but Postfix was invoking it as user ‘mailman’. The latter is preferable, kind of ironically: since user ‘nobody’ is supposed to be a user that doesn’t own any files, it’s supposed to be the safe user to choose your programs to run under. If your web server is running as ‘nobody’, for instance, and it gets compromised, then in all likelihood the attacker will only be able to access files belonging to ‘nobody’. Good news, except that lots of programs now use ‘nobody’ — hence all the files for all those programs are vulnerable to attack. The smarter idea is to use a separate user for every program.
So anyway, that was the issue with mailman: it was running as ‘nobody’ and it really should have been running as ‘mailman’. Easy enough. After figuring out how to compile mailman with the appropriate option, it ran fine.
Now the problem is . . . nefarious. Mailman will create mailing lists properly, and I can send messages to them just fine: the messages go through to postfix, whose log files dutifully tell me that a message has arrived. That message gets handed off to the appropriate mailman program, where it disappears into some kind of hole. I’m now trying to figure out how to kick up the mailman log verbosity to see where, exactly, the mesage is disappearing. It doesn’t end up in the /pipermail archives, so it’s just disappearing somewhere between postfix and mailman. Hm.
P.S. (19 Oct 2005): Searching Google for articles about mailman is rather tricky, because everyone uses mailman for their mailing lists. So you’re looking for stuff about mailman, and you end up finding articles distributed by mailman. This is the sort of problem that would be solved by good semantic tagging. It’s related to the problem of, say, looking for articles by Steve Martin and instead finding articles about Steve Martin; Google isn’t yet prepared to handle the difference. As far as I know, no extant search engine is. Though I’d suppose that with enough statistical intelligence, you could use the document structure — even absent any meta-tagging — to figure out what it’s about.
P.P.S. (19 Oct 2005): Figured it out. Qrunner wasn’t set to run as a daemon, apparently, so the last time the machine rebooted it didn’t bring qrunner back up. When I reinvoked it manually, I got about 20 million test messages in my inbox. (Thanks to a nice FAQ for help on solving this.) Now I just need to figure out how to start new daemons in FreeBSD. In Debian it would be easy enough: run some program like rcconf or update-rc.d, or at worst create a bunch of symlinks. Presumably there’s some equivalent under FreeBSD.
What we need is a large table, providing equivalents between various Unices’ functions.
slaniel | Uncategorized | Tuesday, October 18th, 2005
I’m glad to see that people can post rebuttals of crap Craigslist posts. I’ve thought for a while that it would be handy to set up a website containing reviews of landlords, so that people would be able to find all the negatives; Craigslist, being filled with reviews from the landlords themselves, is all about positives.
Comments Off
slaniel | Uncategorized | Tuesday, October 18th, 2005
How much do I hope that Kevin Drum’s first commentator is right when he guesses that Colin Powell is the high Administration official who’s cooperating with Fitzgerald to prosecute the Plame case? So much do I wish this.
Then again, I hoped that Kissinger was Deep Throat, and it turned out to be Pee-Wee Herman (right). Shows what I know.
slaniel | Uncategorized | Tuesday, October 18th, 2005
I hope some of you were watching last night’s NLCS game between Houston and St. Louis. The Cards were on the brink of elimination — as close as they possibly could have been without actually being eliminated: top of the ninth in Houston, 2 outs, St. Louis behind by 2 runs in what could have been the deciding game. Albert Pujols comes to bat and hits a three-run home run. St. Louis goes on to survive the bottom of the ninth, and escapes defeat for at least one more day. Pujols’ homer was the most clutch hit I’ve ever seen.
slaniel | Uncategorized | Monday, October 17th, 2005
Why the fuck do you put everything under /usr/local?
Love and kisses,
Steve
P.S.: I was explaining to someone the other day what the various UNIXes are all about. My understanding is that everything would have been cool, and UNIX would not have become a fractured mess, had AT&T not closed up the source back in the 70’s. Then various companies invented their own versions of UNIX (Solaris , HP Unix, True64, Irix, AIX, etc., etc.), and BSD released theirs under some kind of free license, and various others took the BSD and made their own sub-UNIX out of it; hence FreeBSD, NetBSD, OpenBSD, etc. Then Linux came along, and GNU, and blah blah blah. Eventually it became so fractured that people had to devise POSIX to standardize what the phrase “Unix” means.
So then my friend asked, “But aren’t there a bunch of different Linuxes also?” Indeed there are. Each has its own peculiarities, mostly about where various files live and how to configure various things. I sense that Linux is less fractured than Unix ever was, and certainly organizations like the Linux Standard Base, FreeDesktop, and x.org are working to avoid the mistakes that killed Unix. But there’s still too much frustration in making — for instance — scripts that are portable across Unices. I look forward to not relearning configuration for each new Unix that I encounter.
One good start would be a wrapper around, for instance, FreeBSD programs like pw. I’m used to typing commands like
sudo adduser username groupname
to add user username to group groupname. The equivalent under FreeBSD is
pw groupmod groupname -M username
Under Mandrake, I remember having to user usermod or somesuch for the same purpose. This should all be standardized.
P.P.S.: It’s about time for -o to be an option that every version of grep supports.
slaniel | Uncategorized | Monday, October 17th, 2005
A friend notes that the Iraqi constitution is deliberately vague in its double-jeopardy standard:
5th — The accused is innocent until his guilt is proven in a just, legal court. The accused cannot be tried for the same accusation again after he has been freed unless new evidence appears.
My friend points out that if he were running an authoritarian regime, he would use this clause to prosecute someone, then bring out little bits of new information after every trial to try them again. This clause purports to forbid double jeopardy, but it explicitly includes a loophole that allows double jeopardy. Cf. the American equivalent:
Amendment V
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a grand jury, except in cases arising in the land or naval forces, or in the militia, when in actual service in time of war or public danger; nor shall any person be subject for the same offense to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
It takes positive work to produce a constitutional clause with the loophole that the Iraqis now have. Clearly someone is hoping to produce an authoritarian regime. I’d love to understand the process that led to this clause. Cui bono?
slaniel | Uncategorized | Monday, October 17th, 2005
A Crooked Timber post reminds me of a question I’ve had for a while: which authors writing today will we still be reading in 100 — or for that matter 500 — years? Is there anyone with the longevity of Shakespeare? How about musicians? We still listen to Bach and Beethoven; is there anyone alive today whom we’ll still be listening to in 200 years?
slaniel | Uncategorized | Sunday, October 16th, 2005
Comments Off
slaniel | Uncategorized | Sunday, October 16th, 2005
Apparently Bill O’Reilly is upset at the prospect of Karl Rove’s downfall. He thinks it could lead to “chaos in the executive branch.”
Ahem.
You motherfucker. Where were your fears of chaos when Republicans were recklessly pursuing a vendetta against Bill Clinton?
I’m too angry to write anything clever here. I really just wonder where people like O’Reilly come from. In my calmer moments, it occurs to me that my side of the political spectrum must look — to people like O’Reilly — as though it’s filled with loons. Surely there must be sane folks on the GOP side, I say to myself. And that’s probably true. But unfortunately, it seems as though right-wing politics these days is dominated by people whose PR is far ahead of their principles. Maybe there are some good right-wingers out there; if so, they’re staying quiet.
P.S. (17 Oct 2005): An apposite rant:
All of the pack that relentlessly pursued Clinton will kvetch about the “criminalization of politics.” They will see no irony or hypocrisy in their complaint because this is a fight about preserving power not maintaining consistency. The conservative standard is clear – when a Democratic President is the target it is about the “rule of law” and when the “victim” is a Republican it is about the “criminalization of politics.” It is particularly rich that Tom DeLay, the relentless pursuer of Clinton, is making this claim. One wonders whether he agonized over this injustice with Casino Jack Abramoff and Righteous Ralph Reed as they jetted over the Atlantic on the way to their golfing outing in Scotland.