Home » debian » Page 3

debian

My poor-man’s SSD boots DOS really fast

So, my no-name compact flash adapters arrived today. I ripped one open like a kid at Christmas, pulled a PC off the scrap heap, yanked my 128 MB compact flash card out of my PDA, and went to town.Unfortunately I couldn’t get Xubuntu to boot, let alone install a minimal configuration, because my CD was corrupt. I wasn’t sure if I could install anything in 128 MB, but my last Debian 3.0 install was smaller than that, so I held out hope.

So I grabbed a Windows 98 SE CD. Surely that would fit in 128 megs if I left out all of the optional components, right? And if not, there’s always Doublespace, right? Wrong. The installation bombed out, saying I needed 205 megs.

The original Win98 was smaller though, right? So I grabbed that CD. It wouldn’t play either. It repeated that same 205 meg line. I’ll bet it says that to all the guys.

So I grabbed my Win95B CD. I’m pretty sure I once crammed Win95B and Office 97 onto a 170 MB hard drive. It wasn’t pretty, but hey, it was an emergency. But no joy there either. The CD wouldn’t even read. I guess I shouldn’t be surprised since it’s a CD-R that I last touched sometime in 1999. I have no idea where the original CD is, but I know where the manual and COA are, not that that helps any.

I dug around for a Debian CD. I come across those fairly often when I’m looking for something else, but tonight I couldn’t find one.

I found my OS/2 3.0 sleeve, which got me thinking, but I couldn’t find the disc. I know I could make that fit in 128 megs and it would really scream–as in, it would complain loudly about the ATI video, and it would run really fast–but I never found the CD.

So for lack of anything else to put on it, I reinserted the Win98SE disc, rebooted, picked the Command Prompt with CD-ROM option, and dropped into DOS for perhaps the first time since the Clinton administration. I ran FDISK, blew away the partition table and repartitioned it, rebooted, found FORMAT.COM hidden in the WIN98 directory on the CD, formatted the drive, remembered I had to use the /S option, reformatted the drive, copied over himem.sys, oakcdrom.sys, mscdex.exe, and whatever else I could find, and built up config.sys and autoexec.bat files by hand using copy con, since I couldn’t find edit.com anywhere on the CD. I removed the CD, rebooted, and it booted fast–into an error message saying I’d neglected the /d parameter. Considering the last time I used the /d parameter was in 1999, that shouldn’t be surprising. What is surprising is that I remembered the syntax. So I deleted config.sys and autoexec.bat, built up new ones with copy con, and rebooted again.

The Win98 splash screen flashed, then I got a familiar DOS prompt, including indicators that the CD-ROM driver was working. It took about as long to boot as it did for the BIOS to do its thing–probably 1-2 seconds. Not bad for $7 worth of hardware ($5 for the adapter from Compgeeks, and $2 for the CF card from a garage sale).

Supposedly Windows 2000 can shrink down to 60MB if you get really aggressive with nLite. I’d really like to see that, but that means I’ll have to find my Windows 2000 CD. I’m sure it’s hiding somewhere in Argentina, playing cards with my OS/2 3.0 and Debian CDs.

I also ought to download Debian 3.0 again. I’m thinking 60-120 megs of Debian is probably more useful than 60 megs of Windows, but I really want to see how quickly Windows 2000 boots off flash.

Supposedly these cards support UDMA, so I probably ought to order some larger CF cards so I can do something really useful with them. Seeing DOS boot instantly is enough to convince me that these things can be useful. Who knows, I might be insane enough to try running my webserver off flash (the memory, not the obnoxious Macromedia/Adobe product).

Setting the MTU automatically in Debian

I run this website off a server running on an ADSL line in a spare bedroom of my home. That causes some weird issues from time to time, like the time I had to figure out setting the MTU automatically in Debian.

Why Debian?

My server of choice is Debian, because it’s Linux which makes it fast, reliable, and cheap, and Debian makes it pretty easy to install only what you want and need, so I can have a server OS that’s only using 125 megabytes of disk space, leaving most of my drive available for content. I like having space for content.

This will work in Debian-derived systems like Ubuntu and Linux Mint too.

PPPoE issues

Now, the downside of modern DSL: Southwestern Bell, like most ISPs these days, uses PPPoE. So not only can your IP address change with no notice whatsoever, you also have the hassles of PPPoE. With the default settings, some unknown but noticeably large percentage of web users won’t be able to access a web server running on a DSL connection using PPPoE.

The reason is MTU and fragmentation.Yes, you remember MTU if you used Windows 9x back in the bad old days of dialup. Tweakers would play around with the MTU settings in hopes of squeezing just a little more performance out of their 56K modems, and they would swear that one utility did a better job than any others, or that this MTU setting was optimal and the conventional wisdom of 576 stank… Remember those flamewars?

Well, with broadband, theoretically the right setting to use is 1500. Trouble is, PPPoE steals some of that packet space, and the result is something worse than slow speeds. In some scenarios, you completely vanish.

Setting the MTU

The way to make my website reappear is to issue the command ifconfig eth0 mtu 1472. The exact number doesn’t seem to matter much. It appears for me that 1472 is the maximum I can use. (It can vary from ISP to ISP, in case you’re wondering.)

Excellent. Problem solved.

Not so fast. Problem solved until my server reboots. Linux doesn’t need to reboot, right? Right you are. But here in St. Louis, the power likes to hiccup a lot, especially in the summertime. My server is on a UPS, but every once in a while, in the middle of the night, there must be a long enough power failure that my UPS dies, because every once in a while I fall off the ‘net again.

To set the default MTU permanently–that is, to change it automatically on bootup–one normally would change the ifup script or the rc.startup script. Except Debian doesn’t have either of those.

My kludgy solution: cron. Log in as root, issue the command crontab -e, and add the following line:

*/2 * * * * ifconfig eth0 mtu 1472

With this in place, only seconds will elapse between the time my power comes back on for good and I reappear on the ‘net. I can live with that.

More Debian tricks

If you change your network card or motherboard, you don’t have to reinstall Debian but you may lose eth0. Here’s how to get eth0 back. And here’s how to get a list of the installed packages in Debian.

Dude, that Dell\’s, like, totally bent!

I fought with everything I had to get something else. So did one of my coworkers and my boss. But it was for naught. Late on Thursday afternoon, a pile of Dell servers showed up outside my office.

I did the only sensible thing to do: I ignored them until Friday morning.

I didn’t like how the box was taped. That shouldn’t make much difference. But what I really didn’t like was what happened after I pulled the PowerEdge 1750 out of the box.

It bent.OK, maybe “flex” is a more appropriate word. I’m used to working with HP servers. They have a one-piece chassis. Although their 1U offerings weigh about the same amount as these Dells, when you pick them up, they remain straight.

I think that’s a useful feature for something you want to shove into a rack.

Why, of course I suggested drugs as a possible explanation. I can’t let the obvious joke slip by.

I was happy to see that these servers, unlike the last Dell I worked on, actually use a ServerWorks chipset rather than a cheap Intel desktop chipset. The Intel stuff is cheaper, but then all you’ve really gotten is a Dell Dimension in a rackmount case. In all honesty, I’ve run Linux on Intel and Sis and Via chipsets and turned those systems loose as servers, but when you’re spending money rather than repurposing systems, you should spend the money to do the job right.

I was less happy when I went to install Linux on it. The standard Debian 3.0 wouldn’t see it. It was the first time I’d found a system that Debian 3.0 wouldn’t boot.

A Google search quickly turned up a custom Debian boot CD for Dells, which I used to do the installation. Once installed, we compiled a custom kernel so the system would work right. I used to routinely recommend that. That was before I had 125 servers to stay on top of. These days I’m more inclined to use the standard kernel whenever I can–that way, when a vulnerability shows up, I can just apt-get update and reboot, rather than having to compile a kernel and then reboot.

I’m not in love with HP’s service–that’s a story in and of itself, but the short version is that the last time I used their 4-hour-response-time service, it took a day longer than regular warranty service would have taken–but HP’s servers sure make my life less complicated than Dell’s do.

In honor of Charlemagne\’s birthday…

I have posted my genealogy, including Charlemagne, online.

As for why a Scot is making a big deal about Charlemagne’s birthday, well, I’m descended from him. But I guess I could have said I did this to celebrate Walter Percy Chrysler‘s birthday. Or William Austin, but you probably haven’t heard of him.Actually I’m just being silly. I’ve had this running since this past weekend, but this is the first time I’ve gotten around to mentioning it.

You can view anything that happened prior to 100 years ago without a password. Stuff newer than that is protected, in order to protect privacy and protect my relatives from identity theft. As dead people’s birthdays come up, I may open their records, but I’m not going to sift through 2,300+ records all at once looking for people who have died since 1904 to open them up.

I used a program called GeneWeb, which comes with Debian but is available for other Linux distributions, Mac OS X, and Windows. It’s a nice package. In some ways it’s clunkier than Family Tree Maker, but for some things, like entering entire families, it’s much nicer and faster. There’s always a trade-off with software like this.

It’s a nice tool for online collaboration. Now my mom and aunt can enter information too, and all our stuff will be in sync, which has always been a major problem for us.

I don’t recommend leaving a package like this open to the world for modification just because a lot of people with nothing better to do like to vandalize public websites. (That’s why this site requires registration these days.)

Anyway, feel free to look around and play with it. I’m going to go back and finish entering the names of Charlemagne’s children.

Well, I’m a Slowlaris administrator now

Let me run down <strike>my list of qualifications</strike> what I know about Solaris.1. They call it "Slowlaris" because it initially wasn’t as fast on the same hardware as its predecessor, SunOS.
2. I don’t know if Slowlaris 9 is faster than older versions of Slowlaris, so I don’t know if this counts as something I know about it.
3. Slowlaris is based on System V Unix. SunOS was based on BSD.
4. Slowlaris runs primarily on proprietary hardware from Sun, based on a CPU architecture called SPARC. A handful of Sun clones exist, but I think Fujitsu is the only big third-party manufacturer.
5. There is an x86 version of Slowlaris. Sun keeps going back and forth on whether to continue making it or not, since they don’t make much money off it. It’s being made now. Professional Slowlaris admins argue that its availability makes it easier for up-and-coming admins to learn the OS without buying expensive Sun hardware–they can run it on their six-month old computer that’s too slow to run Doom 3.
6. "Sun" was originally an acronym for "Stanford University Network."

So most of what I know about Slowlaris is either trivia, or holdover generic Unix know-how. But I told my boss since it’s System V, I should be able to adjust to it almost as easily as I could adjust to a Linux distribution from someone other than Debian. I’ll just be typing –help and grepping around in /etc even more than usual.

Yep, it’s been that kind of <strike>week</strike> month.

Optimizing dynamic Linux webservers

Linux + Apache + MySQL + PHP (LAMP) provides an outstanding foundation for building a web server, for, essentially, the value of your time. And the advantages over static pages are fairly obvious: Just look at this web site. Users can log in and post comments without me doing anything, and content on any page can change programmatically. In my site’s case, links to my most popular pages appear on the front page, and as their popularity changes, the links change.

The downside? Remember the days when people bragged about how their 66 MHz 486 was a perfectly good web server? Kiss those goodbye. For that matter, your old Pentium-120 or even your Pentium II-450 may not be good enough either. Unless you know these secrets…

First, the simple stuff. I talked about a year and a half ago about programs that optimize HTML by removing some extraneous tags and even give you a leg up on translating to cascading style sheets (CSS). That’s a starting point.

Graphics are another problem. People want lots of them, and digital cameras tend to add some extraneous bloat to them. Edit them in Photoshop or another popular image editor–which you undoubtedly will–and you’ll likely add another layer of bloat to them. I talked about Optimizing web graphics back in May 2002.

But what can you do on the server itself?

First, regardless of what you’re using, you should be running mod_gzip in order to compress your web server’s output. It works with virtually all modern web browsers, and those browsers that don’t work with it negotiate with the server to get non-compressed output. My 45K front page becomes 6K when compressed, which is better than a seven-fold increase. Suddenly my 128-meg uplink becomes more than half of a T1.

I’ve read several places that it takes less CPU time to compress content and send it than it does to send uncompressed content. On my P2-450, that seems to definitely be the case.

Unfortunately, mod_gzip is one of the most poorly documented Unix programs I’ve ever seen. I complained about this nearly three years ago, and the situation seems little improved.

A simple apt-get install libapache-mod-gzip in Debian doesn’t do the trick. You have to search /etc/apache/httpd.conf for the line that begins LoadModule gzip_module and uncomment it, then you have to add a few more lines. The lines to enable mod_gzip on TurboLinux didn’t save me this time–for one thing, it didn’t handle PHP output. For another, it didn’t seem to do anything at all on my Debian box.

Charlie Sebold to the rescue. He provided the following lines that worked for him on his Debian box, and they also worked for me:

# mod_gzip settings

mod_gzip_on Yes
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_minimum_file_size 400
mod_gzip_maximum_file_size 0
mod_gzip_temp_dir /tmp
mod_gzip_keep_workfiles No
mod_gzip_maximum_inmem_size 100000
mod_gzip_dechunk Yes

mod_gzip_item_include handler proxy-server
mod_gzip_item_include handler cgi-script

mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/postscript$
mod_gzip_item_include mime ^application/ms.*$
mod_gzip_item_include mime ^application/vnd.*$
mod_gzip_item_exclude mime ^application/x-javascript$
mod_gzip_item_exclude mime ^image/.*$
mod_gzip_item_include mime httpd/unix-directory
mod_gzip_item_include file .htm$
mod_gzip_item_include file .html$
mod_gzip_item_include file .php$
mod_gzip_item_include file .phtml$
mod_gzip_item_exclude file .css$

Gzipping anything below 400 bytes is pointless because of overhead, and Gzipping CSS and Javascript files breaks Netscape 4 part of the time.

Most of the examples I found online didn’t work for me. Charlie said he had to fiddle a long time to come up with those. They may or may not work for you. I hope they do. Of course, there may be room for tweaking, depending on the nature of your site, but if they work, they’re a good starting point.

Second, you can use a PHP accelerator. PHP is an interpreted language, which means that every time you run a PHP script, your server first has to translate the source code into machine language and run it. This can take longer than the output itself takes. PHP accelerators serve as a just-in-time compiler, which compiles the script and holds a copy in memory, so the next time someone accesses the page, the pre-compiled script runs. The result can sometimes be a tenfold increase in speed.

There are lots of them out there, but I settled on Ion Cube PHP Accelerator (phpa) because installation is a matter of downloading the appropriate pre-compiled binary, dumping it somewhere (I chose /usr/local/lib but you can put it anywhere you want), and adding a line to php.ini (in /etc/php4/apache on my Debian box):

zend_extension=”/usr/local/lib/php_accelerator_1.3.3r2.so”

Restart Apache, and suddenly PHP scripts execute up to 10 times faster.

PHPA isn’t open source and it isn’t Free Software. Turck MMCache is, so if you prefer GPL, you can use it.

With mod_gzip and phpa in place and working, my web server’s CPU usage rarely goes above 25 percent. Without them, three simultaneous requests from the outside world could saturate my CPU.

With them, my site still isn’t quite as fast as it was in 2000 when it was just serving up static HTML, but it’s awfully close. And it’s doing a lot more work.

 

Linux kernel 2.6.0 is in Debian Unstable

Fresh on the heels of the Linux Kernel 2.6.1 release, Kernel 2.6.0 made it into Debian Sid (unstable). I haven’t tried it yet, as I messed things up on my main Linux box when I tried to upgrade to a pre-release version of 2.6.
I really ought to put a Linux partition on my Athlon system and upgrade it to Debian Unstable with a 2.6 kernel.

For those of you who currently have a working Debian box, it might be apt-get upgrade time. See why I like Debian? You can upgrade to all the latest stuff with, at worst, two commands: apt-get update and apt-get upgrade, or apt-get update and apt-get distupgrade. No chasing down RPMs and dependencies, no waiting around for stuff to compile and wondering if it’ll work on your system. It lets you be cutting edge, yet conservative.

Easy and secure remote Linux/Unix file transfers with SCP

Sometimes you need to transfer files between Linux boxes, or between a Linux box and some other box, and setting up Samba or some other form of network file system may not be practical (maybe you only need to transfer a couple of files, or maybe it’s just a one-time thing) or possible (maybe there’s a firewall involved).
Well, you should already have SSH installed on your Linux boxes so you can remotely log in and administer them. On Debian, apt-get install ssh sshd. If you’re running distro based on Red Hat or UnitedLinux, you may have a little investigative work to do. (I’d help you, but I haven’t run anything but Debian for 2 or 3 years.)

The cool thing about SSH is that it not only does remote login, but it will also do remote file transfer. And unlike FTP, you don’t have to stumble around with a clumsy interface.

If you want to transfer files from a Windows box, just install PuTTY. I just downloaded the 240K PSCP.EXE file and copied it into my Windows directory. That way I don’t have to mess with paths, and it’s always available. Make sure you’re downloading the right version for your CPU. The Windows NT Alpha version won’t run on your Intel/AMD/VIA CPU. Incidentally, Putty.exe is a very good Telnet/SSH client and a must-have if you’re ever connecting remotely to Unix/Linux machines from Windows.

SSH includes a command called SCP. SCP works almost like the standard Unix CP command. All you to do access a remote file is append a username, followed by the @ sign, and the IP address of the remote server. SCP will then prompt you for a password.

Let’s say I want to move a file from my Linux workstation to my webserver:

scp logo.jpg root@192.168.1.2:/var/www/images

SCP will prompt me for my password. After I enter it, it’ll copy the file, including a nice progress bar and an ETA.

On a Windows machine with PuTTY installed, simply substitute the command pscp for scp.

I can copy the other way too:

scp root@192.168.1.2:/var/www/index.php .

This command will grab a file from my webserver and drop it in the current working directory.

To speed up the transfers, add the -C switch, which turns on compression.

SCP is more secure than any other means of file transfer, it’s probably easier (since you already need SSH anyway), and since it’ll do data compression, it’s probably faster too.

FTE – a DOS-style editor for Linux

I don’t remember what I was looking for, but I found another DOS-style editor for Linux and Unix.

FTE is another editor that harkens back to the look of the typical DOS app of about 10 years ago, similar to SETEDIT. For casual editing, either program will do very nicely, and provide a look and feel comparable to the editor that came with DOS 5 and 6.

I’ve always liked SETEDIT, but it suffers from the same identity crisis as emacs. Is it an editor? An MP3 player? A desk calculator? All of the above? And while it’s workable over a remote terminal connection, it’s not as snappy as I’d like.

FTE is a little sluggish from afar but faster. I like how it gives me the ability to have multiple files open and deal with large blocks of text, and continue to use the same key sequences I’ve known and been using since early high school. Its syntax highlighting is definitely a nice feature. It takes that feature a bit further than SETEDIT. For example, it highlights the corresponding closing bracket when you move over the opening one.

FTE’s main advantage is that it’s already bundled with some distributions. There’s a Debian project page for it. And a Google search turns up anectotal evidence that it comes in recent versions of Suse, Red Hat and Mandrake as well. If you’re a DOS veteran who’s not enamored with vi or emacs, FTE’s probably worth a look.

For what it’s worth, I typically use nano, but FTE is definitely a whole lot more powerful.

Who wants to build an MP3 jukebox when you can go shopping?

I was going to cannibalize a computer to turn into a Linux-based MP3 jukebox–I figure get the OS up and going on it and figure out later what software to run on it. It’ll take me a while to get the sound card and wireless NIC working in it, I’m sure. Especially in Debian. If it turns out to be too much of a struggle, I can cave and run Red Hat or SuSE on it since they’re likely to just autodetect the stuff. And then I’ll be a Linux wimp, yeah, but hey, I’ll be a Linux wimp with a really cool sound system.
I ended up going to the store. A couple of stores. I needed vitamins and shampoo and fabric softener. It was really weird hearing “A Letter to Elise” by The Cure as background muzak in Kmart. Not that I was complaining.

I also wanted that Plumb CD I asked about yesterday. I could have saved some money by ordering it online, but I was impatient. It had a once-in-a-lifetime song on it and I wanted it. It was a longshot but I looked. Nope, no Plumb at Kmart. Just Newsboys and DC Talk–the kind of stuff my post-college girlfriend Rachel tried to get me into in 1997. I know a lot of people like them but I just couldn’t get into them.

I guess for me it was a good sign. As far as secular music goes, if it’s sold at Kmart I probably don’t like it. So I should probably expect the same for contemporary Christian music too.

Best Bait-n-Switch had it. So I got it, hopped in the car, put it in the CD player, and turned the volume up a bit. Maybe it’s just how my brain is wired, or what’s been on my mind lately, but “Real” just resonates. To me, it’s an instant classic, like “Day After Day” by Badfinger or “If You Leave” by OMD or “Love Will Tear Us Apart” by Joy Division.

I’d tell you about the rest of the album but I’ve had that one song on repeat play for most of the night. I think the last time I did that was six years ago with “Want” by The Cure–which turned out to be a smart move, since there wasn’t much else listenable on that particular record.