Hold is a status flag which tells apt (or aptitude) not to automatically upgrade a package.
To hold a package, 'echo pkgname +hold|dpkg --set-selections'
or 'aptitude hold package'
or use = in aptitude's curses interface.
You can ignore a hold by using apt-get install foopkg; or by using ++ in aptitude's curses interface.
[Note that this is *NOT* the same as packages which have been "held back" for dependency reasons.]
Snapshots is an archive that contains all Debian packages uploaded since 2002,
including those removed from the official archives because they were very buggy, unusable, broken, vulnerable or in some way undistributable.
Much of 2004 was lost because of harddisk problems.
See http://snapshot.debian.net/ for more information.
e.g.
dpkg -i /var/cache/apt/archives/sun-java5-bin_1.5.0-14-3_i386.deb /var/cache/apt/archives/sun-java5-jre_1.5.0-14-3_all.deb
aptitude hold sun-java5-bin
aptitude hold sun-java5-jre
Thanks to #debian
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
Tuesday, October 14, 2008
Wednesday, May 28, 2008
Stitching images with ImageMagick
From: http://studio.imagemagick.org/pipermail/magick-users/2002-July/003925.html
Simplified:
If you want to join images side by side:
use:
NB: If they're not photos, you'll want the output to be PNG so it's not lossy.
When you want to join the rows the
Simplified:
If you want to join images side by side:
[ AA.jpg ][ AB.jpg ][ AC.jpg ]
use:
convert +append AA.jpg AB.jpg AC.jpg row_A.png
NB: If they're not photos, you'll want the output to be PNG so it's not lossy.
When you want to join the rows the
+append becomes -append like so:
[ row_A.png ]
[ row_B.png ]
[ row_C.png ]
convert -append row_A.png row_B.png row_C.png all_rows.png
Tuesday, April 29, 2008
Converting seconds to Hours, Minutes & Seconds
It's amazing how many different approaches to doing this you can find on the web.
Some of them are really tortured and inefficient!
These are the tightest two I've found:
To convert the other way, an easy way is to use POSIX mktime:
Some of them are really tortured and inefficient!
These are the tightest two I've found:
#!/usr/bin/perl
#
#
#
use warnings;
use strict;
my $time = time % 86400;
#
# http://www.perlmonks.org/?node_id=101511
#
printf "%02d:%02d:%02d\n",(gmtime $time)[2,1,0];
#
# http://www.perlmonks.org/?node_id=101548
#
printf "%02d:%02d:%02d\n", ($time/3600)%24, ($time/60)%60, $time%60;
To convert the other way, an easy way is to use POSIX mktime:
#!/usr/bin/perl
use warnings;
use strict;
use POSIX qw(mktime);
my $day = "2008-05-28";
my ($d_year, $d_mon, $d_mday) = split /-/, $day;
my $secs = mktime(0, 0, 0, $d_mday, $d_mon-1, $d_year-1900);
Wednesday, April 02, 2008
Showing a function in ksh
If you need to see the contents of a function in ksh...
if you do typeset -f by itself it will list all of the defined functions.
$ typeset -f [FUNCTION_NAME]
if you do typeset -f by itself it will list all of the defined functions.
Monday, March 24, 2008
Sharing your X desktop via VNC
When getting set up to share my Linux X desktop, I found to my temporary confusion, that unlike vncserver on Windows, which of course shares your existing desktop, the vncserver program for X is designed to start a new instance of an X server (possibly even blind to the person on the machine) and share *that* rather sharing your existing desktop, which is probably what you usually need to do!
To share your existing X desktop via VNC requires another tool called x0vncserver.
As far as I know this is only available with vnc4 (realvnc) and not with tightvnc.
To share my desktop, the first thing I needed to do was to create a password file for the incoming user to authenticate against:
The .vnc directory didn't need to exist already, it creates it for you.
It only seems to use the first 8 characters, and then saves that as obfuscated binary data.
Once you have the password file you can launch x0vncserver against it:
and it is ready to accept incoming connections :o)
If the incoming user is using tightvnc or another client that does not support the vnc4 protocol extensions, then you need to tell it to run in vnc3.3 compatibility mode:
You can also get usage help from x0vncserver by running it with any args it doesn't understand:
To share your existing X desktop via VNC requires another tool called x0vncserver.
As far as I know this is only available with vnc4 (realvnc) and not with tightvnc.
To share my desktop, the first thing I needed to do was to create a password file for the incoming user to authenticate against:
$ vncpasswd .vnc/passwd
Password:
Verify:
The .vnc directory didn't need to exist already, it creates it for you.
$ ll .vnc/
total 12
drwxr-xr-x 2 john john 4096 Mar 20 15:28 .
drwxr-xr-x 52 john john 4096 Mar 20 15:28 ..
-rw------- 1 john john 8 Mar 20 15:28 passwd
It only seems to use the first 8 characters, and then saves that as obfuscated binary data.
Once you have the password file you can launch x0vncserver against it:
$ x0vncserver PasswordFile=.vnc/passwd
Thu Mar 20 15:33:32 2008
main: XTest extension present - version 2.2
main: Listening on port 5900
and it is ready to accept incoming connections :o)
If the incoming user is using tightvnc or another client that does not support the vnc4 protocol extensions, then you need to tell it to run in vnc3.3 compatibility mode:
$ x0vncserver Protocol3.3 PasswordFile=.vnc/passwd
You can also get usage help from x0vncserver by running it with any args it doesn't understand:
$ x0vncserver .
Friday, March 07, 2008
suspend to disk on low battery...
I found out why my machine was shutting down at low battery and why I couldn't get it to suspend to disk instead...
Fixed now :o)
You need to look at these files:
I changed these values:
And in:
I now have these:
NB: I put john in the name so it would stick out like a sore thumb when I do a diff if dpkg ever asks me about changed config files on an upgrade and I'll know it's my own modification, and so it didn't conflict with or get overwritten by a provided script.
I created my own script to handle this:
which just has:
And I installed uswsusp which provides /usr/sbin/s2disk
Oh... I also set up a shell function to protect it, because I found I accidentally scrolled back through my shell history and hit enter on s2disk a couple of times ;o)
I put this in my .bashrc:
What I *would* also like to add is a notify when the battery reaches 100% so I know to unplug my charger - I understand it's much better for the longevity of your battery if you don't leave it plugged in on full charge all the time and instead allow it to do full flat-charged-flat power cycles. I have a couple of laptops with useless batteries due to them having been left plugged in and running 24x7 for months or years on end - my Linux boxes rarely get shut down.
In an ideal world I'd like some device that plugged in between the charger plug and the laptop which I could drive from the OS to physically break the power connection when the battery gets to 100% - and not to reconnect it again until it's back to 0% (yes, I find with my reasonably new battery I can actually keep running it quite a while after it reaches "0%" - obviously 0% isn't dead flat - it's an arbitrary level set to give you a safety margin and still work when your battery is getting a bit knackered due to age.)
Fixed now :o)
You need to look at these files:
/etc/powersave/battery
I changed these values:
BATTERY_WARNING="10"
BATTERY_LOW="5"
BATTERY_CRITICAL="0"
And in:
/etc/powersave/events
I now have these:
EVENT_BATTERY_LOW="notify"
EVENT_BATTERY_CRITICAL="notify john_suspend_to_disk"
NB: I put john in the name so it would stick out like a sore thumb when I do a diff if dpkg ever asks me about changed config files on an upgrade and I'll know it's my own modification, and so it didn't conflict with or get overwritten by a provided script.
I created my own script to handle this:
/usr/lib/powersave/scripts/john_suspend_to_disk
which just has:
#!/bin/sh
#
#
#
sleep 10
/usr/sbin/s2disk
#
# You could use:
# echo -n disk > /sys/power/state
#
And I installed uswsusp which provides /usr/sbin/s2disk
Oh... I also set up a shell function to protect it, because I found I accidentally scrolled back through my shell history and hit enter on s2disk a couple of times ;o)
# type s2disk
s2disk is a function
I put this in my .bashrc:
s2disk ()
{
echo -e "Confirm you want to suspend: \c";
read OK;
if [ "$OK" = "y" ]; then
/usr/sbin/s2disk;
fi
}
What I *would* also like to add is a notify when the battery reaches 100% so I know to unplug my charger - I understand it's much better for the longevity of your battery if you don't leave it plugged in on full charge all the time and instead allow it to do full flat-charged-flat power cycles. I have a couple of laptops with useless batteries due to them having been left plugged in and running 24x7 for months or years on end - my Linux boxes rarely get shut down.
In an ideal world I'd like some device that plugged in between the charger plug and the laptop which I could drive from the OS to physically break the power connection when the battery gets to 100% - and not to reconnect it again until it's back to 0% (yes, I find with my reasonably new battery I can actually keep running it quite a while after it reaches "0%" - obviously 0% isn't dead flat - it's an arbitrary level set to give you a safety margin and still work when your battery is getting a bit knackered due to age.)
Wednesday, March 05, 2008
Problems installing vmplayer on Debian
I downloaded VMware-player-2.0.2-59824.i386.rpm and converted it with alien.
I had installed it before, then removed it to install vmware-server (because vmware-server complained that installing it caused file conflicts with vmplayer) and later removed vmware-server again and reinstalled vmplayer.
The bits left behind by vmware-server seem to break it...
The nice thing would be to find them and remove them, but I found a workaround.
When I first tried to install the player again I got error messages from some of the install scripts:
So I backed up the deb file and built a copy of it with no scripts using:
(and renamed that vmwareplayer_2.0.2-59825_i386.deb.no_scripts)
I was able to install it, but when I tried to run the player I found more hangovers of having had vmware-server installed:
I made sure it was there:
Eventually I found the solution was to run:
but... that failed:
OK, so fake it:
Make a copy of /etc/init.d/vmware containing:
then:
Now run the config again:
and go through the rest of the config.
After this (if you have your correct compiler etc installed, you should find that vmplayer will start happily)
Once that works you will find you can now go back and over-install the copy of vmwareplayer_2.0.2-59825_i386.deb that DOES have scripts without it erroring, so you get your correct startup scripts etc...
Once you've reinstalled it you will again need to run
one more time otherwise trying to run vmplayer will give you:
# alien VMware-player-2.0.2-59824.i386.rpm --scripts
I had installed it before, then removed it to install vmware-server (because vmware-server complained that installing it caused file conflicts with vmplayer) and later removed vmware-server again and reinstalled vmplayer.
The bits left behind by vmware-server seem to break it...
The nice thing would be to find them and remove them, but I found a workaround.
When I first tried to install the player again I got error messages from some of the install scripts:
dpkg: error processing vmwareplayer_2.0.2-59825_i386.deb (--install):
subprocess pre-installation script returned error exit status 1
/var/lib/dpkg/tmp.ci/postrm: line 25: [: abort-install: integer expression expected
Errors were encountered while processing:
vmwareplayer_2.0.2-59825_i386.deb
So I backed up the deb file and built a copy of it with no scripts using:
# alien VMware-player-2.0.2-59824.i386.rpm
(and renamed that vmwareplayer_2.0.2-59825_i386.deb.no_scripts)
I was able to install it, but when I tried to run the player I found more hangovers of having had vmware-server installed:
$ vmplayer
Unable to load image-loading module: /build/mts/release/bora-59824/bora/build/release/ws/vmui/../libdir/libconf/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so: /build/mts/release/bora-59824/bora/build/release/ws/vmui/../libdir/libconf/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so: cannot open shared object file: No such file or directory
I made sure it was there:
$ locate libpixbufloader-png.so
/usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
Eventually I found the solution was to run:
# /usr/bin/vmware-config.pl
but... that failed:
# /usr/bin/vmware-config.pl
Making sure services for VMware Player are stopped.
sh: /etc/init.d/vmware: No such file or directory
sh: /etc/init.d/vmware: No such file or directory
Unable to stop services for VMware Player
Execution aborted.
OK, so fake it:
Make a copy of /etc/init.d/vmware containing:
#!/bin/bash
echo $1
then:
# chmod +x /etc/init.d/vmware
Now run the config again:
# /usr/bin/vmware-config.pl
Making sure services for VMware Player are stopped.
status
stop
Configuring fallback GTK+ 2.4 libraries.
In which directory do you want to install the theme icons?
[/usr/share/icons]
...
and go through the rest of the config.
After this (if you have your correct compiler etc installed, you should find that vmplayer will start happily)
Once that works you will find you can now go back and over-install the copy of vmwareplayer_2.0.2-59825_i386.deb that DOES have scripts without it erroring, so you get your correct startup scripts etc...
Once you've reinstalled it you will again need to run
# /usr/bin/vmware-config.pl
one more time otherwise trying to run vmplayer will give you:
$ vmplayer
vmware is installed, but it has not been (correctly) configured
for this system. To (re-)configure it, invoke the following command:
/usr/bin/vmware-config.pl.
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-handlersBackup settings to a file in case you want to roll back:
$ gconftool-2 -R /desktop/gnome/url-handlers > ~/.gconf/desktop/gnome/url-handlers.defaultGet existing setting and type:
$ gconftool-2 -T -g /desktop/gnome/url-handlers/http/commandSet 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/commandSet 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
and add something like:
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.
# aptitude install ntfs-3gand 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.
Subscribe to:
Posts (Atom)