Wednesday, February 20, 2008

grub error: /dev/sda does not have any corresponding BIOS drive

On an IBM Thinkpad T43 the Debian install refused to install grub or LILO.



When I tried to run it from the command line:



# grub-install hd0

it returned:



/dev/sda does not have any corresponding BIOS drive.



I tried changing the partition sizes so that they ended on cylinder boundaries - wondering if it was that - but it wasn't.



What I needed to do to fix it was to go into the BIOS settings and disable the legacy floppy support (I don't have a floppy drive, so don't use that)



The clue that tipped me off was lots of repeating errors in dmesg about fd0 each time I ran grub-install - and the fact that it would go away and wait for 10 or 15 minutes or more.



The things I had to do were:



# mkdir /boot/grub

# grub-install --no-floppy --recheck hd0

( this created /boot/grub/device.map )



# update-grub

(this created /boot/grub/menu.lst)

Monday, February 18, 2008

DIY VMWare Linux Image

Like using VMWare Player, but can't find the image you want, or they're too big to download quickly?

This is how to get a working Debian box in VMWare without burning a CD:

I found:

http://whiletrue.nl/blog/?p=61

and:

http://www.sqlservercentral.com/articles/Miscellaneous/useisoimageswithoutburningtodisk/1369/

All you need to do is download the blank VMX from:

http://www.mediafire.com/?bnvmhcghmw3


Which was originally from http://www.boonzaaijer.com/files/BlankVMX.zip
but I don't want to leech their bandwidth by hot linking - all of 4KB ;-)

Unzip it into a folder (I use C:\VMWare\BlankVMX here)

Download the ISO image you want to install from - I'm using the latest NetInst ISO image here:

http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/i386/iso-cd/

and save it (I save it as C:\VMWare\

Change the "Other Linux 2.6.x kernel.vmx" file:

Change the lines:

ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"

To read something like:

ide1:0.present = "TRUE"
ide1:0.fileName = "C:\VMWare\debian-testing-i386-businesscard.iso"
ide1:0.deviceType = "cdrom-image"

Then run the .vmx file - it will boot and launch into your install image as if it had booted off a burned copy of the install CD.

Further reading:

http://www.linux.com/feature/54411

Monday, September 17, 2007

corkscrew (not screwdriver!)

I can't believe I didn't have a post about corkscrew already!

This is a great link:

http://www.mtu.net/~engstrom/ssh-proxy.php

install corkscrew via apt (synaptic/aptitude/apt-get whatever)

Edit your ~/.ssh/config file:


Host my.server my.other.server
    ProxyCommand corkscrew proxy.domain.com 8080 %h %p ~/.ssh/proxy_auth
    User remoteuser


in ~/.ssh/proxy_auth put:


username:password


It's a pain if you don't use the Host line because you have to comment the ProxyCommand line when you need to access a local machine (i.e. not through the proxy server)

Talking about proxies... a LONG time ago in another country (oots mon!) I used to use APS - I don't know if I'll need it again, but just in case, there it is.

Friday, September 14, 2007

VMware

I'm using the Debian Etch image from here with VMware Player

To get it to use a UK keyboard mapping I needed to do

loadkeys uk

for console, and

dpkg-reconfigure xserver-xorg
and/or
setxkbmap -layout "gb"

for X.

You also might need to start networking manually, and I exported my proxy details:


export http_proxy="http://proxy-server:port/"


Then ran synaptic - NICE - hadn't used it before.
Upgraded to a 686 kernel from the 486 one, stripped out all the gnome packages and put in fluxbox and wdm instead - it's much faster now.

I also did this

dhclient kept overwriting /etc/resolv.conf so I added this to /etc/dhcp/dhclient.conf


supersede domain-name-servers ns1-ip-address, ns2-ip-address;
supersede domain-name "domain.com";


as per one of the answers here: http://forums.debian.net/viewtopic.php?t=7239

Tuesday, August 28, 2007

Perl scalar assignment

The difference between:


my $var = EXPRESSION;


and


my ($var) = EXPRESSION;


is in whether EXPRESSION returns an array...

Of course in list context an array produces a list of the items in the array, but in scalar context it produces the number of items in the array...

By putting the parentheses around the scalar you are populating an array, and $var is asking for the first element of EXPRESSION if it returns a list, so:


#!/usr/bin/perl

use warnings;
use strict;

my @array = ('a', 'b', 'c');

my $var1 = @array;

my ($var2) = @array;

print "var1: [$var1]\nvar2: [$var2]\n";


returns:


var1: [3]
var2: [a]


Thus if your expression unexpectedly returns an array you at least get some useful value rather than a mysterious number. :-)

Thursday, August 23, 2007

Dumping all param values with mod_perl

It's as simple as:




use strict;
use CGI ( );

my $cgi = new CGI;
print $cgi->header('text/plain');
print "DEBUG:\n", join('', map({"$_: [".$cgi->param($_)."]\n"} $cgi->param)), $/;


From: http://modperlbook.org/html/ch10_01.html#pmodperl-CHP-10-EX-11

Tuesday, August 21, 2007

Using netcat to run a port listener.

If you want to have a port listening on a machine just so another host can test connecting to it (e.g. you want to see whether your "Connection refused" message is caused by your socket application failing to serve, or if it is serving but the connection is being blocked by a firewall)...

First make sure that the application that would normally listen to that port is stopped, then run up netcat:

nc -l -p 1234

where 1234 is the port you want to listen on...

Now from the other host:

telnet hostname.domain.com 1234

where hostname.domain.com is the machine you're running netcat on.

This is a failure:

$ telnet hostname.domain.com 1234
Trying 10.11.12.13...
telnet: Unable to connect to remote host: Connection refused

This is a successful connection:

$ telnet hostname.domain.com
Trying 10.11.12.13...
Connected to hostname.domain.com (10.11.12.13).
Escape character is '^]'.

If you get a connection then the network probably isn't the problem...

Once you're connected you can then either use ^D (<Ctrl-d>) to get out, or use ^] (<Ctrl-]>) to get a telnet prompt, then type close:

$ telnet hostname.domain.com
Trying 10.11.12.13...
Connected to hostname.domain.com (10.11.12.13).
Escape character is '^]'.
^]

telnet> close
Connection closed.

Monday, August 20, 2007

Permanently setting font and theme for gvim

To set the font permanently:

set guifont=Fixed\ 9

or try:


set gfn=fixed
set guifont=courier\ 8


( see http://www.troubleshooters.com/linux/vifont.htm )
( nice: http://www.proggyfonts.com/ )

To set the colour scheme permanently use:

colorscheme

In your .vimrc

(or color )

When in command mode type :help colorscheme for some help on this subject.

and:

syntax on

to make use of it.

(or:)


" have syntax highlighting in terminals which can display colours:
" > if has('syntax') && (&t_Co > 2)
syntax on
" > endif


I also have a post on toggling search highlighting...

Tuesday, August 14, 2007

How do I find the version of my current (running) bash or ksh shell?

If you just want to check from the command line:
bash --version
is OK, but that's not interactive - if you do that you're starting a new bash
which isn't necessarily the same version the current shell instance.

ksh:

In ksh you can display the version of the shell interactively by typing ^V

bash:

In bash you can do ^X^V (C-x C-v)

NB:
This works in set -o emacs.
If like me you prefer to live in the set -o vi world you may need to change to set -o emacs to check it and then back again.

There are also the BASH_VERSINFO array and BASH_VERSION variables

BASH_VERSINFO is immutable so you should be able to rely on it,
but BASH_VERSION could be set somewhere else so don't rely on it.

http://www.gnu.org/software/bash/manual/bashref.html#SEC110
has:

display-shell-version (C-x C-v)
Display version information about the current instance of Bash.

(thanks to jm_ on #debian for help with the research)

Monday, August 13, 2007

How to change the Theme in Firefox

Problem:

You have found a cool Firefox theme on the web and want to download and try it,
but have never used another theme in Firefox before...

You download it and can install it OK, but now how the heck do you switch it on?

You go to Google and search and up comes spam in the form of a www.surveymonkey.com survey, ever so helpfully titled "Firefox Theme Tutorial" asking questions like:

1. Describe your experience with Firefox Themes.
-> I only use the default because I can't figure out how to change them.

2. Would you be interested in a detailed step by step how to guide for (*snip*) Firefox themes?

3. Would you be willing to pay for this guide?

4. How much would you be willing, if any, to pay for this guide?

Just damn cruel when that's the only thing that's in your face when you're looking for help!


OK, so you go to Help in Firefox and search for "theme"... you get:

Add-ons (extensions and themes)
Switching Themes
Using a High Contrast Theme


Hmm... "Switching Themes" is clearly the one I need... *click*:

Switching Themes

To switch between your installed themes, select the Themes panel, select the
theme of your choice, and click its Use Theme button. You need to
restart Firefox for changes to take effect.

Oh great... so I just need to select the Themes panel...
Click "Tools -> Options" - nope, not in there...
Check all the other menus:
File (didn't really think it would be there)
Edit (why would it be there?)
View (COULD be there... nope)
Tools (SHOULD be there, but can't see anything about themes)

the really helpful (NOT!) bit is that without scrolling backwards and forwards in the help page
there's no indication of where you FIND this "Themes panel"!

So after a bit more Googling I went to Intranet Exploder and tried out some of the YouTube tutorials...
(I don't install Flash in my Firefox - because I prefer not to have flash spam in pages...
the only time I start up IE is for something I *need* that uses Flash,
or for broken pages I have to use for work that don't validate and won't work in Firefox)

Yay! the answer \o/
http://youtube.com/watch?v=NvU4D-Buseo
http://youtube.com/watch?v=kykO8J0XA5c
http://youtube.com/watch?v=JjnCIRO9Jg4

I don't think I'd ever used YouTube to learn something technical before - but it certainly works!

In summary - the Themes are Add-ons - as are Extensions...
so the "Themes panel" is found under "Tools -> Add-ons"

I hadn't looked in there because I use Tools -> Add-ons quite regularly (for Extensions)
so didn't bother to look in there because I didn't remember noticing the Themes panel icon before.