Posts about Linux

htaccess Subdomain Redirection

August 8th, 2008

My blog is set up as a subdomain to my main site so http://bobpeers.com/blog/ should really serve the content from http://blog.bobpeers.com.

Just recently I noticed that link pointing to my blog directories but accessed through the main site were not returning 404 pages for missing pages. For example a link pointing to http://bobpeers.com/blog/page-not-here would just serve the content from http://bobpeers.com. To force requests to the blog to be server by the subdomain i just added this line to my .htaccess file.

Redirect permanent /blog http://blog.bobpeers.com

Now any request for a page under the blog subdirectory will be permanently (http code 301) redirected to http://blob.bobpeers.com, so for example:

request http://bobpeers.com/blog/2008/08/page
serves http://blog.bobpeers.com/2008/08/page

Encryption Using Gnome Seahorse

August 6th, 2008

After my previous post about GNU Privacy Assistant and not having an easy encryption option built into Nautilus it seems that i didn’t look very far.

Today I researched a bit deeper and installed Gnome Seahorse. Essentially this does exactly what I was looking for.

  • It allows creation of new keys.
  • It recognised already created keys, my pgp key created using GPA yesterday was immediately available.
  • Encrytion, decryption and signing are all built into nautilus either through the file menu or the context sensitive menu when you right click on a file or folder.
  • It actually prompts me for my pgp key passphrase, unlike GPA!

Next I might look into encrypting whole partitions. I know this can be done during the install process using the Anaconda installer with Fedora but from the pages I’ve read it seems that to encrypt a partition after install is considerably harder, plus all the data on the partition is lost during the process so it’s not a simple procedure.

GNU Privacy Assistant

August 5th, 2008

I decided to give GPA a try just to see how easy it is to encrypt files on Linux. The program installed no problem using yum.

# yum install gpa

Upon starting I created a key (when the warning says this takes a while it’s no lie, it took about 5 minutes on my computer but I’ve since read that it’s a good idea to press some keys and move the mouse to generate random data faster) and then encrypted a test file, no problem there.

Next I tried to decrypt the same file but I just got a warning saying ‘Wrong Passphrase’, I understand the warning but the problem is that I never get prompted to enter the passphrase! Looks like I’ll have to learn the command line instead.

It’s also a shame that encryption is not better integrated into the file manager. In Windows it’s certainly very easy to encrypt files from Windows Explorer, even through the context menu, I’d really like to see the same in Gnome.

Fedora 9 No Sound on Flash Videos

August 2nd, 2008

After living with no sound on flash videos since I installed Fedora 9 ( I don’t watch many videos as you may have guessed :-) ) I decided to look for a fix tonight. It turned out to be much simpler than I imagined, I should have done it ages ago!

For reference I had all other system sounds but the controls on the playback page of the Pulse Audio Volume Control just flickered.

Just install libflashsupport as root and you’re good to go.

# yum install libflashsupport

Found on this page, http://clunixchit.blogspot.com/2007/11/firefox-no-sound-on-flash-videos.html.

Using OpenDNS Nameservers on Fedora 9

July 11th, 2008

I decided to switch to using nameservers from OpenDNS just to see if it made a difference compared to my ISP’s nameservers. You don’t need to sign up if you don’t want, you are free to just use their nameservers as you wish (which are 208.67.222.222 and 208.67.220.220).

The main problem is that I use Network Manager to control my network and if you try to edit the connection from Network Manager but still use dhcp then it will, by default, just get the nameservers from your ISP and ignore any other servers you manually add.

Fortunately the solution is very simple. As root open the file /etc/dhclient-eth0.conf (assuming your wired interface is eth0 of course) and add the line as shown.

# vi /etc/dhclient-eth0.conf
prepend domain-name-servers 208.67.222.222,208.67.220.220; #add this line
send host-name "your-hostname";  # temporary RHL ifup addition

Next just restart your network.

# /sbin/service network restart

At this point I could not see my wired connection in Network Manager (the entry was greyed out) so I manually started the interface.

# /sbin/ifup eth0

This brought eth0 up and from then on Network Manager worked fine with the new nameservers. It might just be psychological but browsing does seems slightly faster, just a little bit less delay with each page load. I’ll leave it set up like this for a while to see how it goes, it’s easy enough to switch back at any time but for now I’m very happy.

Fix a Corrupted rpm Database

July 10th, 2008

During my system update yesterday yum would fail with an error containing this text over and over.

rpmdb: PANIC: fatal region error detected; run recovery

My rpm database was somehow corrupted (it’s the first time it’s ever happened to me in 3 years as a Fedora user) but at least the fix is pretty simple, all commands need to be run as root.

# cd /var/lib/rpm
# rm __db.00*
# rpm --rebuilddb
# yum clean all

Supporting Open Source

July 8th, 2008

I try my best to use open source software wherever possible. This usually just means downloading and using software but I’m increasingly trying to buy from companies that actively advertise supporting Linux, for example.

In a recent post I described that I was looking to buy some HomePlug units. I eventually ordered some from a company called Devolo (you can see them here) and one of the main reasons was that on their website that have driver software available for Linux. The units are OS agnostic but it’s nice to see a company put in the effort to allow users of other operating systems to get the full functionality from a product.

In this case I also put my money where my mouth is since they are considerably more expensive than many others available, the Netgear HDXB101 units cost about 400 DKK (80 USD) less.

Since I use Linux so much finding products that support Linux is very important to me, it’s just a pity that so few companies provide accurate information regarding what OS their product supports. Pick up any box in a computer shop and it’s easy to see that Windows XP/Vista symbols along with the Mac icon but rarely do you see any mention of Linux, or any other system for that matter.

This even applies to routers when they simply act as a DHCP server and have a web interface, anyone knows these work fine with Linux but from the packaging you would never know. Even my Synology Diskstation which actually runs Linux doesn’t advertise Linux support!

Companies need to realise that some buying decisions are made on the basis of OS support. Even if Linux only makes up 1% of the OS market share I’m pretty sure those 1% spend well over the average on hardware. I have 1PC, 1 laptop, a network printer, router, NAS device, portable hard disk, plus many other devices, and I’m sure many other Linux users spend well over the average.

Recompiling Virtualbox Kernel Module

July 7th, 2008

If after installing a new kernel you may get an error message when you try to start Virtualbox saying something like ‘The vboxdrv kernel module was either not loaded…’. If you then read the logs the solution is actually written there.

Re-setup the kernel module by executing ‘/etc/init.d/vboxdrv setup’ as root.

Sure enough this command fixes the problem and rebuilds the kernel module for the currently running kernel.

# /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module          [  OK  ]
Recompiling VirtualBox kernel module       [  OK  ]
Starting VirtualBox kernel module          [  OK  ]

Diskstation Won’t Shutdown Over SSH

July 3rd, 2008

I’ve also discovered that my Diskstation no longer shuts down or reboots when the commands are issues over an SSH connection. There’s a thread on the Synology forum describing the same problem, it seems to be the 0637 firmware that’s causing this.

The Diskstation stays running but refuses all connection via http, SSH, cifs or any other method. The only way to fix is to turn it off using the button on the front panel.

I’ll download and install the 0640 firmware tonight and see if it fixes the issue.

Update - Just installed the 0640 firmware and it still doesn’t work, it’s also a bit hard to debug since the SSH connection is lost so you’re working in the dark.

Diskstation Modding

July 2nd, 2008

After getting SSH working on my Diskstation DS-106e so I can log in using a public/private key I’m thinking about installing the GNU screen program. This is incredibly useful as it allows a single terminal to host multiple sessions so you can, for example, start a session to download a large file and then open a new session and continue working. Even more so over SSH as you only get one terminal per SSH connection so it avoids opening multiple SSH connection just to run multiple commands.

You can also detach the sessions, log off from the SSH session and then later log back on, reattach the session and continue from where you left off. It’s really useful for long running tasks that you need to monitor.

There’s a great Red Hat Magazine article showing the basics plus how to set up a .screenrc config file to automatically start sessions or add a status bar to the bottom.

The only other option is to use the nohup command but this does not allow for monitoring progress of a program.

The main problem is that to install screen I need to first install bootstrap but like many people I’m slightly afraid of bricking my Diskstation.

Maybe I’ll add this to the Synology feature request forum in the meantime.

Diskstation Port 80 not responding

On a related note if I enter the admin pages for my Diskstation and enable https connections then my Diskstation no longer listens on port 80, I’ll have to look into this more when I have the time.