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

Add a comment

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

Add a comment

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

4 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

Add a comment

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