Tuesday, February 26, 2008

Overriding Recommends in aptitude install


> When I try and install powersaved using aptitude it wants to install a whole
lot of kde stuff and I don't use kde (I use fluxbox) - am I right in thinking
this could be triggered by a number of programs recommending rather than one
depending on them? - if so - can I ignore the recommendations?
<gsimmons> JohnGH: You can instruct aptitude to not treat recommendations as dependencies by supplying the -R option.
> gsimmons: thank you



# aptitude install powersaved
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
The following NEW packages will be installed:
hdparm{a} kdelibs-data{a} kdelibs4c2a{a} kpowersave{a} libakode2{a} libarts1-akode{a} libarts1c2a{a}
libartsc0{a} libavahi-qt3-1{a} libdbus-qt-1-1c2{a} libjasper1{a} libmad0{a} libopenexr2ldbl{a}
libsamplerate0{a} libvorbisfile3{a} libxxf86misc1{a} menu-xdg{a} powersaved x11-xserver-utils{a}
0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.6MB of archives. After unpacking 74.6MB will be used.
Do you want to continue? [Y/n/?] - kpowersave
The following NEW packages will be installed:
hdparm{a} powersaved
The following packages are RECOMMENDED but will NOT be installed:
kpowersave
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 502kB of archives. After unpacking 2400kB will be used.
Do you want to continue? [Y/n/?]
Writing extended state information... Done
Get:1 http://ftp.us.debian.org lenny/main hdparm 7.7-1 [66.9kB]
Get:2 http://ftp.us.debian.org lenny/main powersaved 0.14.0-8 [435kB]
Fetched 502kB in 3s (135kB/s)
Selecting previously deselected package hdparm.
(Reading database ... 55225 files and directories currently installed.)
Unpacking hdparm (from .../archives/hdparm_7.7-1_i386.deb) ...
Selecting previously deselected package powersaved.
Unpacking powersaved (from .../powersaved_0.14.0-8_i386.deb) ...
Setting up hdparm (7.7-1) ...
Setting up powersaved (0.14.0-8) ...
Reloading system message bus config...done.
Starting power management daemon: powersaved.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done
Building tag database... Done

Thursday, February 21, 2008

How to set the default web browser in Evolution

After reading from:





And trying it out...:



Read existing settings (recursively):



$ gconftool-2 -R /desktop/gnome/url-handlers

Backup settings to a file in case you want to roll back:



$ gconftool-2 -R /desktop/gnome/url-handlers > ~/.gconf/desktop/gnome/url-handlers.default

Get existing setting and type:



$ gconftool-2 -T -g /desktop/gnome/url-handlers/http/command

Set new setting and type



$ gconftool-2 -t string -s /desktop/gnome/url-handlers/http/command "x-www-browser %s"


Check new setting and type



$ gconftool-2 -T -g /desktop/gnome/url-handlers/http/command

Set new setting and type for https



$ gconftool-2 -t string -s /desktop/gnome/url-handlers/https/command "x-www-browser %s"

Done - try clicking on a link now... :-)

Read/Write NTFS support

Just

# aptitude install ntfs-3g

and add something like:


/dev/sda1 /mnt/windows ntfs-3g uid=1000 0 0


to /etc/fstab

and you're done.

I've removed the old posts from 27/12/2004 and 06/08/2006 - this is much simpler and superceeds them.

Mounting VMWare vmdk files in Linux

http://www.jameslittle.me.uk/how-to-mount-vmdk-files-in-linux/

http://ubuntuforums.org/archive/index.php/t-154738.html

Where does the VMWare Player "Recent Virtual Machines" list live?

From
here:

The VMWare Player list of "Recent Virtual Machines" is stored in the file
[drive]:\Documents and Settings\[user]\Application Data\VMWare\preferences.ini



At the bottom of the file, there are entries like (where X is a sequential number):



pref.mruVMX.filename = "..."
pref.mruVMX.displayname = "..."


You can edit the entries here then save the file & start VMWare Player to see the changes. (VMWare Player saves its settings on exit, so will need to be closed before you make the changes, or they will be overwritten.)

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. :-)