Peter's Blog

Redefining the Impossible

Items filed under gentoo


gentoo is a linux distribution based on the principal of compiling everything from scratch. You need to be an alpha-geek to love it. I get most hits on this site from people having the same problems with that made me give up on it.


Filed under: gentoo


Linode looks interesting. It is a hosting service whereby you get a virtual linux box all of your own. It is on a server and it is shared with 40 other people but you get 64M of ram to yourself, 3G of disk space that you partition yourself as you see fit and a selection of linux distributions to choose from. You install linux, have root access and basically can install whatever software you like on it (even painful gentoo compilation). It is like having your own linux box out there on the web.

It can be used not just for a web server but ftp, mail, proxy, DNS server, backup server, you name it. It sounds more interesting than Site5 which gives plenty of power except there is no root access, cannot use wget to get packages, no compiler, two year old version of Python, no fastcgi or mod_python just slow cgi, etc etc. Linode costs $20 or £10.50 a month which is more expensive and the support would not extend to patching your kernel like Site5 would do. Then again, unlike a shared host, if some other tosser you share with uses up all the mysql connections with a flaky script your account does not suffer (happened for the second time to my knowledge this sunday).

I'd be tempted to go with this rather than renew my site5 deal.


2 Comments

I never did get around to trying to install awstats. I've been using Statcounter but I fancied trying awstats with reverse DNS turned on. I can't do this on my Site5 host as they don't like reverse DNS. I didn't install it on Gentoo as that looked like big time hastle.

I realised today that installing awstats under Ubuntu should be as simple as installing the awstats package and it almost is. I can install it on my home server, download my Site5 access logs there and let awstats format them up.

Here are the steps I had to take to install it:

  • Install awstats package
  • Edit a file called /etc/awstats/awstats.hostname.conf where hostname is the hostname. Put something like this in it:
    LogFile="/var/log/apache/access.log"
    LogFormat=1
    DNSLookup=1
    DirData="/var/cache/awstats/"
    DirCgi="/cgi-bin"
    DirIcons="/icon"
    SiteDomain="hostname"
    AllowToUpdateStatsFromBrowser=1
    AllowFullYearView=3
    
  • Make a directory called /var/cache and chmod it 777 so it can be used from the web server
  • Copy icons to web directory:
    cp -r /usr/share/awstats/icon /var/www/icon
    
  • Run this to update databases:
    /usr/lib/cgi-bin/awstats.pl -config=hostname -update
    
  • In your web browser, go to the url:
    http://hostname/cgi-bin/awstats.pl?config=hostname
    
  • Study the stats in quiet awe
  • Edit crontab to update stats automatically every night:
    crontab -e
    0 1 * * * /usr/lib/cgi-bin/awstats.pl -config=hostname -update
    

5 Comments

Installed new linux system on my server. Actually I intend to use it as a TV... anyway I finally decided on a distribution.

Gentoo:

  • previous distribution
  • too much hard work and nursing and random breaking

Knoppix:

  • confused as to whether it is supposed to be installed and used or just booted from live CDs as a party trick
  • worked with my TV card

Redhat:

  • the MS of the linux world. Used 7.1 yonks ago and was not impressed.

Suse:

  • Used for a long time (6.1, 6.3)
  • Slow ftp servers however many years ago
  • Ended up compiling everything as I could never find rpm's

Slackware:

  • First ever distribution I tried, years ago, from a cover disk on a magazine
  • Is it still going?

Ubuntu:

  • related to Gnoppix and Debian
  • very hard to remember the spelling. I think of it as umbongo. Umbongo, Umbongo, they drink it in the congo.
  • tried live CD (600M, 2 hour bittorrent download) and PC went into a constant rebooting loop
  • tried installation CD (600M, 2 hour bittorrent download) and PC went into a constant rebooting loop
  • don't remember a linux installation ever failing so bad.
  • it's boot screen just shows Ubuntu, a logo and a progress bar: I want boot logs.

Finally went back to Debian Woody:

  • It's low level enough for me without the Gentoo level of hastle and constant breaking.
  • I like apt: want to try something? It's installed in minutes.

Filed under: gentoo knoppix linux mp3 ubuntu

2 Comments

I could do with a TV in my computer room. I have my old Gentoo server and a Pinnacle TV card sitting idle. I thought I would try just booting a Knoppix CD and seeing what I got. It booted ok and looking through the multimedia applications I found Xawtv, a TV application. It had a good go at searching for TV channels but it didn't find any. I faffed about for a while, setting up different types of TV card and tuner chipsets, but no joy. It didn't tell me it was broken but it didn't work either, all I got was a black TV shaped window with some noisy coloured pixels at the top. It my well be because of the aerial connection (in fact driven from my Sky Plus box downstairs, via a booster/distributor box) but it's too much hastle to grab a portable TV and check that out.

Knoppix: Works nicely. Possibly a good replacement for Gentoo as long as it has good package support.

Update: spent the afternoon on this and here are the conclusions:

  • The card is a Pinnacle PCTV Rave
  • It uses the MT2050 tuner chip which is not supported by the bttv drivers on the version of Knoppix I am using (17-7-04).
  • Patches exist but not sure they will work on a live CD. I'll try latest Knoppix before installing something properly.

Update:

The tuner works with Knoppix 3.6 (2004-8-16) running the 2.6 kernel (i.e. with the boot option 'knoppix26). The picture is very noisy, looks like a lot of processor noise. I'm thinking of installing properly, rather than just using a live cd. Choice of distribution? Knoppix, Debian, Ubuntu...


Filed under: gentoo knoppix linux sky+ ubuntu


Following my Gentoo disillusionment I got a comment suggesting I tried again. I did and emerge told me this:

!!! Your current profile is deprecated and not supported anymore.
!!! Please upgrade to the following profile if possible:
        default-linux/x86/2004.0

To upgrade do the following steps:
# emerge -n '>=sys-apps/portage-2.0.51'
# cd /etc/
# rm make.profile
# ln -s ../usr/portage/profiles/default-linux/x86/2004.0 make.profile

I've done this and it does seem to have fixed my emerge-ing problems. I'll run an emerge -u world tonight in an at job and see what remains of the system tomorrow.

Moral: if Gentoo breaks after an emerge rsync or emerge-webrsync then someone has broken the portage data. Wait till the next day and try again.

nb: what I really want is just to update my spamassassin filters.

Update: Build died with this:

!!! Error: the sys-kernel/linux-headers package conflicts with another package.
!!!        both can't be installed on the same system together.
!!!        Please use 'emerge --pretend' to determine blockers.

I give up. I just don't have the time or inclination to keep fiddling around. Another rsync might fix it but that's another hour waiting for that to finish.


Filed under: gentoo linux rsync

5 Comments

Trying to emerge today after emerge-webrsync yesterday and getting this:

root@ad-pc root # emerge --pretend griffle

These are the packages that I would merge, in order:

!!! ARCH is not set... Are you missing the /etc/make.profile symlink?
!!! Is the symlink correct? Is your portage tree complete?

I'm fed up with Gentoo, it needs constant nursing and things randomly break. The printer driver died a few weeks ago and none of my kicking has brought it back to life. Ok, it is a high maintenance hackers distribution and I am admitting defeat, I want a lamers out-of-the-box working system.

When/if I get the time I'm changing distribution. I want a fast, compact X-less server system. I'll probably go to Debian Sarge as I liked apt.

Gentoo annoyances:

  • Having to build everything means if you want something you might get it tomorrow if the build doesn't break
  • env-update/etc-update and studying diffs in config files is error prone and tedious
  • emerge generates huge amounts of logging. If I do it in an at job the output emails cause timeouts in squirrelmail and thunderbird takes a few minutes to display them.

Now I think about it, I abandoned SUSE because of the poor rpm support and SUSE's sloooow servers meant I had to build everything.


Filed under: email gentoo linux thunderbird

6 Comments

What with clocks going back last weekend my linux box was an hour and 20 minutes fast. I don't set the clock often enough to remember how to do it so I found this site which has the following summary:

  • Run ``date MMDDhhmmYY'' to set the current system date/time.
  • Type
    /sbin/hwclock --systohc [--utc]
    
    to set the hardware clock.

I have ntpd running but it does not seem to be doing anything for me. Firewall may well be blocked.

Update: don't believe everything you read on the internet. The site above gives the command as:

  • Run
    date MMDDhhmm
    
    to set the current system date/time.

Which for me on Gentoo sets the year to 2000.


Filed under: gentoo linux


I love Python and VIM and I always write the former using the latter. All the scripts I write are GUI-less tools, I don't seem to need GUIs. Something that helps me in this, and todays tip, is the runscript plugin. It does this for me:

  • Maps F11 to mark the python script in the current window as one to execute.
  • Maps F9 to open an 'output' window.
  • Maps F12 to run the script chosen by F11 and dump the output from stdout and stderr in the output window.

So the working cycle is:

  • Open or type out python script
  • Press F11 to mark script
  • Press F9 to open output window
  • Press F12 to run script and see results in output window
  • Edit script
  • Press F12
  • Edit script
  • Press F12
  • etc

I have been using this for a few years. Working like this I don't need GUI's, the output window is all I need to see the script results. I can scroll up and down it or copy text from it.

I've tried PythonWin, IDLE, Boa Constructor, Notepad, Scintilla etc and nothing compares. Because the script is not launched from a GUI environment the script is free to launch it's own GUI in wxPython for example.

The main downside of using VIM as an IDE is that I can't use a debugger: I cannot put breakpoints on lines. I do all my debugging with print statements. I could use the python command line debugger but I've never bothered to learn how.

UPDATE: after enthusing about this script I find that it does not work in text mode Vim on Gentoo linux and possibly others so I've fixed it. The problems were:

  • The path to the executable was hard-wired for windows
  • The "Output window" appears to be called "Scratch" in text mode linux version.
" Vim global plugin for running Python scripts
" Version: 1.1
" Maintainer: Frederick Young <lordfyb@hotmail.com>
" Last change: 2001 Oct 30 
"
"*******************************************************************************
"
" --Pressing the "F12" key will run the Python script in the current buffer
"  
" --Pressing the "F11" key will designate the Python script in the current
"   buffer as the script to run when pressing "F12"
"   
" --Pressing "Shift-F11" will remove the designation performed by pressing "F11"
"   and will allow pressing "F12" to run the script in the current buffer
"   
" --Typing the Ex command "Rs" will also allow you to run a Python script but
"   with the benefit of allowing you to pass up to 20 parameters to the script.
"   
"   Sample syntax...
"
"       :rs -xy 800 600
"
"   The above will run the script in the current buffer or the one designated
"   to run when pressing "F11" and pass to it the parameters "-xy 800 600"
"
" --Pressing "F9" will toggle the display of a buffer containing the output
"   produced when running the Ex command "Rs" or pressing "F12".
"
"   With some minor modifications, it should be possible to run other scripts
"   like perl, vbscript, or even executables compiled with the Ex command
"   "make".
"
"*******************************************************************************


" Change this variable to reflect the path of the Python executable on your
" system.  If your system knows how to find Python then setting this variable
" to 'python' should be enough.  Otherwise, type the complete path to the
" executable.
let s:PathToExecutable = 'python'

" Used to designate the Python script to run when pressing "F12" or typing the
" Ex command "Rs"
let s:mainfile = ""

let s:flag = 0
let @a = ""

" Map keys to function calls
if !hasmapto('<Plug>RunScript')
  nmap <unique> <silent> <F12> <Plug>ExecuteScript
endif
if !hasmapto('<Plug>SetMainScript')
  nmap <unique> <silent> <F11> <Plug>SetMainScript
endif
if !hasmapto('<Plug>ClearMainScript')
  nmap <unique> <silent> <S-F11> <Plug>ClearMainScript
endif
if !hasmapto('<Plug>ToggleOutputWindow')
  nmap <unique> <silent> <F9> <Plug>ToggleOutputWindow
endif

" The main plug-in mapping.
nmap <script> <silent> <Plug>ExecuteScript :call <SID>ExecuteScript()<CR>
nmap <script> <silent> <Plug>SetMainScript :call <SID>SetMainScript()<CR>
nmap <script> <silent> <Plug>ClearMainScript :call <SID>ClearMainScript()<CR>
nmap <script> <silent> <Plug>ToggleOutputWindow :call <SID>ToggleOutputWindow()<CR>

function s:SetMainScript()
    let s:mainfile = bufname('%')
    echo s:mainfile . ' set as the starting program.'
endfunction

function s:ClearMainScript()
    echo s:mainfile . ' is no longer the starting program.'
    let s:mainfile = ""
endfunction

function s:ExecuteScript()
    " Execute script
    if strlen(s:mainfile) > 0
        let @a = system(s:PathToExecutable . ' ' . s:mainfile)
    else
        let @a = system(s:PathToExecutable . ' ' . bufname('%'))
    endif
    "bdelete Scratch
    call s:ShowOutputInBuffer()
endfunction

function s:ToggleOutputWindow()
    if s:flag == 0
        let s:flag = 1
        " pcw
        " silent rightbelow new Scratch
        silent rightbelow new Scratch
        resize 7
        set buftype=nofile
        silent normal "aP
    elseif s:flag == 1
        let s:flag = 0
        if bufexists(Scratch) > 0
            silent! bwipeout Scratch
        endif
        let @a = ""
    endif
endfunction

" Ex command which take 0 or more ( up to 20 ) parameters
command -nargs=* Rs call s:CLExecuteScript(<f-args>)

function s:CLExecuteScript(...)
    let index = 1
    let params = ""
    " Assemble the paramters to pass to the Python script
    while index <= a:0
        execute 'let params = params . " " . a:' . index
        let index = index + 1
    endwhile
    " Execute script (with parameters if provided)
    if strlen(s:mainfile) > 0
        let @a = system(s:PathToExecutable . ' ' . s:mainfile . params)
    else
        let @a = system(s:PathToExecutable . ' ' . bufname('%') . params)
    endif
    "bdelete Scratch
    call s:ShowOutputInBuffer()
endfunction

" Display a buffer containing the contents of register "a"
function s:ShowOutputInBuffer()
    if s:flag == 1
        if bufexists("Scratch") > 0
            silent! bwipeout Scratch
        endif
        silent botright new Scratch
        resize 7
        set buftype=nofile
        silent normal "aP
    endif
endfunction

12 Comments

Created a new hosting account with site5. Impressed so far, 1.5G of storage, PHP, unlimited MySQL databases, auto-install of drupal, fast server, all for $7 a month. Sorry if this sounds like an advert.

My previous blog was hosted on Python Community Server and written using Python Desktop Server. I have a couple of reasons for changing, especially to something I have to pay for (!)

  • My Python Desktop Server install was not the 'official' version, it was a Gentoo package installation and it suffered from a number of little problems that I didn't have time to fix.
  • I've used Drupal at work and on another site and I really like it. Even when I have to drop into the php code I am not totally lost, the code is easy to follow.
  • Drupal is better documented.
  • All my blog entries are stored in a standard database format, not something obscure (heard of metakit ?).
  • I (think) I can set things up so that I can moderate comments. I was getting comment spam and I hate it, it makes me feel violated.
  • Drupal data entry has a cool 'preview' button, with Python Desktop Server it just gets published, complete with formatting errors.
  • Drupal search facilities just work. I never did work out the hack required to add a search to my Python Cumminity Server. The only way to find old posts was using the calendar thing, and that was buggy and did not link every day that had postings.

I could go on and on but the fact is, here I am.

ToDo list:

  • Create nice custom theme
  • Upload old blog

1 Comment

For a while now my emerges have all been reporting an error:

--- !found obj /usr/share/doc/gcc-3.3.2-r5/i686-pc-linux-gnu/libstdc++-v3/html/e xt/lwg-defects.html Traceback (most recent call last):   File "/usr/bin/emerge", line 2605, in ?     unmerge("clean", "world")   File "/usr/bin/emerge", line 1852, in unmerge     retval=portage.unmerge(mysplit[0],mysplit[1],portage.root,mysettings,unmerge _action not in "clean","prune")   File "/usr/lib/portage/pym/portage.py", line 2494, in unmerge     mylink.unmerge(trimworld=mytrimworld,cleanup=1)   File "/usr/lib/portage/pym/portage.py", line 5318, in unmerge     mymd5=perform_md5(obj, calc_prelink=1)   File "/usr/lib/portage/pym/portage.py", line 2485, in perform_md5     return perform_checksum(x, calc_prelink)[0]   File "/usr/lib/portage/pym/portage.py", line 354, in perform_checksum     return fchksum.fmd5t(filename) IOError: Errno 5 Input/output error: '/usr/share/doc/gcc-3.3.2-r5/i686-pc-linu x-gnu/libstdc++-v3/html/ext/lwg-active.html' 

This error occurred at the end of emerge when it was trying to delete old packages so it was not too bad (it had already installed the new stuff).

Looking it detail, it transpired that the file in question, lwg-active.html, indeed is corrupt: catting it gives an IO error as well.

Deleting the file and running 'emerge clean' carried on past this until it found another corrupt file. In all about 20 files gave this error, mostly files called Changelog*.gz in various directories.

Next task is to run 'reiserfsck' but that involves booting from a floppy or CD and mounting the drive read only. fsck gives no errors. Depending on what reiserfsck says do I:

  • change filesystem
  • change hard disk

I cannot live with an unreliable file system. I'd rather use FAT.


Filed under: gentoo linux

1 Comment

Logrotate started failing with this error:

 

error
syslog-ng:7 duplicate log entry for /var/log/messages

The cause was subtle. The logrotate.conf file includes all files in the logrotate.d dir. One of the entries in this directory was syslog-ng which did logrotate on /var/log/messages.

One of my Gentoo emerge --updates had created another file called ._000cfg-syslog-ng (or something similar, I've deleted it now) ready for env-update to merge with the current config. However, env-update didn't delete this file, leaving me with two files trying to logrotate /var/log/messages. Logrotate is clever enough to check all entries for duplicates before doing anything. I compared the two files and there are only differences in the cvs headers.

Lessons Learned:

  • env-update is flaky
  • check for random hidden files scattered about.

Filed under: gentoo linux

2 Comments

I've set up an exim forward script to allow me to submit photo blog articles from my mobile. I'm typing this post into my new mobile.

The pc on the left is the gentoo server and on the right is the windows box. Fascinating huh? The windows box is clad in it's shiny new case.

I'll post the scripts later. I don't really want to type them into the phone.



I've set up an exim forward script to allow me to submit photo blog articles from my mobile. I'm typing this post into my new mobile.

The pc on the left is the gentoo server and on the right is the windows box. Fascinating huh? The windows box is clad in it's shiny new case.

I'll post the scripts later. I don't really want to type them into the phone.



Two Gentoo servers, one at work, one at home. The one at home seems fine, perfectly stable. The one at work has a problem where once every few days a few deamons will drop dead: syslog-ng, cupsd, apache, atd, cron etc. It is not always the same pattern of daemons and I'm having trouble working out the problem.

More often than not the first sign is that syslog-ng stops logging to /var/logs/messages. It may be tied up with cron running logrotate and the htdig indexer. Logrotate is set up with the standard config script for syslog-ng and I've checked the Gentoo CVS to make sure that it is up to date and I've run it from the command line with no ill effects.

My suspicion is that it is tied up with htdig indexer for a few reasons:

  • I'm not running it at home and home pc is ok.

  • When it runs it can tie the pc up heavily for a few seconds, long enough for IMAP clients to complain about loss of connection.

  • CRON keeps sending me error messages like this:

     /usr/bin/rundig: line 53: 11495 Aborted                 $BINDIR/htnotify $opts 

Because it happens so infrequently I am waiting for the next occurence to do another post mortem.

I'd say Gentoo was hard work.

I think I did an emerge -u world last night but the at daemon hasn't sent me any mail. It seems to have happened because emerge --pretend -u world gives a different list compared to before.

The list of updated files includes vixie-cron and syslog-ng so it is worth doing.


Filed under: apache gentoo imap linux

2 Comments

Using Bit Torrent to download the lastest Knoppix CD. It's coming down at about 60KB/s which is as high as I ever see. It's uploading at 8k/s so I'm doing someone a favour.

It is intersting in that it is a python application. It normally uses wxPython for it's gui and it installs only the following files:

  • bittorrent.ico
  • btdownloadgui.exe
  • datetime.pyd
  • library.zip
  • LICENSE.txt
  • python23.dll
  • redirdonate.html
  • select.pyd
  • uninstall.exe
  • w9xpopen.exe
  • wxc.pyd
  • wxmsw24h.dll
  • zlib.pyd
  • _socket.pyd
  • _sre.pyd
  • _ssl.pyd
  • _winreg.pyd

Interesting, just the dll's that are necessary. It does make it big though, this lot adds up to 10M, mostly unused library code.

The source includes a headless version that runs a treat on the Gentoo box so I have no qualms about leaving it running to upload to my peers. There is a Gentoo ebuild for bitTorrent but that has a whole lot of dependencies, including gtk and wxPython, which it wanted to build from source.

Interesting, just the dll's that are necessary. It does make it big though, this lot adds up to 10M, mostly unused library code.

The source includes a headless version that runs a treat on the Gentoo box so I have no qualms about leaving it running to upload to my peers. There is a Gentoo ebuild for bitTorrent but that has a whole lot of dependencies, including gtk and wxPython, which it wanted to build from source.


2 Comments

I've been looking around the options for dynamic web content recently for various projects. One of them is to be hosted under IIS, the other I can do with as I please. The IIS based one required a CMS so that many people can add content. The original request was for something that used ASP, VBScript and Access databases and was not .NET. I searched around and found nothing suitable. Widening the search I came across Drupal which seemed to fit the bill except that it was PHP and MySQL.

At about the same time I was considering this I came across the PHP EasyWindows Installer which installs PHP as a CGI engine which is cool enough, I don't think I have to worry about high volume traffic.

So I installed it and MySQL on Windows XP and it runs a treat. The pages are server up quite swiftly and the package looks quite powerful. It looks nicely designed: a clear segragation between content (all stored in the database) layout (a single, nicely laid out template file that builds all the pages on the site, easily edited in HTML-Kit) and formatting (.CSS).

I'm still exploring it but it is looking suitable for my needs and the person I am doing it for has agreed to install PHP and MySQL on his windows box. I'm not reluctant to learn PHP although I find that after python all the $s in the code look like noise: not as bad as perl (from which it is distantly related) but nearly so. The drupal source that I have looked through is quite clean. There is not a great deal of documentation but that is par for the course. I might not even need to write any PHP, I've found modules to do most of the things I want.

One nice thing about Drupal that Python Desktop Server is lacking: a button to preview messages before submitting them.

For my other project I am looking into a way to present email archives on a web site. I've looked through various options, none of which appealed:

HyperLink

Crude presentation, no Gentoo ebuild.

MHonarch

Gentoo package failed to emerge

Macho

Nice presentation but an embarrasing name to search for on the net and also written in lisp (((ugh))). I don't really want to install yet another language and I certainly don't want to learn lisp.

Mailman

GNU list manager thing which includes a modern version of PiperMail which was what I wanted (python email->web code). I installed it but was boggled by the complexity so I uninstalled it quick. Life is too short. There are various other list managers I could hack on but it's a matter of finding the small part for presenting the archives amongst the rest of it. Plus I need to be sure they can handle multiple addresses, CC's, attachments, html mail etc.

Mod_Python

So I gave mod_python a whirl. It installed easily enough but I soon ran into a problem whereby if I generated too much HTML (two or three pages) then I'd get a segmentation error and no response from Apache. It's probably another Gentoo version mismatch problem but I didn't want to get involved so I ditched mod_python.

I finally decided upon python CGI. This was easy to set up and gives me total control. No learning curve beyond the cgi module and I can use the IMAP library to access my email.

I've been looking around the options for dynamic web content recently for various projects. One of them is to be hosted under IIS, the other I can do with as I please. The IIS based one required a CMS so that many people can add content. The original request was for something that used ASP, VBScript and Access databases and was not .NET. I searched around and found nothing suitable. Widening the search I came across Drupal which seemed to fit the bill except that it was PHP and MySQL.

At about the same time I was considering this I came across the PHP EasyWindows Installer which installs PHP as a CGI engine which is cool enough, I don't think I have to worry about high volume traffic.

So I installed it and MySQL on Windows XP and it runs a treat. The pages are server up quite swiftly and the package looks quite powerful. It looks nicely designed: a clear segragation between content (all stored in the database) layout (a single, nicely laid out template file that builds all the pages on the site, easily edited in HTML-Kit) and formatting (.CSS).

I'm still exploring it but it is looking suitable for my needs and the person I am doing it for has agreed to install PHP and MySQL on his windows box. I'm not reluctant to learn PHP although I find that after python all the $s in the code look like noise: not as bad as perl (from which it is distantly related) but nearly so. The drupal source that I have looked through is quite clean. There is not a great deal of documentation but that is par for the course. I might not even need to write any PHP, I've found modules to do most of the things I want.

One nice thing about Drupal that Python Desktop Server is lacking: a button to preview messages before submitting them.

For my other project I am looking into a way to present email archives on a web site. I've looked through various options, none of which appealed:

HyperLink

Crude presentation, no Gentoo ebuild.

MHonarch

Gentoo package failed to emerge

Macho

Nice presentation but an embarrasing name to search for on the net and also written in lisp (((ugh))). I don't really want to install yet another language and I certainly don't want to learn lisp.

Mailman

GNU list manager thing which includes a modern version of PiperMail which was what I wanted (python email->web code). I installed it but was boggled by the complexity so I uninstalled it quick. Life is too short. There are various other list managers I could hack on but it's a matter of finding the small part for presenting the archives amongst the rest of it. Plus I need to be sure they can handle multiple addresses, CC's, attachments, html mail etc.

Mod_Python

So I gave mod_python a whirl. It installed easily enough but I soon ran into a problem whereby if I generated too much HTML (two or three pages) then I'd get a segmentation error and no response from Apache. It's probably another Gentoo version mismatch problem but I didn't want to get involved so I ditched mod_python.

I finally decided upon python CGI. This was easy to set up and gives me total control. No learning curve beyond the cgi module and I can use the IMAP library to access my email.



My broadband connection suddenly stopped working. This is NTL broadband for the record, using a DLink DI624 Wireless router. All PCs lost connection but could still connect to the router.

The problem turned out to be because the Router had lost the IP address allocated to it from the ISP via DHCP. I pressed the DHCP renew button on the status panel and it all burst into life. Not sure if it's a problem with my new XP setup, deciding to drop the DHCP for me.

I had to manually tell dyndns.org about my new IP address as I don't have my Gentoo box set up to do it. The router should be able to update it automatically but it crashes every time I try to set that up. Hum, maybe they have a new version of the firmware out...


Filed under: di624 gentoo linux ntl

2 Comments

Dixons in town were having a closing down sale so I had a browse. They had a Packard Bell system without monitor for just under £130. It is a couple of year old Athlon 1.7GHz thing with DVD/CDR, 256M and 40G hard disk. It was cheap because it had some kind of traumatic accident and the case was severly bent. They told me it worked and gave me a 6 month guarantee so I bought it.

I have put it's guts into the case of my old desktop pc so it is now more presentable.

Pros:

  • It feels much faster than my old system, and in fact any system i have used.

  • Hopefully it won't lock up randomly like the old one: this is what made me lose confidence in the old system and not want to use it.

  • It has freed up extra 128M memory and a CD/RW for my Gentoo box.

  • I can build a cheap system with the bits left over for my mum. I can set it to PIO mode so it won't crash and it'll still be faster than what she's got.

  • I have a spare Windows XP Home licence

  • I have a spare 80G hard disk to fix my sky plus box with

  • It's got a keyboard with lots of extra functions. I just found a function button where ctrl should be: function+left takes me to line start.

  • Nice mouse

  • Lots of software. Microsoft Zoo Tycoon!

Cons:

  • Not the most high tech motherboard I could have bought (MS 6511). Still, I found a reference for it on the internet easy enough.

  • Only 2 PCI slots: 1 after network card is put in. No ISA (rip).

  • Probably USB 1.1 from it's vintage. I have a USB 2 card to put in but then all the PCI slots are gone.

  • It starts up quite rapidly but it takes 30 seconds to shut down: very annoying when rebooting.

In a nutshell: I'm happy.

A footnote on why I use Windows and Gentoo. I think Windows is a good GUI and Linux is a good server. X apps are just not as slick as windows apps and setting up Windows server software is a nightmare of tree's and property pages (I'm talking Active Directory, Microsoft Exchange, ISS and ISA, I use them at work and I hate them all).



Building Gentoo packages does take a while, even for something simple you have to wait for .configure to run which takes a couple of minutes. To live with this I have learnt a couple of things.

First was the nohup command which works like this:

 nohup emerge huge-package & 

which will build the huge package and dump all the output to a file called nohup.out. This is useful for me if I build using a ssh shell which is likely to disconnect and cause the build to halt. With nohup I don't need to worry about that, the build is disconnected from the login shell.

Next is the at command:

 at 03:00 >>emerge huge-package <CTRL-D> 

This will emerge the huge package at 3am so it should be ready the next day. When the command finishes I get emailed the results. I tried using this last night to build a kernel but I typed:

 make bZImage 

instead of:

 make bzImage 

and it failed, so it'll have to wait for another night.


Filed under: gentoo linux ssh


Installed SilverCity for a pretty syntax highlighted blog.

I fould a Gentoo ebuild for SilverCity here but emerge-ing it just gave a weird error:

 Calculating dependencies \ !!! Problem with determining the name/location of an ebuild. !!! Please report this on IRC and bugs if you are not causing it. !!! mycpv:   /SilverCity !!! mysplit: '', 'SilverCity' !!! psplit:  None !!! error:   unsubscriptable object 

So I downloaded the tar file and used python install instead:

 tar xvfz SilverCity-0.9.5.tar.gz cd SilverCity-0.9.5 python setup.py install 

And as you can see..

print "This worked a treat"

I may be in trouble of Gentoo decides to upgrade python as SilverCity will not be updated automatically.

Installed SilverCity for a pretty syntax highlighted blog.

I fould a Gentoo ebuild for SilverCity here but emerge-ing it just gave a weird error:

 Calculating dependencies \ !!! Problem with determining the name/location of an ebuild. !!! Please report this on IRC and bugs if you are not causing it. !!! mycpv:   /SilverCity !!! mysplit: '', 'SilverCity' !!! psplit:  None !!! error:   unsubscriptable object 

So I downloaded the tar file and used python install instead:

 tar xvfz SilverCity-0.9.5.tar.gz cd SilverCity-0.9.5 python setup.py install 

And as you can see..

print "This worked a treat"

I may be in trouble of Gentoo decides to upgrade python as SilverCity will not be updated automatically.


Filed under: blog gentoo linux python


Georg Bauer commented on my hack P376 yesterday to say:

Georg Bauer commented on my hack P376 yesterday to say:

"your hack has disabled conditional GET completely, so you now pull down feeds every hour fully. This might get you some angry comments if somebody finds out wink"

I decided to investigate further. The problem boils down to this code in DownstreamTool.open_http:

def open_http(self, url, data=None):
    
numheaders = len(self.addheaders)
    
self.isHTTP = 1
    
self.lastURL = self.getTheUrl(url)
    
try:
        
theurl = self.getTheUrl(url)
        
self.message = _('opening url: <a href="%s">%s</a>') % (theurl, theurl)
        
if not(self.force):
            
for h in self.cache._getUrlHeaders(theurl):
                
apply(self.addheader, h)
                
self.message += _('<br>adding Header "%s: %s"') % h
        
urlpieces = urlparse.urlparse(url1">1)
        
url = (urlpieces1">1, url1">1)
        
res = urllib.URLopener.open_http(self, url, data)
        
self.message = self.message.replace('%', '%%')
        
<snip>

It turns out that this code is DIFFERENT to the same code on my old PyDS install although BOTH are supposed to be 0.7.2 (they both say it at the top of the screen). The two lines:

urlpieces = urlparse.urlparse(url1">1)
url = (urlpieces1">1, url1">1)

have been added in the Gentoo version. The problem seems to be that the variable url may be either a simple string or a tuple and the new code is assuming that it is a tuple when it is actually a string. I don't know precisely what the new code is supposed to be doing but taking it out fixes the problem.

Georg mentioned that I am repeatedly downloading articles and I did notice this effect but I was seeing duplicate entries before (particularly from the BBC) so I was accustomed to skipping past them.

Still, why is the PyDS version 0.7.2 in Gentoo different from my old version of 0.7.2 (which came from Georg's debian package)???


Filed under: gentoo linux pyds


I was settling down to my lunchtime RSS trawl when to my horror I found no entries. Going into the PyDS Aggregator configuration I found that all my feeds had failed to download. I got a stack trace out of it which said:

There was an error when downloading the feed
Exception "exceptions.AttributeError: 'NoneType' object has no attribute 'lower'"
/usr/lib/python2.3/site-packages/PyDS/AggregatorTool.py[1560] in updateFeed
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[551] in download
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[364] in _download
/usr/lib/python2.3/urllib.py[181] in open
/usr/lib/python2.3/site-packages/PyDS/DownstreamTool.py[80] in open_http
/usr/lib/python2.3/urllib.py[269] in open_http

I think this one is caused by an incompatability between PyDS 0.7.2 and the version of urllib.py in Python 2.3.3. The function urllib.URLOpener.open_http seems to have changed a lot and it has broken the derived version in DownstreamTool.UrlOpener.open_http.

The quick fix for me was to rename DownstreamTool.UrlOpener.open_http to hide_open_http so that the version in urllib would be used. This worked and I now have 125 items to read.

This fix is obviously a hack, it'll only work for urls that start with 'http' (i.e. all mine), 'file' may still be broken. The proper fix would be to review the differences between the pyds version of UrlOpener and the new urllib version but that is beyond me as I don't even know why pyds has it's own urlopener.

Again it's my fault for using Gentoo and not using PyDS with the 'approved' versions of other libraries.


Filed under: gentoo linux pyds python rss


New server running, sshing to work and it's nice much faster that the old laptop was. It also runs quiter, the old laptop fan did not come on all the time but when it did it was like a vacuum cleaner. Yeah Gentoo.


Filed under: gentoo linux


First post from Python Desktop Server running on my new server under Gentoo. If you can read this then it is working!

I think I'm uncovering a little shortcoming of Gentoo. I had to tweak the source for PyDS to get this running and I cannot install PHP because the build fails.

Does a Gentoo user spend most of their time fixing bugs???


Filed under: gentoo linux php pyds python


I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

def translate(self):
    
visitor = self.translator_class(self.document,
        
section_level=self.section_level,
        
suppress_paragraphs=self.suppress_paragraphs
    
)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

Adding the following line:

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo = visitor.docinfo
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

to:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.visitor = visitor
    
for attr in ('head_prefix', 'stylesheet', 'head', 'body_prefix',
                 
'body_pre_docinfo', 'docinfo', 'body', 'fragment',
                 
'body_suffix'):
        
setattr(self, attr, getattr(visitor, attr))

Hidden in the new form is the line:

self.visitor = visitor

This is not being done in the PyDS version of this function HTMLFragmentWriter.translate:

def translate(self):
    
visitor = self.translator_class(self.document,
        
section_level=self.section_level,
        
suppress_paragraphs=self.suppress_paragraphs
    
)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body = visitor.body
    
self.body_suffix = visitor.body_suffix

Adding the following line:

self.visitor = visitor

to this seems to fix the Wiki problem. Sorry for lack of diffs, patches or whatever. I'm taking baby steps in OSS development.

The Mesh tool is still broken. It gives:

 Exception exceptions.KeyError: '__hash__' File             Line  Function         Source Tool.py          915   process_request  s = tool.index_html(req) MeshTool.py      855   index_html       toolHasSigtool = False NuggetsTool.py   263   __getattr__      else: raise KeyError(name) 

I may look into this some other time. I don't use the mesh tool as I'm not sure what it does.

I've tried the Python Desktop Server package in Gentoo and had problems with the Wiki. Trying to look at a Wiki entry would give an error like this:

 Exception exceptions.AttributeError: HTMLFragmentWriter instance has no attribute 'visitor' File                 Line      Function         Source Tool.py              935       process_request  s = getattr(tool,meth)(req) WikiTool.py          376       show_html        homeTool = self) Tool.py              744       renderText       homeTool=kw.get('homeTool') StructuredText.py    201       renderText       settings_overrides={ core.py              382       publish_string   return pub.publish(enable_exit=enable_exit) core.py              186       publish          self.writer.assemble_parts() html4css1.py         115       assemble_parts   self.partspart = ''.join(getattr(self.visitor, part)) 

(note that I had to force traceback dumping in docutils to get this much detail. I did this by adding self.settings.traceback = 1 to publisher.publish).

Poking around, the problem appears to be with the new version of docutils (which appears to be dev-python/docutils-0.3-r1 0.3.3). The problem is that the code in html4css1.Writer.Translate has changed from:

def translate(self):
    
visitor = self.translator_class(self.document)
    
self.document.walkabout(visitor)
    
self.output = visitor.astext()
    
self.head_prefix = visitor.head_prefix
    
self.stylesheet = visitor.stylesheet
    
self.head = visitor.head
    
self.body_prefix = visitor.body_prefix
    
self.body_pre_docinfo = visitor.body_pre_docinfo
    
self.docinfo =&nbs

Filed under: baby gentoo linux pyds python


I am in the process of installing Gentoo linux on a PC at work and also an old pc at home (the joys of ssh). Over the years I have installed Slackware, Redhat, Suse and Debian but none of those was as complex as installing Gentoo. The handbook is absolutely essential and it is probably best to read it through before starting (tip: install stage 3).

Installation is not just running a setup program, it is down to the basics of mounting file systems, chrooting, untarring, building kernels etc. I have learnt a lot from it and I now think I am competant enough to fix a broken linux system from a boot floppy. I had to install Gentoo this way as the Gentoo CD would not boot and I had to find some linux boot floppies to get things rolling.

Setting it up takes ages as it is building most things from source. The USE preferences variable allowed me to tell it I want perl and python but not ruby. I ran an emerge vim to get vim installed and, to my surprise, I got VIM 6.3 (which I didn't know was out) with python and perl support built in!

I haven't set up X yet. I may do it at home as an exercise but I dread to think how long it will take. You are supposed to be able to install precompiled packages but at my one attempt (lilo) it still spent 20 minutes compiling it from source.

Gentoo in a nutshell:

  • Don't think about it unless you have broadband
  • Don't think about it unless you are happy at a command prompt
  • Don't think about it unless you are patient

    Gentoo: something to do in the background while reading RSS feeds.


Filed under: gentoo linux python rss ssh vim