Posts Tagged ‘Ubuntu’

Ubuntu 9.10 and GOAL

Wednesday, November 4th, 2009

You will probably have realised by now that a new version of Ubuntu (9.10, ‘Karmic Koala’) was released a couple of days ago. Whenever a new distro version hits the streets, I am compelled to work out whether or not my GOAL script has been broken: is it still a couple of mouse-clicks to install Oracle 10g or 11g on a 64-bit Linux distro, or has the change of distro version introduced problems for the Oracle installation process?

Well, it’s taken me a couple of days to work out the answers, but here they are…

GOAL and 11g Release 2 is fine. I had to make a minor adjustment to the bit where new repositories are added, because otherwise Karmic would have been updated with Jaunty packages. But that was trivial, and the end result is still that 11gR2 installs on 64-bit Karmic without linking errors of any kind. You still get the enormous list of ‘required packages not found’ displayed at one point, but a quick ‘Ignore All’ sorts all that 0ut.

But the bad news is that I cannot get 10gR2 to install on Karmic at all. I get the sort of linking errors that suggests the 32-bit compatible libc libraries haven’t been installed, but since they’re definitely in the list of packages to be installed, I’m assuming they are not yet in the Karmic repositories. Maybe it’ll all come good in a couple of weeks… and I’ll certainly be testing. But for now, 64-bit Karmic and 10g just don’t mix and GOAL doesn’t make them mix any better.

Confessions

Saturday, September 26th, 2009

The new PC has finally arrived! It’s insanely fast and (which is even better) amazingly quiet: a mere whisper from somewhere under my desk. It was beautifully assembled by the lads at Auspcmarket.com.au, too, so if you live Oz-side, I thoroughly recommend them. Comparing their prices with those from, say, Arc or Zip Computers, they are always more expensive. But they deliver for free (at least, in metropolitan areas, which is why I always get them to deliver to work) and, if this PC is anything to go by, they take great care and enormous pride in building the thing nicely. Spare cables tied back, everything mounted/installed correctly, in-use cabling discretely hidden and tucked out of site. The nicest build job I’ve ever seen, come to think of it… which means, I don’t care if their competitors are a bit cheaper. They’re worth it (and no, this isn’t a cash-for-comment slot!). When you see how well this stuff can be done, it’s no wonder that I haven’t built my own PCs for a good four or five years, that’s all I can say!

Anyway, it’s now time for a confession of sorts: I’ve installed Windows 7. I just couldn’t be bothered stuffing around trying to get Ubuntu to handle Blu-Ray. I like Ubuntu enormously, but at the end of the day, I shall be just a little bit more productive with Windows 7, despite being just a little less free. Those who are prepared to trade liberty for productivity probably deserve neither, to paraphrase my old mate Ben Franklin -which is no doubt true, but I could honestly see no practicable alternative. Backing up my movie collection to disk is what I do; backing up my Blu-Rays to disk is something I really want to do. Ubuntu wasn’t going to cut it; end of story, really. Can you tell I’m “conflicted” about it? Well, I am. No two ways about it: open source is where I would like to be, and Ubuntu is a damn fine operating system. However, E.M. Forster put it this way at the end of A Passage To India:

‘Why can’t we be friends now?’ …. ‘It’s what I want. It’s what you want.’ But the horses didn’t want it – they swerved apart; the earth didn’t want it, sending up rocks through which riders must pass single-file; the temples, the tank, the jail, the palace, the birds, the carrion, the Guest House, that came into view as they issued from the gap and saw Mau beneath: they didn’t want it, they said in their hundred voices, ‘No, not yet,’ and the sky said, ‘No, not there’

Some other time, then!

All that said, I like Windows 7 (and have done since the Beta appeared in January of this year). I’m running the production version, which isn’t due to hit the retail channels for another month, thanks to my MSDN subscription. It’s fast(ish), and slick (sort of) and more than acceptable. It also runs everything I need it to do, including the stuff that lets me back up my DVDs and Blu-Ray disks. It’s still Windows, however: which means, it lacks a lot of things I’ve come to rely on (drop-down console, for example; multiple virtual desktops, for another). These things can be rectified, of course, but it would be nice if you didn’t have to “rectify” Microsoft’s latest and greatest. Virtual desktops ought to be a basic feature of any OS these days, I’d say. Similarly, there’s all the DRM stuff to deal with, for which workarounds exist, but which -morally, I suppose- there shouldn’t be a need. So I definitely have a “dirty hands” feeling, but I also know it all just works, without much effort or imagination (just a lot of driver disks and extra software downloads and installations!)

Fundamentally, it’s less fun to use than Linux. But it’s also more straightforward in many respects.

I’ll be documenting some of the workarounds I’ve mentioned in the next few posts. Meanwhile, forgive an apostate his weaknesses…

64-bit 11g Release 2 on 64-bit Ubuntu

Friday, September 4th, 2009

I’m extremely happy to report that 11g Release 2 installs onto 64-bit Ubuntu 9.04 without fuss or bother (or error!) if you simply follow the instructions I’ve posted previously:

ubuscreen

Inevitably, the installer will freak out with (it thinks) barely any of the necessary prerequisite packages installed! But a quick ‘Ignore All’ will sort that out (always assuming you’ve actually followed those earlier instructions!), after which it’s completely plain sailing (not even one linking error, either).

Just note that in those previous instructions, I’d hard-coded a path to /u01/app/oracle/product/10.2.0/db_1. That will work well enough, but you will probably want to change that to be the all-new, all-shiny /u01/app/oracle/product/11.2.0/db_1!

Update: GOAL now handles all Oracle installations onto 64-bit Ubuntu

Curses!

Friday, August 28th, 2009

I am lucky in my place of employment: I am pretty much free to run whatever operating system I like and install whatever applications I feel the need for, without anyone getting upset and whispering the dread acronym ‘SOE’ in my ear. For the past three months, therefore, I’ve been running Ubuntu 9.04 on my work PC, just as I do at home. It’s worked beautifully for the most part: I occasionally get sent spreadsheets with more than 65,000 rows which OpenOffice is therefore not capable of handling, but nothing a VirtualBox XP virtual machine with an Office 2007 installation couldn’t fix. Similarly, Thunderbird is not a particularly great Microsoft Exchange client, but in its IMAP mode, it served well enough for my purposes. Perhaps the stickiest moment I had was getting an appropriate PL/SQL development tool working: as I’ve documented in these parts before now, the in-house product of choice is PL/SQL Developer, which is a Windows-only product. I’ve tried hard to love the Java-based (and hence completely free and cross-platform) SQL Developer from Oracle, but it’s been a tempestuous affair and hasn’t progressed particularly well! So, PL/SQL Developer it more or less had to be… and, thanks to Wine, it worked pretty well.

Until yesterday.

I had occasion to write a procedure that would add an ê (e-circumflex) to certain fields of certain records. Not very complicated, written and compiled in a jiffy. The only thing was that it didn’t take long to notice that a lot of data was turning up with ¿ characters in them (upside-down question marks). So I opened the procedure in my Wine-cum-PL/Developer, and sure enough: there was my code saying to append ¿ to data. I assumed I’d had a typo fit, and edited the code to once again specify field=replace(field,’e',’ê’).  I hit F8 to compile the corrected code, and it all looked fine. Shut the procedure down, and re-open it… and the upside-down question mark was back once more!

So I opened up my XP virtual machine, and manually typed in a couple of test cases, such as these:

SQL> select 'Ø' from dual;

'
-
O

You might notice that the output is missing the forward-slash that the input contained. This is the sort of thing that happens when your Windows client is operating in classic ASCII mode whilst the database is running in, say, the WE8ISO8859P1 character set. Sure enough, a drop-down to the command prompt and a quick chcp later, and this was the result:

C:\>chcp
Active code page: 437

…and code page 437 is pretty much standard 7-bit ASCII for US Markets. Switch it to code page 850 (Multilingual Latin I), however, and the problem goes away:

C:\>chcp 850
Active code page: 850

C:\>sqlplus sys/password as sysdba

SQL> select 'Ø' from dual;

'
-
Ø

…and now the output and input match exactly. So, from my XP virtual machine, I knew that the tendency of my procedural code to forget the ‘extended’ character I’d typed was probably code page-related. Had I been running ‘true’ XP, I could have set code page 850 as my system-wide default and PL/SQL Developer would have picked up on that change and worked fine thereafter. But I was running PL/SQL Developer courtesy of Wine emulation (and yes, I know that Wine Is Not an Emulator, but let’s not get pedantic!)… and I was (and remain) unaware as to how one goes about setting a default code page for programs running via Wine. Probably there’s a configuration file edit to be made that accomplishes the trick, but if so, I didn’t know what it was… and Google wasn’t any help either.

In short, my principle development tool, on my OS of choice, was incapable of storing anything but plain ASCII characters in code… and I had a (pressing!) need to store ‘extended’ characters. The immediate fix was quite simple: fire up Oracle’s own SQL Developer and edit the procedure in that. Another paste-in of the correct ê character, a compile and a final re-open: the correct extended character was there, just fine. Problem solved. However, I was left in the position that if I ever re-opened that code in PL/SQL Developer and hit ‘compile’, the wrong character would be compiled back into the code. Effectively, therefore, PL/SQL Developer-via-Wine was now no longer usable.

So I did what all sensible people would do in that position, I like to think: install Windows 7 and say goodbye to my workplace desktop Ubuntu experiment. :-(

Well, there were probably a lot subtler ways of fixing the problem properly, and if you know how to set a default code page for Wine, I’m all ears. But Windows 7 did install impressively fast (24 minutes, all up), and it’s not a completely unpleasant OS to use… and PL/SQL Developer works out of the box, with the full panoply of Western European characters available, no problem, no sweat.

Sadly, I shall probably have to do the same at home this weekend, because I like to keep my work and home environments pretty much as mirror images of each other. So it looks like Windows 7 will win the war of my particular set of home desktops after all. I am however happy to report that my old laptop, which serves very effectively as a DNS server, as well as a router via the Bigpond Wireless Broadband account, will remain running Ubuntu (especially since the broadband and Internet connection sharing runs much better on Ubuntu than it ever did on Windows). Some small comfort, perhaps…

An Ubuntu DNS Server

Sunday, August 2nd, 2009

I’ve built DNS servers on Centos before, but never on Ubuntu. Given my recent networking upheavals, however, as documented here in recent posts, the need to have a DNS server running on a laptop running Ubuntu was pretty clear. So here’s how I went about configuring it.

First, you’ll need the relevant software which, in Ubuntu, is called bind9 and not just ‘bind’. You can install that using the Synaptic Package Manager if you like the GUI way of doing things or via the command line if you’re that way inclined: sudo aptitude install bind9 will do the deed well enough.

Creating the Zone Records

Next, you now have to start editing configuration files. There are three of them: the general one (called named.conf.local) which says what the other two are called, and then the two specific ones that set up the details of the DNS zones for which the DNS server you’re configuring is going to be “authoritive”. (Just to confuse things right off the bat, named.conf.local is simply an include file for the file which really does all the heavy lifting, which is just named.conf. In other words, named.conf calls named.conf.local -so you’re supposed to put all your local configuration information in the “local” file, not straight into the main conf file.)

Anyway, to begin with, we edit the named.conf.local file:

sudo gedit /etc/bind/named.conf.local

And now you type in the following:

zone "dizwell.home" {
 type master;
 file "/etc/bind/zones/dizwell.home.db";
 };

zone "43.42.10.in-addr.arpa" {
 type master;
 file "/etc/bind/zones/rev.43.42.10.in-addr.arpa";
};

That, of course, is specific to me and my situation. What I’m saying here is that my new DNS server is going to be authorative (the “master” server) for resolving ‘dizwell.home’ addresses. That’s the name of my home network -so The Other Half’s machine is called ariadne.dizwell.home and mine is called heracles.dizwell.home -and when “ariadne” needs to know the IP address of “heracles”, it’s this DNS server that will be the authorative way of finding out. The bit in there that reads “file … dizwell.home.db” simply says ‘a file called dizwell.home.db exists in which the details of host names and their IP addresses can be found’. That doesn’t actually exist yet, of course, but I will be creating it shortly. Turning machine names into their underlying IP addresses is called forward names lookup, and thus that soon-to-be created file will be the configuration file for the “forward zone” of my new DNS server.

The other job of a DNS server is to do what’s called reverse names lookups. That is, whilst I think most people understand the need to turn ‘google.com’ into an IP address 74.125.45.100, it’s actually also necessary to be able to do it the other way around -turning an address into a name. The second zone record is setting up the ability of my new DNS server to do this: it’s saying that a file called /etc/bind/zones/rev.43.42.10.in-addr.arpa exists which will contain the necessary information to allow reverse lookups to happen. Again, that file doesn’t actually exist as yet, but I’m here saying that it’s about to. The curious name for this zone and its configuration file, by the way, simply arises from the fact that -as I described in my last post- my home network uses IP addresses in the 10.42.43.x range. If you reverse the order of those IP octets, you get x.43.42.10 -and we simply miss off the ‘x’ bit at the start.

Once you’ve gotten the contents right (and don’t miss out the semi-colon that ends each line!) save your new configuration file.

Configuring the Forward Zone Records

Our master configuration file now says that two zone configuration files exist. Therefore, we’d better create them before we go any further. To start with, I’ll create the ‘forward zone’ configuration file. The relevant commands are:

sudo mkdir /etc/bind/zones
sudo gedit /etc/bind/zones/dizwell.home.db

And then you type in all this:

$TTL 10800
dizwell.home. IN SOA cerberus.dizwell.home. hjr@dizwell.com. (
20090802 ; serial
7200     ; refresh
7200     ; retry
1814400  ; expiry
10800    ; ttl
)

@ NS    cerberus

cerberus    A    10.42.43.1
heracles    A    10.42.43.2
ariadne     A    10.42.43.3

It’s a lot of gobbledygook, I suppose, but if you take it bit by bit, it actually makes sense! Firstly, it’s establishing a Start Of Authority record for the dizwell.home domain that has a Time To Live of 10800 seconds (though that would only be relevant if I went on to set up slave DNS servers, since the TTL tells the slave how long its copy of the record should be considered valid before it has to go back to the master and get a fresh copy. Since I’m only creating the master server in the first place, as I say, the TTL is a bit redundant!)  The SOA record simply states that the machine called “cerberus.dizwell.home” is going to be my DNS server, and that its administrator can be emailed at hjr@dizwell.com, which happens to be my real email address. Note, however, that all three of the names specified end with a fullstop (or period, if you prefer). My domain isn’t specified as dizwell.home but dizwell.home. and the machine name isn’t just cerberus.dizwell.home but cerberus.dizwell.home. Even my email address ends in a fullstop here, which it doesn’t in real life of course. The trailing fullstops are very easy to miss, but fatal if you do! They’re very necessary to make things work properly (what they actually do is to say ‘I am the definitive names server for this zone, the root of the zone, so don’t bother going elsewhere for your lookups’.

After that, the SOA contains a lot of stuff which isn’t strictly necessary for a small home DNS server: they are a series of numbers which specify how often slave DNS servers refresh their data from master DNS servers, how often a slave should wait before retrying a failed attempt to refresh their data from a master and so on. Given that I am only going to have one master DNS server, you can see why I say this stuff is, for me, unnecessary. But the serial entry is actually very important: it can be any number you like, provided it doesn’t contain more digits than you see in my example here. I’ve gone for a simple date stamp. The idea is that you increment this number every time you alter the Zone Record. If I ever add details of another PC on my network, for example, to the end of the file, I must remember to increment the serial number. The reason is simply that this number creates a way of establish ‘legitimacy’ in complex DNS setups (if a slave had a higher serial number than a master server, for example, it would suggest something very odd is going on that needs fixing… slaves are supposed to be copies of their masters, not more recently-updated!)  -and even in simple DNS setups, it lets anyone see which is the ‘correct’ version of the file (i.e., the one with the most recent -that is, largest- serial number)

Next comes a line which simply states that the machine called ‘cerberus’ is actually the Name Server for this domain. If you have more than one name server, you list them each in turn here, but I don’t.

Finally comes the all-important bit that is the very reason for me setting up this DNS server in the first place: the mapping of machine names to IP addresses in what are known as A Records. I’ve just put a few records here to provide enough material to test with -if you really only had 3 machines in your domain, I’d suggest not using a DNS server at all and just sticking with editing /etc/hosts.

Configuring the Reverse Zone Records

With that zone file created and saved, it’s time to get the reverse names zone sorted. Again, start by creating a new, blank text file:

sudo gedit /etc/bind/zones/rev.43.42.10.in-addr.arpa

And then paste these contents in:

$TTL 10800
@ IN SOA cerberus.dizwell.home. hjr.dizwell.com. (
 20090802       ; serial
 7200           ; refresh
 7200           ; retry
 1814400        ; expire
 10800          ; ttl
 ) 
@ cerberusNS .dizwell.home.
1    PTR cerberus.dizwell.home.
2    PTR heracles.dizwell.home.
3    PTR ariadne.dizwell.home.

I hope that by now you recognise most of the top part of this stuff, at least. It’s the usual timeouts, retries and refresh directives. The new stuff is in the four last lines, which are PoinTeR records: IP address 10.42.43.1 points to a machine name of cerberus.dizwell.home. Similarly, the IP address 10.42.43.2 points to a machine name of heracles.dizwell.home. The first three octets of the IP address are not mentioned explicitly, because the Zone Record file itself has a name of rev.43.42.10, and it is assumed that the octets mentioned in the file name apply to all the pointer records contained within the file. Again, note that all the domain names mentioned in the file end in a fullstop/period.

Other Bits and Pieces

My new DNS server is almost fully configured as a result of creating those two zone configuration files. There’s just one thing missing: my server is authorative for my home network only. If ariadne wants to find heracles, no problem: my DNS server will be able to supply the relevant IP addresses. But if ariadne wants to talk to google.com, there is most definitely going to be a problem, since my DNS server hasn’t got a clue on how to resolve anything outside its particular zones. For that, we need to configure the address of another DNS server, provided by my ISP, which is ‘authorative’ (sort-of) for the Internet and all its glories. That’s done by configuring the /etc/bind/named.conf.options file (as sudo). You add the following ’stanza’ to that file:

forwarders {
 139.130.4.4;
 203.50.2.71;
};

Those happen to be the IP addresses for the DNS servers hosted by Bigpond.com (who is my ISP): if you use a different ISP, different DNS addresses are required. That stanza, by the way, needs to go inside the main “options {…}” stanza, not just appended to the end of the file (in other words, edit and replace the bit in the default file at about line 13 – 15, don’t just bolt on extra lines to the end of the default file).

With that done, we now just need to re-start bind so that it picks up on all our new configuration work:

sudo /etc/init.d/bind9 restart

You should see the domain name service first being stopped and then being re-started, with [OK] messages displayed for each. If you get a [fail] on the restart, issue this command to see if the logs are reporting any configuration errors: tail -f /var/log/syslog. Hopefully, you’ll see something obvious there (such as “/etc/bind/named.conf.local: 34: unknown option…”, which will give you the clue you need to go and re-edit the appropriate configuration file (in this case, at around about line 34). If you got the [OK] message, though, your new DNS server is up and running!

Testing it all

Has it worked? Well, you need to move away from the server now and find yourself a desktop PC, since they are the clients who will be making use of the DNS service being provided by the server. I’m using my heracles PC, so let me start by seeing if I can find the cerberus box by name:

hjr@heracles:~$ ping cerberus
ping: unknown host cerberus

And it’s a dismal failure, simply because my PC doesn’t yet know there’s a DNS server it can use to resolve that name. So, I need to tell it to use the new DNS Server. On Ubuntu, that is done by right-clicking the Network Manager icon in the top-right panel and selecting the Edit Connections option. Pick your connection and click the Edit button. Select the IPv4 Settings tab and then type in the IP address of the new DNS Server in the relevant spot:

dns2

Notice too that I’ve specified a ’search domain’ here of “dizwell.home”. That basically means, if you ask to resolve the hostname “cerberus”, the PC will know to talk to the DNS Server for records relating to ‘cerberus.dizwell.home’, without the domain name bit having to be specified explicitly.

When you’re done, stop your network (right-click the Network Manager icon again, and uncheck the ‘Enable Networking’ option) and then re-start it (do the same as before, only now check the ‘Enable Networking’ option). Now for the acid test:

hjr@heracles:~$ ping cerberus
PING cerberus.dizwell.home (10.42.43.1) 56(84) bytes of data.
64 bytes from cerberus.dizwell.home (10.42.43.1): icmp_seq=1 ttl=64 time=0.957 ms
64 bytes from cerberus.dizwell.home (10.42.43.1): icmp_seq=2 ttl=64 time=1.06 ms
64 bytes from cerberus.dizwell.home (10.42.43.1): icmp_seq=3 ttl=64 time=1.07 ms
64 bytes from cerberus.dizwell.home (10.42.43.1): icmp_seq=4 ttl=64 time=1.04 ms

Success!

In my last post, I ended things with every PC on the network being setup to know the address of Bigpond’s DNS servers -which at least meant connections to the Internet worked, but did mean even humble PC-to-PC communications potentially involved a DNS call to Bigpond! Now only one machine on my network needs to know anything about Bigpond’s DNS servers -the one that’s actually using the Wireless Broadband adapter. And that’s exactly the way things should be!

Bigpond Wireless Broadband on Ubuntu

Sunday, August 2nd, 2009

One of the last things that has caused me to retain a Windows XP workstation at home is that my broadband provider (Telstra) supplies modems which don’t work very well with Linux (of any flavour). Their ‘Connection Manager’ utility, for example, is an entirely Windows affair. (Compare that with Optus, for example, whose Huawei modems do work well on Linux and use a browser-based utility to manage connections -and, being browser-based, they will work on pretty well any OS). One of the specific problems these Telstra USB modems have as far as Linux is concerned is that they are designed to have two distinct behaviours. Insert one into a Windows PC, for example, and they will first be detected as a removable storage device (because that then lets Windows install the relevant drivers automatically, without you having to insert a separate CD). Only once the drivers have been loaded will the thing switch into ‘modem mode’ and be able to behave as a modem. It’s that transition from storage device to communications device that Linux doesn’t handle very well (at least, not well automatically).

The workaround is therefore to disable this switching behaviour: disable the storage device mode completely, in other words, and the thing is permanently a modem… and in that mode, Linux (Jaunty, particularly) will be able to use it and control it properly.

Happily, I found a way to do that here -though I found those instructions infuriatingly brief. Here then are my instructions, based on those, but with (I think) a bit more useful detail and rather more post-configuration guidance. (And note, before I go any further, that these instructions only apply if your USB modem is a Mobile MF636 7.2 Mobile Card, as mine is, even though the original article was written for the 626 modem).

First, insert the modem into a proper Windows PC and let it do its automatic detection and driver installation routine. When the software and drivers have been properly and completely installed, select to run the Bigpond Connection Manager software when prompted by the installation wizard. By running this software, you cause the device to switch into its modem mode. Configuring that seems to take an age, during which time lots of ‘new device detected’ messages will appear in the Windows System Tray. When all that’s finished, your Connection Manager software should be sat there warning you that your device has not yet been activated. At that point, close the software down completely -including any System Tray icons that might relate to it.

Click through the Settings -> Control Panel -> System options and then select the Hardware tab and click the Device Manager button. There should be an item called modems visible: expand that and you’ll see it’s called ‘ZTE Proprietary USB Modem’. Right-click that and select Properties. Click the Modem tab, and at the top-left of the relevant page, you’ll see something like COM8. It may be some other COM port, of course, but the point is to note which precise communications port is in use by the USB modem. Once you know that, you can close the device manager and all its properties pages down.

Armed with the new COM port knowledge, you can now launch the Hyperterminal application. That’s found under Programs -> Accessories -> Communications. Create a new connection with that (call it anything you like: ‘modem’ works quite well!). On the next dialogue, specify the communications port to use (that’s COM8 in my case -or whatever you detected in the Device Manager earlier). You then get to the port settings dialogue, and that’s where you specify that the port communicates at 115200 bits per second using 8 data bits, no parity, 1 stop bits and no flow control.

Once you click OK on that lot, you will be connected to your modem. Hyperterminal will display something like this:

usbmodem01

If you have any difficulty getting this kind of display, reboot your PC and try again. I found I had to do that before Windows correctly and completely installed all its device drivers and was able to establish proper communications with the modem. Until then, I’d sit staring at a completely blank Hyperterminal screen. After a reboot, and with the device having been removed and re-inserted to initiate completely fresh detection, I’d get the above screen-full of technological chit-chat every time.

It’s now that you type in the two commands which will switch off the USB device’s ability to behave as a storage device:

AT+ZOPRT=5 (and that’s an Oh not a zero in the middle of that lot)
AT+ZCDRUN=8

Type those two commands in, one at a time, exactly as shown (i.e., all uppercase, no spaces), pressing RETURN after each one. You should get ‘OK’ as an acknowledgement as you do so:

usbmodem02

And that’s more or less it, as far as Windows and the USB Device are concerned. You can now close down Hyperterminal and unplug the modem. You can also format your Windows PC, because you won’t be needing it again! This disabling of the device’s dual-mode capability  is, in other words, a one-off affair, requiring a proper Windows PC for all of about 2 minutes to accomplish. (Incidentally, if you ever want to restore the device back to its dual-mode state, you simply go through the same Hyperterminal process but issue the command AT+ZCDRUN=9).

If you now insert your Bigpond modem into your Jaunty machine, it should be auto-detected and the New Mobile Broadband Connection wizard launched automatically. If not, just go to System -> Preferences -> Network Connections, select the Mobile Broadband tab and then click the Add button… that will launch the Connection wizard manually. You’ll need to select the right provider (in my case, ‘Telstra’), and then give the new connection a name. But that’s not enough, since you’ll then need to then click the Edit button and specify a username, password and APN. The username and password are, hopefully, obvious (whatever you’ve used to sign up to Bigpond in the first place!) But the APN is not so obvious and, indeed, will probably be wrong. By default, it will probably be set to ‘telstra.wap’, but that’s not right for Bigpond members. For us, it needs to read telstra.bigpond …and if it doesn’t, you’ll end up being charged the wrong amounts to your Bigpond account. Your connection settings dialogue should end up looking like this, therefore:

Screenshot-Editing Telstra

You might eventually also want to select the ‘connect automatically’ option, but I left that until I’d checked it all worked manually first.

When you hit the ‘Apply’ button on this dialog, you should find that Ubuntu immediately tries to establish and use the new connection, but if not it’s a simple matter of clicking the Network Manager icon in the top right panel and selecting the Telstra radio button in order to initiate a connection by hand. I found I had two such radio buttons (I’m guessing this is because the USB device is a dual band one, capable of using ye olde GSM as well as ye sexie newe 3G connection technologies), and I therefore had to experiment a bit before finding the one which established the right connection every time. Now that I have, however, proper Telstra wireless broadband on Ubuntu is child’s play -and the old Windows box has finally been relieved of its last role in life and, consequently, retired!

Funnily enough, therefore, I now find the modem works rather better on Ubuntu than it ever did on Windows… that Connection Manager application you have to use on Windows was always slow and too much in-your-face, and it’s a pleasure to not have to use it any more!

64-bit Oracle on 64-bit Ubuntu

Monday, July 27th, 2009

I haven’t found any particularly good instructions on the Internet explaining how to do a 10g or 11g installation onto 64-bit Ubuntu (32-bit installations are a piece of cake… and even my own doris script has done those without trouble for a long time). Indeed, for a long time, I considered any such installation practically impossible -and used virtual Centos machines instead (where the 64-bit Oracle installation works flawlessly).

But times change: I use 64-bit Ubuntu as my OS at work and at home, and there are times when I don’t want to have to fire up a virtual machine just so I can do some Oracle experimentation. I’ve therefore been forced to work out how the Oracle installation can be made to succeed on that platform. I should say upfront that it’s still not a perfect installation: no matter what I do, I can’t get rid of an error in invoking target ‘collector’ of makefile ‘ins_emdb.mk’ message during the linking phase of the installation -but it is, at least, the only such error and it doesn’t seem to make any difference to the overall ability of the Oracle software to create, run and manage databases.

Here’s how I did it (and these instructions work for both 10g and 11g, with minor differences noted in the appropriate places).

Step 1: Perform a completely default Ubuntu 9.04 64-bit Desktop installation.

Step 2: Change the PC to use a static IP address rather than a DHCP-assigned one. That’s done by selecting System -> Preferences -> Network Connections. Select your network connection (for example, mine was under the “Wired” tab, called ‘Auto eth0′) and click Edit. Select the IPv4 Settings tab. Change the Method to Manual (from the default “Automatic DHCP”). Click Add and then specify an appropriate value for your Address (e.g., 192.168.0.100), Netmask (e.g., 255.255.255.0) and Gateway (e.g., 192.168.0.1). The Gateway’s especially important because if your Ubuntu machine cannot connect to the Internet, you won’t be able to download the necessary software prerequisites. If your Ubuntu machine is connected directly to the Internet, then of course you leave the Gateway blank. Otherwise, it’s the IP address of your router (or its equivalent, depending on your physical network setup). Also set up a suitable value for your DNS Server and Search Domains. Your DNS Server will either be an internal one if you’ve got one, or the one your ISP provides you with. The Search Domains entry should be the name of your internal network (such as ‘dizwell.home’) if you’re using an internal DNS Server: it’s basically the domain name for which the DNS Server you’ve just specified is authorative. If you don’t have an internal DNS Server, your Search Domains entry can be set to the domain name of your ISP (siuch as ‘telstra.com’).

Once that’s done, make your /etc/hosts file reference your static IP address by machine name. That is, issue the command

sudo gedit /etc/hosts

…and change the top part of the file from this:

127.0.0.1    localhost
127.0.1.1    heracles

…to this…

127.0.0.1    localhost
127.0.1.1    heracles
192.168.0.100 heracles

That is, my Ubuntu machine was created with a hostname of ‘heracles’. By default, that name is only mapped to a loopback address of 127.0.1.1. I’ve just set my IP address to be a static one of 192.168.0.100, so now I’m saying that the new IP address should also map back to my hostname. You obviously change the specific numbers and names used in the file to suit your own situation.

Step 3: Install the necessary software prerequisites:

sudo aptitude update
sudo aptitude install gcc libaio1 lesstif2 lesstif2-dev
     make libc6 libc6-i386 libc6-dev-i386 libstdc++5
     lib32stdc++6 lib32z1 ia32-libs sysstat rlwrap
     unixodbc unixodbc-dev elfutils rpm

(That should all be on one line, of course).

Step 4: Append appropriate entries to the following configuration files…

/etc/sysctl.conf

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
vm.swappiness=5

/etc/security/limits.conf

*       soft    nproc    2047
*       hard    nproc   16384
*       soft    nofile   1024
*       hard    nofile  65536

(Make sure to add those lines before the “# End of file” one).

/etc/pam.d/login

session    required     pam_limits.so

Step 5: Create the Oracle User and all appropriate installation directories

sudo sysctl -p
sudo groupadd nobody
sudo groupadd oinstall
sudo groupadd dba
sudo useradd -s /bin/bash -g oinstall -G dba oracle -m
sudo passwd oracle

(…and supply a password for the oracle user when prompted)

sudo mkdir -p /u01/app/oracle/product/10.2.0/db_1
sudo chown -R oracle:oinstall /u01/app
sudo chmod -R 775 /u01/app

Step 6: Create necessary symbolic links

sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename

Step 7: Set appropriate environment variables for the oracle user

sudo gedit /home/oracle/.bashrc

…and then past these lines onto the end of that file:

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID=ubu102
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH:.
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_LIBRARY_PATH CLASSPATH
alias sqlplus='rlwrap sqlplus'

Note that the above lines assume that you will call your starter database ‘ubu102′. If you want to call it something else, set the ORACLE_SID environment variable appropriately now. Also note that the above content assumes you are installing 10g (it has a ‘10.2.0′ bit in the ORACLE_HOME setting). If you’re installing 11g, that should be replaced with ‘11.1.0′.

Step 8: Become the Oracle User and commence the installation

sudo xhost +
su - oracle
export DISPLAY=":0.0"
/media/cdrom/runInstaller -ignoreSysPrereqs

Note that last command assumes you have created a proper installation CD from the 10gR2 cpio/zip file download. I describe how to do that here.

For the most part, you then just keep clicking [Next] through the Oracle Universal Installer’s screens. You’ll need to change the proposed database name to match what you typed for the ORACLE_SID in Step 7 (in my case, therefore, I changed the proposed ‘orcl’ to ‘ubu102′). You will, of course, fail all of the system tests that the OUI might try to do, but you can click through those regardless and confirm that you know what you’re doing: the thing will work correctly anyway.

As I mentioned at the beginning, you will see an error during the linking phase (relating to ims_emdb.mk) -at least, you are very likely to! I’ve had a couple of installations where no errors at all were raised, but others (following the same instructions, mind!) did. Go figure! If you happen to be unlucky enough to get a linking error, simply click ‘Continue’ when it appears, and the installation should proceed to completion without further incident, correctly creating appropriate networking configurations and a starter database. I wouldn’t call that a particularly robust installation -and there’s no way I’d want to run anything even vaguely of ‘production quality’ on the result! But it does at least work -to the point where I’m running a useful test database on my Ubuntu installation at work, including a very large and demanding Oracle Text index, without any apparent problems.

Ubuntu Internationalisation

Saturday, June 27th, 2009

I wrote some time ago about how to get Debian to allow you to type characters like é, ç, ü and ß -pretty necessary stuff if you are in the habit of typing non-English music track titles (for example). Apply the technique described there to Ubuntu 9.04, however, and you will wreck your X configuration, with reboots into a strictly command-line environment the norm thereafter!

In fact, life is a lot easier in Ubuntu in this regard, because there is GUI support for enabling the ‘compose key’ that lets you type these sorts of non-English characters. Click System -> Preferences -> Keyboard and then select the Layouts tab. Click the Layout Options button, and you’ll see this sort of thing:

Screenshot-Keyboard Layout Options

As you can see, simply expand the Compose Key option and then select whatever key combination you want to invoke the ‘compose behaviour’. I’ve gone for the right-ALT key, but you pick whatever suits you.

Immediately you do that (and click Close, twice), you’ll be able to implement foreign language composition. For example, I’ll launch gedit, press-and-hold the right ALT key and type a comma; when I release all those keys and then type the letter ‘c’, I’ll actually see a c-cedilla (ç). Or, if I hold down right ALT+colon (which means right alt+shift+the apostrophe key), let go, and then type the letter ‘a’, I’ll actually see a-umlaut (ä).

And all much easier, thanks to the GUI, than fiddling with xorg.conf scripts!

Perfect Ubuntu: (Part 5 Performance Tuning)

Saturday, June 27th, 2009

Now that Ubuntu is looking perfect on my desktop (well, sort of!), it’s time to make sure it’s running nicely, too. Here, then, are a couple of safe and modestly effective performance tuning tweaks for Ubuntu (actually, come to think of it, for pretty much any Linux distro!)

I mentioned a while back that when I reboot, I can get a functional desktop in about seven seconds, which is plenty fast enough I suppose! But to really make things snappy after the PC’s up and running, it’s possible to prelink and preload. Programs will often make use of shared libraries to function properly -and those libraries are often loaded into memory as-and-when the program needs them (which process is called dynamic linking… and, in the land of Windows, is what gives us DLLs, or dynamic linked libraries, their name). The problem with dynamic linking is that you never know between each run of a program which bit of memory your shared libraries will be loaded into, so there’s a performance hit whilst the program finds out. Prelinking aims to load the libraries in advance into memory locations that are fixed (more or less) between each run of a program -and, having done that, the program itself can look up those locations just once, on its first load. Thereafter, things should be (moderately) snappier.

It’s very easy to do. In a terminal, issue the command sudo aptitude install prelink. When that’s complete, issue the command sudo gedit /etc/default/prelink and change the line which currently reads ‘PRELINKING=unknown’ to read ‘PRELINKING=yes’. Finally, schedule the thing to search for libraries suitable for prelinking by issuing the command sudo /etc/cron.daily/prelink.  And that’s the job finished.

As for preloading… well, I can’t really improve on the explanation of it in Wikipedia! It’s a little daemon that tries to load oft-needed files into memory when nothing much else is running, and since those files will then be found in memory when they’re eventually required, things should be a little faster than before. Again, dead easy to install: sudo aptitude install preload. And that’s all there is to do.

Finally, for this time at any rate, there’s the good old swappiness setting to tweak. ‘Swappiness’ is the tendency of a Linux PC to page things out of memory down to the hard disk. At its maximum setting of 100, the PC will aggressively swap stuff that’s sitting in RAM out to disk. At its lowest setting of 0, the PC will be extremely reluctant to page things out -meaning that more stuff gets left in RAM (where, we hope, accessing it again will be lightening fast). Putting into words of almost one syllable, therefore: the higher your swappiness setting, the more keen your PC will be to page to disk. Ubuntu ships with a default swappiness setting of 60, which seems a tad high to me. It’s therefore another easy performance tweak to issue the command gedit /etc/sysctl.conf and then add a new line to the end of the file that reads vm.swappiness=0 -or whatever other value you prefer, of course! That new setting doesn’t take effect until you reboot, though. To get the new setting to take effect immediately, you additionally have to do the following:

sudo su
echo 0 > /proc/sys/vm/swappiness

(And note that merely doing sudo echo 0 > /proc/sys/vm/swappiness simply produces a ‘permission denied’ error. You have to do the sudo su bit first so that you are issuing the echo command as root, not as a normal user with sudo privileges)

I should add that the subject of swappiness can provoke something akin to religious war! There’s a good debate to be read here, for example. Good points are made on both sides, including this one:

I don’t know. What if you have some huge application that only
runs once per day for 10 minutes? Do you want it to be consuming
100MB of your memory for the other 23 hours and 50 minutes for
no good reason?

If swappiness was high, in other words, then a huge run-once application would do its stuff and then be paged out of RAM. Having just switched swappiness down to nothing at all, though, I will find that such a run-once-monster application continues to consume RAM. Or, as Andrew Morton (kernel-maintainer-in-chief) himself puts it:

You really don’t want hundreds of megabytes of BloatyApp’s
untouched memory floating about in the machine. Get it out on the disk,
use the memory for something useful.

So, your mileage might well vary – and you’ll be in good company if it does: that’s all I’m saying! For me, a setting of zero works well, especially since I have 8GB of RAM to work with, so if I do ever have BloatyApp sticking around for too long, I probably won’t notice it. The other factor that makes me keen on very low swappiness is that I’m booting off a solid state hard disk. On the one hand, using a SSHD would mean that even if something did get swapped out to disk, I could re-access it with near RAM-like speeds, so a swappiness of 100 would perform almost as well as one of zero. But, on the other, it is unfortunately true of the current generation of SSHDs that if they are written to a lot, they wear out quickly -so avoiding ’swap writes’ might help make my hard disk last longer. Although the tendency of SSHDs to wear out through excessive writes can be exaggerated (it takes a LOT of extra writes!), I do tend to side with the ‘turn down swappiness in the presence of SSHDs’ school, so I’m sticking with my zero setting!

Perfect Ubuntu (Part 1: Installation and Graphical Bling)

Saturday, June 20th, 2009

(Well, perfect for me, anyway!)

I seem to be addicted to installing operating systems, to the point where there are times when I don’t think I actually do anything productive with my PCs except install operating systems on them! I got bored with Debian a while ago, and so (naturally!) installed Windows 7 RC1. That’s been running really well, so (equally naturally) I got bored with that and decided to replace it with something else. On this occasion, having been using Ubuntu 9.04 (32 bit) as my desktop at work (they take a liberal line on what we’re allowed to install on our work PCs, thankfully!), and having gotten to like it very much over the past couple of weeks, I decided to install Ubuntu 9.04 (64 bit) over the increasingly mundane Windows 7. The new installation may not last an awful lot longer than any of the several hundred previous ones, but at least I can spend my weekend having some fun!

The specs of this particular PC are quite reasonable: Quad Core 9550, 2.8GHz, 8GB RAM, 60GB solid state hard disk, plus 2 x 200GB Seagate HDDs, plus 2 x 1TB Samsung HDDs, 1 24″ monitor (1920×1200) plus 1 18.5″ monitor, Nvidia 8400-GS graphics card (nothing special required for a guy who mainly plays Solitaire!) and Canon PIXMAR 210 printer. The 2 200GB drives had previously been used in (SATA) RAID-0 as a boot drive for Windows 7 RC1. The 2 1TB drives had previously been used as a RAID-1 set, using software RAID in Windows 7 (that is, the disks had been converted to dynamic disks, and a Windows mirrored pair created). Internet connection is via a wireless broadband USB modem plugged into an ancient laptop running Windows XP and shared to the household courtesy of Windows’ own Internet Connection Sharing (so all other PCs have their IP addresses assigned by DHCP). Since I am confidently expecting Ubuntu to not understand the 200GB ‘fake raid’, still less the 1TB Windows software raid, I backed up all the important stuff onto an external USB drive earlier in the week.

The Installation

I tried going straight for the ‘install’ option off the CD, but that would simply get to a 1280×1024 display of the Jaunty wallpaper and then hang (no menus or anything). So I unplugged the second monitor (on the grounds that maybe that was confusing things) and booted into the Live CD environment. Everything worked fine -and even the 24″ monitor’s resolution was set correctly (which is something of a first for any Ubuntu version as far as I can remember!) I then selected the ‘install’ option from the Live desktop. Partitioning was fine: I left all the traditional hard disks alone for now, and simply wiped the 60GB Solid State disk, creating a 4GB swap partition (probably unnecessarily, to be honest) and assigning the rest to the root partition. I formatted that with ext4 (for I feel like living dangerously!) Installation was predictably straightforward thereafter, and the thing even managed to reboot correctly into a fully-functional Ubuntu 9.04 x86-64 desktop at the end of it (and Grub having managed to install itself correctly in my environment so that could happen is also something of a first in my experience!)

Post-Installation

The Update Manager launched itself after I’d been logged in for a couple of minutes and proposed 97MB of upgrades to be installed. I simply accepted that proposal without demur. During that installation, the Printer Driver dialogue popped up warning me that no driver for my printer could be found. I used the Printer Configuration wizard that had been launched automatically to select the nearest match (a Canon PIXMAR 220), and that seeems to be working just fine. Once the Update Manager had finished doing its thing, it prompted me to restart my machine: I am gratified to note that from the time the Grub bootloader launches to the time I get to log in, just 7 seconds elapses!

Blinging the Desktop

Time to jazz things up a little, graphically, and so I take the System -> Administration -> Hardware Drivers menu options, selecting to ‘activate’ the Nvidia 180 accelerated graphics drivers. The download and installation take just over a minute, and I am then prompted to restart the PC once more (I thought this was Linux and that sort of thing wasn’t necessary?!!) Actually, I decide to shut the machine down, plug in the second monitor once more, and then boot up.

The second monitor is completely dark (but at least the main one still works OK!). There is always the System -> Administration -> NVIDIA X Server Settings tool, of course, but previous experience in Debian has taught me that using it from those menu options is a complete waste of time… because changes to my X configuration will need to be written to /etc/X11/xorg.conf, and that will require root (or, in Ubuntu’s case, sudo) privileges. Instead, therefore, I open a terminal and type the command sudo /usr/bin/nvidia-settings. The tool launches fine and tells me the nature of the problem: the second monitor has been disabled by default. I select to configure it in TwinView mode, save the configuration file, quit the tool and log out. When I log back in, the second monitor springs to life and all looks good. I go back into the NVIDIA configuration tool, however, to make one slight adjustment that it wouldn’t let me make first time around:

Setting the spare monitor position down a bit

Setting the spare monitor position down a bit

The subtle point here is that the spare monitor is set to align to the bottom of the main monitor, not the top (as it is by default). Doing that involves dragging the purple-y block representing the spare monitor down a bit: quite why that was impossible to do first time around, I’m not sure. Anyway, one more log out and in, and all is fine in the graphical department. Elapsed time since the installation finished: about 4 minutes, which isn’t bad, I think.

With the drivers all sorted out, I can finally enable some graphical bling (because I love it, especially desktop cubes!)

System -> Preferences -> Appearance and select the New Wave theme (it’s not perfect, but it’s better than the default Human one). Then, System -> Administration -> Synaptic Package Manager and type in compiz in the search box. Select to install the compizconfig-settings-manager (plus its dependencies). When that’s been installed, System -> Preferences -> CompizConfig Settings Manager and select the appropriate effects. I switch on Desktop Cube (requiring “Desktop Wall” to be disabled), plus Minimize Effect (disabling ‘windowanimations’) and Wobbly Windows (disabling Snapping Windows). After wondering why the Desktop Cube didn’t actually do very much, I realised I should also have switched on the Rotate Cube effect. Additionally, for the cube actually to be a cube rather than a plane with just two faces, I needed to right-click the Workspace Switcher (at the far right-hand of the bottom panel, just next to the recycle bin icon), select Preferences and change the ‘columns’ settings from its default 2 to a more sensible 4. That gets you a proper desktop cube when you Ctrl+Alt+Right Arrow (or left arrow, come to that!) or when you hold down Ctrl+Alt whilst clicking and dragging anywhere on the desktop (it’s easier to do than it sounds!)

I haven’t yet decided if I want multiple cubes (one per monitor) or a single giant cube: if only I’d paid for a second screen the same size as my main one, I think the decision would be a lot easier!! For now, I’ve switched on multiple cubes (in the CompizConfig Settings Manager, actually click on the Desktop Cube icon, rather than selecting its checkbox), but that may change.

Finally, run to Interfacelift.com and get some nice wallpaper to replace the ghastly orange thing Ubuntu ships with. The only trouble I had at this point was, again, my dumb choice of a smaller screen (and hence smaller screen resolution) for my second monitor as compared to the main one: 1920×1200 on one, but only 1600×900 on the other… so what resolution wallpaper should I download?! Well, I experimented with the dual-screen option that Interfacelift sometimes has for certain images (a 2560×1024 one was available, for example), but I had to stretch that to fit the main monitor’s higher vertical resolution, and that looked pretty horrible. I also tried the 2560×1600 option, but I had to scale that down, and that looked weird, too. In the end, I download the plain vanilla 1920×1200 one and tiled that: the sky gets chopped out on the second monitor, but it otherwise looks pretty decent, I think:

desktopwallpaper

Just bear in mind that I don’t get to see that chunk of black at the top of the right-hand screen, because the second monitor’s display is only as tall as the part of the picture underneath that. That’s what moving the alignment down in the NVIDIA configuration tool did for me, after all.

My last major piece of blinging-up the desktop was to install a new icon set (because I don’t particularly like the Human one Ubuntu ships with). Instead, I use Dropline Neu. Download that, saving it to the desktop. Then System -> Preferences -> Appearance and click Install. Point to the new icon file and then select the ‘Apply new Theme’ option when prompted. I also took the opportunity to click ‘Customize’, select the Colors tab and then change the colours for Selected Items and Tooltips (to #568AFF and #C4D6FF respectively): the aim is to get rid of any orangey-ness about my desktop altogether!

Very finally (for now!), use System -> Preferences -> Screensaver to switch to ‘Random’ rather than the default ‘Blank ccreen’ (which is very black and very boring!)

Total time taken so far: about 20 to 30 minutes. My PC boots like lightning, looks good and the desktop rotates at my command, which is the main thing.