Friday, 6 August 2010

How to convert .ipcc file to .bundle

So you've got an .ipcc file and you want to unpack the .bundle directory - well it's just a zip file (like a few other things e.g. .jar files). So just run unzip:
$ unzip random.ipcc
You can find a list of them from http://phobos.apple.com/version - go to that page and sift through the XML till you find the one you need and copy the link and paste it into your browser to download it (or use wget or curl to get it).

Wednesday, 28 July 2010

Where OSX are kernel modules located?

The OSX uses loadable kernel (like BSD and Linux) modules (or kexts) - each one is stored in its own directory (e.g. Dont Steal Mac OS X.kext ) and these are mostly stored in a couple of directories:
/Library/Extensions
/System/Library/Extensions/
Though some others are stored in some other directories (e.g.  /Library/StartupItems/). You can list the currently loaded kernel modules using the kextstat command.

There also some info more info another post of mine on tracking down problem kernel modules in osx.

Friday, 16 July 2010

Ubuntu 10.04 USB Mouse keyboard problems - fixed

After the problems I had after 9.10 upgrade I held off on upgrading to Ubuntu's latest 10.04 (Lucid something-or-other), with kernel 2.6.32-21. Sadly it was another disaster - after upgrade neither my mouse nor keyboard worked beyond the Grub screen.

I looked into it; initially I thought it was an X thing with their new nouveau Nvidia driver but it wasn't that. I then noticed that the devices weren't actually being seen by the system on the USB bus - i.e. when I ran lsusb I only saw a couple of USB hubs (no mouse or keyboard listed) where normally I saw about 6 USB devices - yes they were plugged in and were recognised fine by an older kernel (9.10). I messed about with usbhid kernel module to no avail. I then tried 10.04 live CD and it worked ok with exact same USB setup?! I dumped the output from dmesg and then compared it with dmesg from my machine running the installed version on the exact same kernel version. It seemed that my installed version was failing to recognise the actual PCI USB host controllers on bootup - WTF?! It seems that the ehci-hcd module was not finding the USB hardware.... Smells like a kernel bug.

Finally I tried altering various boot args for the kernel in /boot/grub/menu.lst which didn't work initially, but then I hit upon the right one: pci=noacpi. It now works though my fans seem to be going full speed at all times...

[updated: 21aug10] Unfortunately after the kernel latest update (2.6.32-24) it seems to be totally broken and my fix doesn't work so I've had to revert to using 2.6.32-21 - If you run any DKMS modules (e.g. nvidia) you'll need to have the kernel header files installed that kernel.

Another BIG waste of time....I really am having my doubts about Ubuntu.

Thursday, 1 July 2010

Don't bother: iOS4 on iphone 3G

Yeah the move to iOS4 has not been good:
1) The install process sucked; The 'backup' stage of the upgrade took forever - so instead I ended up using the 'restore' function from iTunes (once I'd got iOS4 downloaded in iTune 9.2). It still took HOURS.
2) The number new features on the 3G is hardly worth it (Folders, Spell checker, Threaded mail,...)
3) It seems less stable and slower than iOS 3.2.x - have to reboot it more
4) A number of my apps crash ALOT like MobileRSS, OffMaps - not handy. (though I guess they probably need to be updated...)
5) Quite a few Apps aren't iOS4 ready - e.g. Skype

Maybe 4.x will help but who knows when that's due......

[5nov10]: 4.1 definitely improves things (and the relevant apps have mostly been updated)

Thursday, 22 April 2010

Fixing Apple iTunes sync AppleMobileSync crash

I just updated my Windows Vista machine and after rebooting I tried syncing my iPhone and iTunes 9.1 started complaining that AppleMobileSync.exe (and some Yahoo sync crap) was crashing WTF?!

I looked into it and when I attempted to run AppleMobileSync.exe from its working directory (C:\Program Files\Common Files\Apple\Mobile Device Support\SyncServices\Clients\com.apple.MobileSync) it complained that it couldn't find objc.dll - but a quick search found it here: "C:\Program Files\Common Files\Apple\Apple Application Support", so I added that dir to my path, then it complained that DeviceLink.dll was missing - I found that here: "C:\Program Files\Common Files\Apple\Mobile Device Support" so I added that dir to my path as well - It now worked! But to get it fixed for automatic syncing I had to go into System control panel -> Advanced system settings -> Environment variables - then select the System PATH and add the two above directories to the end of the PATH (separated by ';'). BTW I did try registering the objc.dll using regsvr32 but objc.dll doesn't contain the appropriate entry points for regsvr.

Not sure why it happened and it shouldn't really need path updates but it fixes it for now...

Wednesday, 14 April 2010

Finally got my Karmic box working properly!

Ever since I upgraded to Karmic (9.10) my machine has performed like a dog - well as far as keyboard and mouse input went - the mouse would linger and the system would loose my keystrokes. I tried a bunch of things to no avail....

Then I was perusing the web - frustrated by my sluggish machine - I'd read about cpu frequency scaling and wondering if this might be an issue. Well it turned out to be the root of my problem! Though in general I think more modern CPU should operate fine with cpu scaling enabled but these old AMD Opteron CPU's don't seem to be up to it so I've disabled it and the machine behaves a lot better.

To fix it - firstly I installed the cpufrequtils:
sudo aptitude install cpufrequtils
Checked the current state of my machine (You can also do it using any of: cat /proc/cpuinfo, sudo dmidecode -t processor, lshw -C processor):
sudo aptitude install cpufreq-info
 My machine was in 'ondemand' mode - I changed it to 'performance' mode - for each of my two processors:
sudo cpufreq-set -c 0 -g performance
sudo cpufreq-set -c 1 -g performance
This is actually setting the following /sys entries: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

There a few more things you can do with the cpufreq utils.

Tuesday, 23 March 2010

Linux networking secrets

The operation of Linux's networking functions has various not so well described aspects to it. Here's a few I've come across:
  • Kernel DST cache: The kernel caches congestion control related information (e.g. ssthresh, rtt, mtu, cwnd) about every TCP connection and stores it in the 'DST' (Destination) cache after each connection closes, though only for a limited time, reusing for connections to the same destination. To list/show/display the contents of the dst cache:
    ip -s route show table cache
    You just flush the DST caching using:
    ip route flush table cache
    Or you can disable the DST caching using:
    sysctl -w net.ipv4.tcp_no_metrics_save=1
  • Network interface queue size/length monitoring: Everyone goes on about tweaking the transmit queue (txqueuelen) size to get the best result out of your box but no-one tells you how to monitor/check/display/show the size of the queue actually being used. To check actual queue utilisation/use/occupancy - see the 'backlog' (in bytes and packets) as shown by tc (e.g. For eth0):
    tc -s -d qdisc ls dev eth0
  • Default Linux Queue: Amazingly enough the default queue on Linux (pfifo_fast) inspects the TOS (type of Service) bits in the IP header and does priority queuing based upon them - Not sure who - if anyone - is using that???! Anyway you can check to see the priority mappings (priomap) using the tc command above.
  • Detailed socket stats and info (congestion control algo, cwnd, window scale, rto etc) on open sockets (TCP,UDP,RAW,PACKET) on your machine you can use the socket stats app, ss  which uses an INET_DIAG netlink socket to obtain info directly from the running kernel: e.g.
    (args: t: timers, i: TCP internals, m: memory, e: extended, dport: filters on destination port):
    ss -time dport = :5001 
    Memory stats: from net/ipv4/inet_diag.c +140
    rmem = sk->sk_rmem_alloc; wmem = sk->sk_wmem_queued; fmem = sk->sk_forward_alloc; tmem = sk->sk_wmem_alloc;
  • Linux TCP stats: The tcp_probe module may be used to obtain cwnd and sequence numbers of packets in TCP flows.
  • TCP receive (or send) window size is based on sysctrl net.ipv4.tcp_rmem (or tcp_wmem) - the 3 values are min, default, and max. The actual window size relates to these numbers by tcp win = tcp_rmem-tcp_rmem/2^tcp_adv_win_scale - e.g. the system default of 87380 results in a TCP win of 65535. The max window is globally limited by net.core.rmem_max. For more details see linux-2.6/Documentation/networking/ip-sysctrl.txt and man tcp.
  • TCP/Generic Segment Offloading (TSO/GSO) information about your machine's network interface. TSO is quite common these days - it basically offloads the packetisation of TCP segments onto the network card (see my other post where it can lead to confusion). The ethtool command (which may need installing) also tells you about a whole host of features that your NIC may or may not support:
    ethtool -k eth0
  • Traffic Control (TC): I've touched on its use above but I've another post on setting filters with tc.
There's other places that have good info on Linux like: Linux foundation's Kernel networking, Linux network stack walk thru

[Updated:9jul15, 15jan15:DST cache, 1dec11]