Friday, 13 November 2009

Karmic IPv6 Global address problems

If you're running IPv6 on Ubuntu 9.10 with multiple interfaces and you're not seeing any global IPv6 addresses assigned to your interfaces, and you're seeing this kind message in /var/log/messages:
Nov 13 10:10:10 my_machine kernel: [ 1000.101010] eth0: IPv6 duplicate address detected!
Then it's obviously Friday 13th and you should put it down to ....Yeah maybe but yesterday it was the same last week....

It seems there's a kernel (2.6.31-15) bug which means IPv6 Duplicate Address Detection (DAD - see RFC4862) is generating false-positives and subsequently not permitting your global address to be assigned to an interface.

To work around this bug do (change eth0 to your iface name):
sudo sysctl net.ipv6.conf.eth0.accept_dad=0

Tuesday, 10 November 2009

Ubuntu 9.10 (Karmic) has dodgy input problem

I just upgraded to Karmic Koala and I'm NOT impressed - My mouse and keyboard have become unresponsive and sluggish - sometimes even losing keystrokes and control of the mouse for a few milliseconds at a time (I had to go back and correct this post due to missing keystrokes that I did make but didn't register).

I'm considering changing distro if this isn't fixed soon.

[update:9mar10]: See possible fixes here

Sunday, 25 October 2009

Our Solar system (planets) broken on Google Earth/Sky

I was trying to see the planets (our solar system) on google earth recently but there seems to be a problem/bug - they do not display - both in the dedicated app and on the google sky website. When you click on the planets in the app (with error reporting on) you get:
http://mw1.google.com/mw-earth-vectordb/sky/sky0/solarsearch/mars-en-currenthour.kmz 404 not found
...and for all the others (maybe it's something else but they're not working on either right now).

Wonder when it'll be fixed?!

I posted a question on the help forums but no response....

Friday, 2 October 2009

MacBook disc crash (and restore)

Well my MacBook's disc decided to die the other week but thanks to Time Machine I had most of my stuff safe (apart from my other two partitions on my triple boot setup ;) - But I hadn't booted into 'em in a while so there can't have had anything tooo serious lost there - I think I'm going to just use VMware/Parallels/VirtualBox from now on...).

Of course I'd been using my TC with encrypted backups so when I attempted a restore using a new Snow Leopard DVD it couldn't find the backups... Oh dang! Luckily there is another way - I upgraded the default Tiger install to shiney new Snow Leopard and then fired off the Migration Assistant (from the another Admin account on the machine - you should not create your original user account with the same name as the one in your backup as it will clash - so just use another [admin] login and once you've run the Migration Assistant it will recreate your old account).

Friday, 25 September 2009

Handy OSX commands

List USB devices (a bit like lsusb on Linux)
On standard installation:
ioreg -c IOUSBDevice -l -w 0
Or using the developer tools:
IORegistryExplorer

Airport Wifi Info
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport
There are various arguments you can run it with -h to get a listing but the most useful are -I to get current wireless status, and -s to do a wireless scan.

Mount and mess with disk images
Here's how to mount a dmg:
hdiutil attach your_disk_image.dmg

List process' network connections
sudo lsof -i -P

Tweaking startup apps
- To disable startup items - add/rm a file called .disabled in their directory (i.e. a subdir of /System/Library/StartupItems/ or /System/Library/StartupItems/)
- launchctl -- Interfaces with launchd - in /Library/LaunchDaemons and similar
- Various custom ones; e.g. sudo "/Library/Application Support/VMware Fusion/boot.sh" --stop

Search using Spotlight on the command line
mdfind your_search_term (or mdfind -name file_to_find to look for file names).
There's also a few other related utilities like mdls to list file attributes etc. For more info see this useful post. It is also possible to enable the unix style locate command but it seems like a waste of space on OSX since you've already got Spotlight - though locate does provide for searching all files (only by name). However one can tweak Spotlight to search these files too...

Playing sounds on the cmd line
/usr/bin/afplay
Also afinfo gives you info on the file.

Print out OSX version
/usr/bin/sw_vers | grep 'ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*'
Or use system profiler (both suggestions from here):
system_profiler SPSoftwareDataType


There's also other pages with similarly useful info like here.

[updated: 23mar10]

Tuesday, 25 August 2009

Interact with other local Linux terminal sessions

If you're interested in trying to control/inject/view other terminal sessions (e.g. with ssh or telnet on a tty or pts) that you/someone is logged into on that machine then read on. Handy for zapping that vi session you left running at work, or playing havoc with something random ;)

It seems that watch does the trick for FreeBSD, but for Linux there's only things like ttysnoop (for linux-2.6) but that requires you modify your /etc/inittab files which is a bore. There's also conspy but that only works with physical terminal devices not ptys, as far as the docs say...

However you can do it without altering anything:
  • See what's being typed (and subsequent output) in another terminal session by using peekfd - you just need to supply the UID of the shell running on that other terminal (find it using ps). Watch out as the output may well contain some 8-bits chars which can confuse your current terminal - though you can get it back to normal using a terminal reset. (e.g. sudo peekfd /dev/pts/27)
  • Inject characters into a terminal by using the TIOCSTI ioctl() with this neat Perl script (copied below). Find the tty of the process you're interested in (e.g. ps axg | grep vi) and use that as the argument to the perl script e.g. echo 'ZZ' | sudo ./catvt.pl /dev/pts/27
  • #!/usr/bin/perl -w
    use strict;
    use Fcntl;
    use constant TIOCSTI => 0x5412;
    
    unless (@ARGV >= 1) {
    print "usage: $0 [vt] <input>\n";
    exit; }
    my $vt = shift @ARGV;
    my $buf = join '', <>;
    &writevt ($vt, $buf) || die "can't write to $vt: $!\n";
    exit;
    
    sub writevt {
    my ($vt, $buf) = @_;
    sysopen (VT, $vt, O_RDONLY) || return 0;
    for (my $i = 0; $i < length $buf; $i++) {
    ioctl (VT, TIOCSTI, substr ($buf, $i, 1)) || return 0; }
    close (VT) || return 0;
    return 1; } 
[updated 6jan10]

Monday, 10 August 2009

Panasonic microwave manuals

There seems to be a few annoying websites out there that ask for payment for user manuals - fortunately Panasonic have most of their manuals online for everything from microwaves, cameras, camcorders. There's also a link to their global support site.

Sunday, 2 August 2009

IPv6 Tunnel with Thompson router (from a Time Machine)

[updated 5oct12, 25jul10] I've recently got myself a Thompson router which has a bunch of interesting stuff in it once you get into the telnet access (the username/password used depends on your provider e.g. Plusnet (Administrator/your_router_serial_num), O2 (SuperUser/O2Br0ad64nd OR your_router_serial_num), etc). To get a tunnel working for Hurricane Electric, Sixxs, you need to [temporarily] allow IPv4 pinging of your box. Once you enable it at tunnel setup time - so here's how to do it.
%telnet your_router
{Administrator}=>:service system ifadd name=PING_RESPONDER group=wan

Once you've set it up on the website then you can disable it again:
{Administrator}=>:service system ifdelete name=PING_RESPONDER group=wan

On some systems you may need to allow 6to4 IPv6 tunnelling through the NAT - just try the above first and see if the tunnel works. If it doesn't then you could look here for info enabling it. [Update18jul10]: To enable it telnet to your Thompson box and type the following - filling in outside_addr and inside_addr and intf (on O2 its O2_ADSL2plus) - you can find a list of your box's interfaces by using nat iflist and associated addresses ip iplist):

nat mapadd intf=Internet type=nat outside_addr=your_external_ip_addr inside_addr=your_time_machines_ipv4_addr protocol=6to4

OR if you have a dynamic IP address (common these days) then use the following (and it will dynamically install the appropriate rule to permit your 6to4 IPv6 tunnel through when your router reboots (as suggested on he.net) - But to get it all working you will also need to use some sort of dynamic tunnel update as provided by he.net):

:nat tmpladd group=wan type=nat outside_addr=0.0.0.1 inside_addr=your_time_machines_ipv4_addr protocol=6to4

To get a full listing of existing mappings use: nat maplist expand=enabled If you need to change a mapping then you'll need to delete it first using nat mapdelete and then add the modified one. Once you've got the right mapping in place then you'll need to save the config so it is persistent between reboots by typing config save filename=user.ini (on O2 anyway - for others you'll need to check the default config file by: config list)

This article follows on from one on using my Time Machine as IPv6 6to4 tunnel/router - though this advice could also be relevant to someone just using a 6to4 tunnel from any device.