Faulty routes on MacOS X


This has been driving me insane, but I haven’t had time to actually try to fix the problem until now, so this is a small writeup about the symptom and what you can do about it. Sadly, it’s kinda a hard problem to search for, unless you already knows whats wrong.

This was my problem: At work, accessing LiveJournal worked fine, but at home it didn’t. Basically I got a Server Not Found from Firefox when trying to access from home. After a while I realized that the distinction wasn’t between home/work, but wireless or wirebound network. See, at work I usually use a wire to connect, but I only use wireless at home.

My first shot at a solution was something that solved a similar problem a while back – namely flushing the DNS cache. Of course, doing an nslookup and verifying it told me that the cache wasn’t the problem, but I tried anyway, because MacOSX sometimes plays funny tricks with this cache. So, to do this, just do “sudo lookupd -flushcache” in a console window, and then restart the network interface.

I tried to figure out what was wrong by pinging, and doing traceroute. Both of these gave clues that something was wrong. Traceroute gave me “Can’t assign requested address” from the bind system call. That finally made me realize that the route tables for the network interface was screwed. Lo and behold, doing a “sudo route flush” and restarting the interface solved my problems. Apparently there were about 10 faulty routes stuck in the cache, and for some reason MacOS X didn’t flush this cache automatically when connecting to a different wireless network. Highly annoying, but it’s finally solved.



Oracle developers on OSX unite!


All my ranting aside, Oracle RDBMS is pretty good. It’s got good performance, and lots of features you really need in a database. I shan’t proclaim it my favorite database, but it’s definitely something I have no problem working with. Except for that one small detail…

Yeah, you guessed it. Oracle support on Mac OS X is kinda… nonexistent. The best solution I’ve come up with is to run Parallels with a Windows or Linux instance and run Oracle XE inside of that. But that only works if I want to use the JDBC thing driver. OCI development? You’re screwed. And the Parallels route isn’t exactly painless either. Especially from a performance point of view.

So what do we need? OCI8 precompiled binaries would be a good start. But in the end, the only workable solution for all developers on OSX in the world who wants to be able to use Oracle is a compatible Oracle XE for Intel OS X. It shouldn’t really be to hard, right? It’s just a BSD beneath the covers…

Anyway, it’s kinda interesting. If you’re a consultant or a developer, OS X is definitely the superior platform. That’s a fact (well, except for Java 6…). The lack of Oracle support forces people to develop their application against Postgres and then let continuous integration – you are using CI, right? – tell you if you made any Oracle-unfriendly mistakes. That doesn’t really sound to professional.

So, go on and vote for this in Oracle Mix. The links are here: https://mix.oracle.com/ideas/we-need-the-oracle-clients-oci-jdbc-for-the-apple-intel-osx-platform,
https://mix.oracle.com/ideas/compile-oracle-xe-for-intel-os-x



Solving mounting problem on MacOS X


This is a highly specific post, but I thought I’d write about this so that if someone else have the same problem, they can try to solve it my way.

I got a new computer, Intel-based MBP last week. I upgraded it to latest OSX version (10.4.9 I believe), and immediately installed everything I needed. While ending my last job and returning the laptop associated with that post, I made backups to a 500GB USB LACIE hard drive. Very nice indeed, and half my life is now on that hard drive. (I have most of it on other places too, but not so easily accessible).

The first thing I managed to do was to shut off the hard drive without unmounting it correctly from OSX. I got the warning et all, but well, done is done. It was stupid, I know. Starting out with messing up everything. So what happened? Well, the next time I tried to get OSX to find my hard drive, by inputing the USB connection and switching on the power. Nothing happened. The drive would spin up, but no mount points or nice icons on the desktop. After some investigation I found that the Disk Manager HANGS when the LACIE is turned on and connected. I also found that when I switched the power off, my console says something about not being able to repair disk /dev/disk2s1. Interesting. After a few hours investigation on the Internet I despaired, and decided to try my own ingenuity instead.

I won’t tell you about everything I did to find this solution. It would get severely boring very fast. So, here is the solution:

1. Attach the device and turn on the power.
2. Open up a terminal and create a new directory in /Volumes, (eg sudo mkdir /Volumes/LACIE2).
3. Mount the drive explicitly on this mount point (sudo mount -t msdos /dev/disk2s1 /Volumes/LACIE2).
4. Delete ALL .DS_Store files on the disk (cd /Volumes/LACIE2; find . -name ‘DS_Store’ -exec rm -rf \{\} \;).
5. Wait for a while. At this point you should have two LACIE drives on your Desktop, one fake and one real. Unmount the real one by dragging it to the trash can.
6. Turn of the external hard drive, or detach it.
7. Reboot.
8. Attach/Turn on the external hard drive.

This is a process that works for me, and my drive is now back to working mode. It seems that OSX stores some information in the DS_Store files somewhere on the disk that got corrupted for me. Hopefully this information can help someone else with the same problem.