Enable Sendfile Off – Apache Config Headache

Posted November 14th, 2009. Filed under Code

I’ve been working on setting up a VM running a LAMP stack along with ColdFusion 9  (which I’ll blog about soon).  I’ve got everything up and running and was tinkering around making some updates to our TACFUG site but was running into this weird issue that my CSS would not update – I would make a change and it wouldn’t show up in the browser.

I disabled all my browser cache and tried it in Chrome – same issue. I tried adding a UUID to the CSS call to force the browser to reload.

Then I thought it might be a ColdFusion issue so I spent some time in the Administrator turning all the options on/off (lots of new stuff in CF9!).  That didn’t work either.

Finally I pinged Twitter and John Mason helped me figure out that it was actually an Apache issue. His first thought was it was some caching module but looking in mods-enabled I didn’t see anything cache related. We were both searching on Google and found a few posts where people had similar issues and mentioned adding a line to their config file:

Enable Sendfile Off

I have no idea what this does – but I opened up my apache2.conf file, scrolled to the bottom and added it.  Restarted Apache and my CSS was now refreshing!

The Apache docs mention that in some circumstances you may need to disable this:

This directive controls whether httpd may use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file — for example, when delivering a static file — Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it.This sendfile mechanism avoids separate read and send operations, and buffer allocations. But on some platforms or within some filesystems, it is better to disable this feature to avoid operational problems:

  • Some platforms may have broken sendfile support that the build system did not detect, especially if the binaries were built on another box and moved to such a machine with broken sendfile support.
  • On Linux the use of sendfile triggers TCP-checksum offloading bugs on certain networking cards when using IPv6.
  • On Linux on Itanium, sendfile may be unable to handle files over 2GB in size.
  • With a network-mounted DocumentRoot (e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache.

For server configurations that are vulnerable to these problems, you should disable this feature.


So hopefully this will prevent someone from going through the same headaches I did.  Now I have to get busy now that everything is working!

Beware Ubuntu 8.10 “Cruft Remover”

Posted October 31st, 2008. Filed under Code Linux
Ubuntu 8.10 Cruft Remover

Ubuntu 8.10 Cruft Remover

Updated my Ubuntu to 8.10 this week and have been poking around the new features.

Yesterday I found “Cruft Remover” under the System > Administration menu.  I assumed it was something similar to CCleaner on Windows. CCleaner scans your system and finds UNused items which are safe to remove.   Unfortunately the Cruft Remover tool itself provides no information or help only a “Cleanup” button which I gleefully pressed.

Unfortunately it appears to have deleted several apps I use regularly. Oops.

VirtualBox? Gone.
Air/Twhirl? Gone.

Not sure what else is missing.  But they definately need to improve the usability of this tool.  So if you have upgraded – beware of Cruft Remover!

Flex, Air Updates For Linux

Posted March 31st, 2008. Filed under Code Linux

This weekend I downloaded the Flex Builder Linux alpha, but ran into some issues and after digging around in the forums it was hinted that a new release would be out ’soon’. Soon turns out to be this morning. Alpha 3 was released today! I’m looking forward to getting home and trying that out!

I also saw on Sean Corfield’s blog that an alpha release of Air for Linux is out too! Sean’s post also pointed to this nice article on Read Write Web discussing Flex and Air on Linux. The article had this nice tidbit:

In addition to AIR and Flex releases for Linux, Adobe announced that it had joined the Linux Foundation in an effort to help “accelerate the growth of RIA technologies on the Linux platform.”

Windows Required. VirtualBox To The Rescue.

Posted March 27th, 2008. Filed under Code Linux

I recently purchased a GPS (Garmin 2610) to tote around on motorcycle trips. If you have never tinkered with one – it is VERY cool. Unfortunately the MapSource software that comes with it requires Windows… Ugh.

I’ve run VMWare and QEMU on my Ubuntu box before. VMWare was very nice but a pain to install (granted it’s been awhile so that may have improved). QEMU was very fast but recently it’s been a bit flaky and this time when I tried to run Windows it wouldn’t find my USB mouse. I dug around online but was unable to fix it. I’ve heard about VirtualBox for awhile now and decided to give it a try.

While VirtualBox is free – I did notice they were recently acquired by Sun and now it appears they have two versions: one closed and one open-source. So far I’m very impressed. I ran into some issues installing the OSE version from the Ubuntu repositories. Downloading the .deb file from the VirtualBox site worked much better. Installation went well and I installed Windows XP without a hitch. And most importantly everything works – mouse, keyboard, internet, etc.

So if you are looking for a VM – check it out – they have an extensive list of supported platforms and Linux, Windows and Mac are all supported in one flavor or another. Lifehacker did a recent article covering installation and running Windows apps seamlessly on the Ubuntu desktop.

ColdFusion Batch Scripts – For Linux

Posted January 25th, 2008. Filed under Code Linux

I always set ColdFusion to NOT run at startup - why have it eating resources when you aren't using it? On Windows I had a few batch scripts to easily kick off ColdFusion. I dug around looking for something similar for Linux... I found a few things which I've added to my wiki in the ColdFusion section.

I basically came up with a very simple bash script:

CODE:
  1. #!/bin/bash
  2. read -p "Press ENTER to start ColdFusion and Apache (must be root!)"
  3. /etc/init.d/apache2 start
  4. /opt/coldfusion8/bin/coldfusion start
  5. read -p "Services started. Press ENTER to continue..."

Save this to a cfstart.sh file or something. Give it executable rights. Then it's just 'sudo ./cfstart.sh'. And of course you can make the same thing to stop the services. I'm running Ubuntu 7.10 so if you are on something different (RedHat) you'll have to change your paths, etc...

Ubuntu, NVIDIA and Two Monitors

Posted January 22nd, 2008. Filed under Code Linux

Ever since I've been using two monitors at work I've wanted to setup two monitors at home but finances are tight and I just can't afford another flat screen. But this weekend I did dust off my daughters old 17" CRT and tried to get it working with my Dell widescreen. I knew the latest Ubuntu had made advances in setting up monitors but I was also familiar with hacking on xorg.conf so I wasn't too concerned with screwing anything up. I backed up my xorg.conf and started tinkering.

NVIDIA Settings dialog I originally messed with Ubuntu's native screen controls but they were having no effect. After a bit of digging I discovered if you are using the 'restricted' NVIDIA drivers (which I was) there is another application for tweaking settings - nvidia-settings. This was a bit confusing. Which one to use? (Ubuntu should check to see if the NVIDIA drivers are installed and if so disable the native screen tools.) The NVIDIA application provided a nice dialog - both screens were showing - but at incorrect resolutions. I tweaked a few things - saved, restarted my session. Nothing happened. The CRT was working but my Dell widescreen was doing nothing. I tried a few more things and got frustrated so I hit the Ubuntu forums. Lots of threads on there about running dual head but no real silver bullet solutions. One suggestion did mention running the settings application as sudo. I tried that and things started to work. After a bit more experimentation I got the following modes to work.

Twinview Twinview - this is a NVIDIA setting. It basically takes your current desktop and 'stretches' it across both monitors. This would probably work OK if both monitors were the same size and resolution but since mine were different - it was a bit odd to work with. I could also not 'contain' my applications to one screen. If I maximized a window - it would stretch across both monitors. Not ideal.

X-w/compiz Next I turned off Twinview and enabled Xinerama.

Xinerama is an extension to the X Window System which enables multi-headed X: applications and window managers which use two (or more) physical displays as one large virtual display.

This worked but oddly enough some applications (like terminal and Gnome Do) would not start. After tinkering a bit I discovered the fancy new compositing window manager Compiz wasn't running. Why? I have no idea. But overall this was the most "Windows" like setup. I could drag running applications between screens but if I maximized an application it would contain itself to one monitor. But without Compiz running the system was unusable. If I can get Compiz running in this mode I'll be happy.

X w/no compiz Finally I removed the Xinerama setting and just set configured two X sessions. This gave me two independent desktops. I had two taskbars, two desktops and while I could drag and drop icons and files between the two screens I could not open an application on one desktop and move it to the other. This works and is what I'm using now but obviously it is not ideal.

I'm going to tinker with the 'restricted' NVIDIA drivers a bit more. If I can't make any progress I may try the drivers from the NVIDIA site itself and see if anything improves. The other alternative is to figure out why Compiz isn't running and fix that.

I've been so happy running Ubuntu it is a shame that getting this setup is so difficult. While I'm happy tweaking things I could easily see others hitting this roadblock and giving up. Hopefully the Ubuntu team will make some progress on tightening up the integration between native Ubuntu apps, restricted drivers and Compiz.

KDE4 Released!

Posted January 11th, 2008. Filed under Code Linux

I know what I'm doing tonight! I've been a long time Gnome fan but KDE has always intrigued me. When I did my latest Ubuntu update I was going to switch but then I found out v4 was just around the corner so decided to wait. Today they officially released KDE4 and it looks good.

Tonight I think I'll backup my /home directory and give it a shot.

Gnome Do – Quicksilver For Linux

Posted December 5th, 2007. Filed under Code Linux

I'm into application launchers.

At work (on Windows) I use Find And Run Robot and have gotten really used to launching applications (and a lot of other neat functionality) with the keyboard. I've been missing the same thing on Gnome at home but tonight stumbled upon Gnome Do it's still fairly immature but so far I've not had any issues with it and it will launch apps, find my bookmarks, and with a few plugins will search my Tomboy notes as well as skim though my MP3 collection in Rhythmbox. Very slick!!! Installation was just a matter of adding a new repository and doing an apt-get install. The author has a blog where you can read a bit more about the project.