Archive for the ‘Linux’ Category

Create an Apache virtual host which will only redirect

Most internet sites are available through multiple domains. The classic case would be example.com and www.example.com. If you want people to only use one of the domains available, you can either let your website check and redirect (not so elegant) or let Apache do the magic.

To accomplish this, you only need to create a new virtual host for Apache. Here’s a simple example of how to move all visits from example.com to www.example.com:

<VirtualHost *:80>
  ServerName example.com
  #ServerAlias example.net www.example.net
  redirect permanent / http://www.example.com
</VirtualHost>

That’s it, from now on, all people who try to reach example.com will be redirected to www.example.com. You can include more hostnames to redirect from by using the ServerAlias directive, in the example above, we’re also redirecting from example.net and www.example.net.

Fixing Firefox/Mozilla update error “update.locale file doesn’t exist…”

I’m currently developing a Firefox addon and also created a system for providing updates for that addon. But somehow, Firefox never automatically checked for updates, as it used to do, I always had to start the update process manually. At the same time, the error console spit out these warnings:

[Exception... "update.locale file doesn't exist in either the XCurProcD or GreD directories"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: file:///usr/lib/xulrunner-1.9.1.0/components/nsUpdateService.js :: getLocale :: line 549"  data: no]
Source: file:///usr/lib/xulrunner-1.9.1.0/components/nsUpdateService.js

This appears to be a bug in the 1.9.1 version of Xulrunner, as it affects all kinds of Linux distributions. The easiest way to fix it, is to create an empty update file in the appropriate dir. Here’s the command you need to exec as root to fix the problem on openSUSE:

touch /usr/lib/firefox/update.locale

Afterwards, the update system will work again and the exceptions dissapear.

Fixing linux driver problems for Tevii S660 (compile error + wrong firmware)

I recently downloaded the latest driver for the Tevii S660 (filename is 100302_linux_tevii_ds3000.rar) and ran into some problems compiling it. They might be related to the current condition of my system, which is crappy, but I’ll post some hints anyway. Here’s what I ran into: In contrast to the earlier versions I used, the box is now handled by a module named dvb_usb_dw2102. I still tried to modprobe teviis660, which doesn’t exist anymore. On my kernel (2.6.27, openSUSE-patched), the file em28xx-cards.c would not compile, as it contained an undeclared struct for some Leadtek board. Commenting out the lines 2460-2463 worked in my case. The module dw2102 uses the same code to handle the S660 and the S630, so it also tries to use the firmware of the S630 for both cards, which did not work in my case. Here you’ve got two options: Either change the code (file dw2102.c, line 1413) or create a symlink from /lib/firmware/dvb-usb-teviis660.fw to /lib/firmware/dvb-usb-s630.fw, so the right firmware gets loaded anyway. In both cases, you’ll probably won’t be able to use a S660 and a S630 on the same machine.

Wrong hyphenation in Texlive on openSuSE

Today, I was wondering, why pdflatex created so many bad boxes and really bad looking pages. Scrolling to the top of the messages generated by Kile, I found the following two warnings:

Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `German'
(babel)                I will use the patterns loaded for \language=0 instead.

and

Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `ngerman'
(babel)                I will use the patterns loaded for \language=0 instead.

Which meant, that for some reason, no hyphenation patterns for the german language I selected were loaded.

I first of all checked, whether I needed to install some language specific Texlive package, but on openSUSE, this is not the case. After searching around for some time, I found the following solution: Open the file /etc/texmf/tex/generic/config/language.dat and add the following two lines at the end:

ngerman dehyphn.tex
german dehyphn.tex

Afterwards, run the following command as root:

fmtutil-sys --all

Now, hyphenation patterns for the german language should work again. This will probably work out for other languages as well, you simply have to substitute the name of your language.

Update

I believe the problem has been solved, as the info text on a recent Texlive update for OpenSUSE stated. So if you’re experiencing this problem, make sure your system is up to date.

Turn dynamic page into static page using wget

If you’ve got a page, which is based on some CMS, Wiki, Blog or else, but which you want to keep online for the sake of history only, you can use wget to create a static copy of that page, removing any dynamic code, which saves you the hassle of updating the underlying system.

Here is an example for mirroring the domain example.com into the directory /home/you/example.com:

wget -nc -nH -E -r -k -P /home/you/example.com -np http://example.com/

wget will save all pages with an .html extension and adapt the links in every page to the new structure. The only problem I had were missing images referenced from CSS files, but you can simply copy those manually.

Helpful Key Sequences

SSH

  • Quit a hanging SSH session: Press Enter once and then immediately ~.
    This will terminate the session directly without prompting you first.

Telnet

  • Aborting a hanging telnet session: Ctrl+AltGr + }
    Afterwards, you will see the telnet prompt. Type quit and hit enter to get back to the shell
Return top