Craig Box's journeys, stories and notes...


Archive for the ‘Work’ Category

Windows tips: Starting WinVNC automatically if not running

Monday, July 17th, 2006

A long time ago I built an installer for WinVNC so that IT Partners' clients can connect back to us and we can fix their problems remotely.

A problem I have always had with it was that you have to launch WinVNC seperately from a connection shortcut; if you tried to run it every time, it would say "Another instance of WinVNC is already running", and if you go to connect when there isn't a running WinVNC, you get "No existing instance of WinVNC could be contacted". Therefore, users need to perform two distinct steps - a "launch", which does -kill -run, and a "start session", which does a -connect.

Here is a nice batch file to get around it, using SysInternals' PSList utility. If you know your users are on Windows XP or greater, you could use the built in tasklist command instead.

Code:

@echo off
pslist winvnc > nul
if %ERRORLEVEL% EQU 0 goto connect
start winvnc -run

Code:

:connect
if [%1] NEQ [] start winvnc %1 %2 %3 %4 %5

Code:

:end

Using udev to set network card order

Friday, July 14th, 2006

Don't you hate it when you update a Linux machine, and the order that the network cards are detected, changes?

Code:

ifconfig | grep HWaddr | awk ' { printf"KERNEL==\"eth*\",SYSFS{address}==\"%s\", NAME=\"%s\"\n", $5, $1; }' > /etc/udev/rules.d/10-network-cards.rules

The cables don't change around, so neither should the order in which they come up.

lvm2 pre-installation script returned exit status 10

Friday, July 7th, 2006

Tracking down bugs in Debian and Ubuntu packages is fun for the whole family. Found this one while upgrading from Hoary to Dapper on a test box:

root@unassigned-firewall:~ # apt-get install lvm2..
Preparing to replace lvm2 2.00.32-1 (using .../lvm2_2.02.02-1ubuntu1_i386.deb) ...
dpkg: error processing /cdrom//pool/main/l/lvm2/lvm2_2.02.02-1ubuntu1_i386.deb (--unpack): subprocess pre-installation script returned error exit status 10
Errors were encountered while processing:
/cdrom//pool/main/l/lvm2/lvm2_2.02.02-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Straight to Google. Nothing for this package, but some other packages with a similar error are reported. Eventually, I find a similar example, and work through the steps:

root@unassigned-firewall:~ # export DEBCONF_DEBUG=developer
root@unassigned-firewall:~ # apt-get install lvm2
..
Preparing to replace lvm2 2.00.32-1 (using .../lvm2_2.02.02-1ubuntu1_i386.deb) ...
debconf (developer): frontend started
debconf (developer): frontend running, package name is lvm2
debconf (developer): starting /var/lib/dpkg/tmp.ci/preinst upgrade 2.00.32-1
debconf (developer): <-- VERSION 2.0
debconf (developer): --> 0 2.0
debconf (developer): <-- CAPB backup
debconf (developer): --> 0 multiselect escape backup
debconf (developer): <-- TITLE LVM2
debconf (developer): --> 0
debconf (developer): <-- FSET lvm2/kernel seen false
debconf (developer): --> 10 lvm2/kernel doesn't exist
dpkg: error processing /cdrom//pool/main/l/lvm2/lvm2_2.02.02-1ubuntu1_i386.deb (--unpack):
subprocess pre-installation script returned error exit status 10
debconf (developer): frontend started
debconf (developer): frontend running, package name is lvm2
debconf (developer): starting /var/lib/dpkg/info/lvm2.postinst abort-upgrade 2.02.02-1ubuntu1
Errors were encountered while processing:
/cdrom//pool/main/l/lvm2/lvm2_2.02.02-1ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Aha! Eventually, the problem presents itself, in the postinst - but of the new package, not the one that is in /var/lib/dpkg/info:

if ! dpkg --compare-versions $(uname -r) ge '2.6.12'; then
db_fset lvm2/kernel seen false
db_input critical lvm2/kernel || true
db_go
exit 1
fi

Which neatly matches this Debian bug. I built me a package without this block (you're going to be running a new kernel when the upgrade that includes this package is done - the new version wouldn't cleanly backport), and the upgrade continued.

The moral of this story is I should have gone to Launchpad first, as the bug is recorded there. Google just didn't see it.

IE7 and WGA

Monday, July 3rd, 2006

Such beautiful praise from Paul Thurrott:

Internet Explorer 7.0 Beta 3 is a solid, feature-packed browser that all IE users should flock to immediately. While it's not enough to make me switch from Firefox yet--I still love certain Firefox features such as inline search--it's no longer an object of ridicule either.

What I do dislike, however:

validate.jpg

Is this happening with everything? Will WGA ever stop? (Well, yes, in that case. But you know they want to do it.)

The copy of Windows XP I'm using is the one that came preloaded with my laptop, but we deal a lot also in volume license versions for our customers (more Office than Windows, as there's little point in buying Windows twice, and we can't exactly buy PCs without it now, can we?) I don't appreciate being made to feel like a criminal every time I want to do anything.

Windows utilities you didn't know about: subinacl.exe

Friday, June 30th, 2006

subinacl is "a command-line tool that enables administrators to obtain security information about files, registry keys, and services, and transfer this information from user to user, from local or global group to group, and from domain to domain."

The magic thing that you can do with subinacl that you can't do with the GUI, is change ownership of files. It was a deliberate decision to only allow taking ownership from the GUI, so that if you are an admin, and someone locks you out of their files, and you have to take ownership to see them, the owner will know. Bugger having a paper trail for a laugh - use subinacl.

I have found a good example (with pics) at Windows Server Hacks. There is a reference page at ss64, which is a great reference for command line Windows tools. (What, Windows has a command line?)

If you're the sort of person who already knew about subinacl, can tell me tales of other useful tools like it, and want an IT job in Hamilton, we want to hear from you.

More random unfixed bugs: Big gray box on Java websites

Monday, June 26th, 2006

One of the reasons I wanted to start blogging was to draw attention to random bugs that I've found and either only worked around or not fixed.

Today's bug-that-I-hoped-was-fixed: in the Sun JVM on Windows XP, 1.5.0.06 (Update 6) or higher, if you try and go to a website that embeds Java, and get a big gray box instead of usefulness.

It is not fixed in 1.5.0.07. In fact, it is marked WONTFIX. It would be fixed if Java was open source software, or if Microsoft and Sun were still friendly, co-operating companies. Unfortunately, neither of these things are currently true. Apparently Microsoft will address it in a cumulative update, sometime, if they feel like it. (Maybe it will be fixed in WinFS? *sting*)

Resolution: downgrade to 1.5.0.05. And cry a little.

Falcon repository builder

Wednesday, June 21st, 2006

While Matt has built a repository system based on reprepro, thanks to Seveas (beware, that link is in Dutch), I've got Falcon working as a Debian/Ubuntu package repository. And in the process, increased the number of bugs fourfold!

The great thing is that he's fixed two of them already and there will probably be a update released today based on that. What great service.

(Is your blog staying at the top of the Planet longer than it should? Is your feed showing the time in the correct time zone? If not, you're posting from 12 hours in the future!)

New Thinkpad

Tuesday, May 30th, 2006

My boss has just bought me a new laptop.

Thinkpad T60:

  • T2400, 1.83GHz
  • 14.1" screen (1024x768), Intel Graphics Accelerator 950
  • 512MB RAM, 60GB HDD

IBM NZ web price: $2949.00.

I'm sure the dual core thing is pretty cool, but I really wanted something in 1400x1050 so it was a visible upgrade from the T40 I have at the moment. But but but...

Thinkpad T60:

  • T2400, 1.83GHz
  • 14.1" screen (1400x1050), 64MB Mobility Radeon X1300
  • 512MB RAM, 80GB HDD

IBM US web price: $1,599USD - or $2,499 NZD!

Got friends travelling to the US? You can't even get this model here, at any price. That kinda sucks.

I never had Linux on my last laptop, but seeing as I have some free space, I'll probably throw Dapper on there (and possibly the Vista beta, depending on how crazy I feel at the time). Anyone got any experience running accelerated X on an Intel 950 chipset?

Saviour of the universe

Sunday, May 28th, 2006

Macromedia have announced that there will be a Flash Player 9 for Linux (but not till 2007), and Darron Schall has announced something to do with it when it arrives. There is also a new Flash on Linux engineer at Adobe, who sounds like he wants to consider community opinion on various issues.