Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Friday, March 07, 2008

    The answer is 42

    But what is the question?

    Not sure why the discussion http://news.bbc.co.uk/1/hi/magazine/7283155.stm now? But fun reading contributions...

    Thursday, February 07, 2008

    CentOS 5 on SATA drives

    Making SATA drives work in Linux still seems a bit of a dark art.

    I had a failure yesterday, with CentOS 5 refusing to even enter rescue mode or install procedure, asking for the driver.

    Many suggestions are posted on various sites, most of them indicating that changing BIOS settings from SATA to IDE, or even to RAID should allow to get past the problem. None of these worked for me. What did work, was giving all-generic-ide parameter to the kernel.

    So, to entering rescue mode (one goes there usually to fix bootloader, such as grub, configuration problems), place you first installation CD (od DVD) in the drive, start the machine, and wait for the boot: prompt. Then type:

    boot: linux rescue all-generic-ide

    For fresh installs, just start up the machine just as described above, except that you will enter:

    boot: linux all-generic-ide

    Tuesday, February 05, 2008

    Making the best of VESA drivers in CentOS 5

    Teaching in Edinburgh, on machines that flatly refuse to switch between CLI and GUI. Going into any of the CLI (CTRL_ALT_F1 - F6) is no problem, but restarting the X server or switching back from CLI gives random, hardly ever successful results.

    Last week a couple of colleagues (Donald and Gary) were saying about dropping resolution, this week one of our techies (Stuart) found advice about vesa. Neither approach worked on its own, but put them together (albeit in a slightly modified way) and all is well.

    If your GUI is working

    Select:

    System --> Administratio
    n --> Display (may need to put root's password if logged in as ordinary user)
    Select Hardware tab
    Configure "Monitor Type" to Generic LCD --> LCD Panel 1024 x 768
    Configure "Video Card" to "vesa - Generic VESA-compliant video cards"
    Do the OK three times.

    I always check the config on RHEL/CentOS before restarting the GUI. Either look inside the configuration file (/etc/X11/xorg.conf, attached below) or check the System-->Administration-->Display-->Hardware settings (note that the vesa driver will be described as "Unknown video card").

    To restart the GUI press CTRL-ALT-Backspace - all should be well.

    If your GUI is NOT working

    If the GUI is broken to the point you can't use the method above, you can hack the file directly, or enter the configuration screen from the command line. For that, log in as root on CLI (enter CLI with CRTL-ALT-F1), then enter:

    # system-config-display

    The system will use basic GUI settings to 'draw' the menus. Use the solution as provided above to complete the steps.

    To start the GUI, the cleanest method I found is to 'recycle' runlevels: change into runlevel 3, then into runlevel 5.

    # init 3
    Several messages will be printed, when you see one fron "anaconda" hit enter. That will re-print the prompt. Now type:

    # init 5

    XWindows should start successfully!


    ===============================================
    sample /etc/X11/xorg.conf using defaults for both the server and the monitor
    ===============================================
    Section "ServerLayout"
    Identifier "single head configuration"
    Screen 0 "Screen0" 0 0
    InputDevice "Keyboard0" "CoreKeyboard"
    EndSection

    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "gb"
    EndSection

    Section "Monitor"

    ### Comment all HorizSync and VertSync values to use DDC:
    ### Comment all HorizSync and VertSync values to use DDC:
    Identifier "Monitor0"
    ModelName "LCD Panel 1024x768"
    ### Comment all HorizSync and VertSync values to use DDC:
    HorizSync 31.5 - 48.5
    VertRefresh 40.0 - 70.0
    Option "dpms"
    EndSection

    Section "Device"
    Identifier "Videocard0"
    Driver "vesa"
    EndSection

    Section "Screen"
    Identifier "Screen0"
    Device "Videocard0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 24
    Modes "1024x768" "800x600" "640x480"
    EndSubSection
    EndSection



    Making the best of VESA drivers in CentOS 5

    Teaching in Edinburgh, on machines that flatly refuse to switch between CLI and GUI. Going into any of the CLI (CTRL_ALT_F1 - F6) is no problem, but restarting the X server or switching back from CLI gives random, hardly ever successful results.

    Last week a couple of colleagues (Donald and Gary) were saying about dropping resolution, this week one of our techies (Stuart) found advice about vesa. Neither approach worked on its own, but put them together (albeit in a slightly modified way) and all is well.

    If your GUI is working

    Select:

    System --> Administratio
    n --> Display (may need to put root's password if logged in as ordinary user)
    Select Hardware tab
    Configure "Monitor Type" to Generic LCD --> LCD Panel 1024 x 768
    Configure "Video Card" to "vesa - Generic VESA-compliant video cards"
    Do the OK three times.

    I always check the config on RHEL/CentOS before restarting the GUI. Either look inside the configuration file (/etc/X11/xorg.conf, attached below) or check the System-->Administration-->Display-->Hardware settings (note that the vesa driver will be described as "Unknown video card").

    To restart the GUI press CTRL-ALT-Backspace - all should be well.

    If your GUI is NOT working

    If the GUI is broken to the point you can't use the method above, you can hack the file directly, or enter the configuration screen from the command line. For that, log in as root on CLI (enter CLI with CRTL-ALT-F1), then enter:

    # system-config-display

    The system will use basic GUI settings to 'draw' the menus. Use the solution as provided above to complete the steps.

    To start the GUI, the cleanest method I found is to 'recycle' runlevels: change into runlevel 3, then into runlevel 5.

    # init 3
    Several messages will be printed, when you see one fron "anaconda" hit enter. That will re-print the prompt. Now type:

    # init 5

    XWindows should start successfully!


    ===============================================
    sample /etc/X11/xorg.conf using defaults for both the server and the monitor
    ===============================================
    Section "ServerLayout"
    Identifier "single head configuration"
    Screen 0 "Screen0" 0 0
    InputDevice "Keyboard0" "CoreKeyboard"
    EndSection

    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "gb"
    EndSection

    Section "Monitor"

    ### Comment all HorizSync and VertSync values to use DDC:
    ### Comment all HorizSync and VertSync values to use DDC:
    Identifier "Monitor0"
    ModelName "LCD Panel 1024x768"
    ### Comment all HorizSync and VertSync values to use DDC:
    HorizSync 31.5 - 48.5
    VertRefresh 40.0 - 70.0
    Option "dpms"
    EndSection

    Section "Device"
    Identifier "Videocard0"
    Driver "vesa"
    EndSection

    Section "Screen"
    Identifier "Screen0"
    Device "Videocard0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 24
    Modes "1024x768" "800x600" "640x480"
    EndSubSection
    EndSection



    Monday, January 21, 2008

    21 January - time to get depressed ?

    Today is meant to be the most depressing day of the year.

    Considering that Inland Revenue admitted they owed me a lot of money, the sun showed it's shine over Sywell for the first time in weeks and I have managed to complete my dreadful paperwork for the last so-many months of expenses, I've not been doing too badly!

    And then a colleague asked me for a couple of slides she wanted to include in her presentation. At this point I realised that my ambitious plans to convert fully to Open Office are flawed. It's the second time in two days I had to rapidly save an '.odp' file into the '.ppt' format, just so other people in the company could use it.

    Time to admit defeat. And back to CrossOver Office. Got a professional copy, payed on-line and downloaded the .deb version. All went smoothly. Shame it doesn't allow Office 2007, but Office XP installed without a hitch.

    Oh well, the "happy - depressed" balance restored ;-)

    Friday, January 11, 2008

    Moving to OpenOffice Impress 2.3

    Now that my laptop is fully Linux'ised, I am making a brave attempt to convert all my .ppt documents (mostly qa-iq course-related ones) into a Open Document Presentation format. Luckily, our printers use PDF format for printing. That means that it doesn't really matter which office suite I use for the design, as long as I can convert it into a PDF before it's sent to the printers. In fact I bet that nobody is going to notice that I no longer work with the .ppt format (just as nobody noticed that all my timesheets, expenses and all other paperwork is now done in OpenOffice - I just save it as a .ppt file).

    On the whole, the compatibility of .ppt and .odp is good. Fonts are still rather dissimilar, and this is one area I will have to investigate (although the rendering of characters imported from .ppt file is sufficiently good for me not to loose sleep over the issue).

    What kept me guessing for a long time is the method of setting the notes pages' header and footer. In PowerPoint this is done in Master View --> Notes. However, the .ppt imported into OpenOffice 2.3 treats these headers and footers as standard text boxes. So any change (like document version which we set in the Notes view footer) would have to be done for each page.

    Well, in OpenOffice, text to appear on each slide is done in View --> Header and Footer. Once customised, select "Apply to All".

    So far, there is just one feature I miss in the Open Office Impress - the style painter. It does now exist in the OpenOffice, but its scope is very limited and nowhere as useful as it is in Power Point.

    Tuesday, January 08, 2008

    The Dell saga continues

    What a see saw the last few weeks has been. I love my little new dell (some would say it's not so new anymore), and I love Ubuntu. Somehow however, they didn't like each other much. Having search various posts, I strongly believe that Ubuntu 7.10 (gutsy) has been rushed out, and it clearly has bugs, mostly with handling SATA disks and networking.

    After my last post, I was installing and fine-tuning various applications, hoping to arrive at the final (and perfect ;-)), of course) system configuration. Disappointingly, but I hit several re-occurring problems, which put the stop to these ambitions... Most of the issues have been well documented by others - inconsistent wireless recognition, many SATA warnings popping on the console (even though actual disk access was fine), very slow desktop start-up, cupsd taking up to 5 minutes to start.

    The worst aspect of these problems has been the random, unpredictable nature of them, with problems virtually impossible to reproduce. I'm well used to fixing systems - you expect hiccups, and you anticipate having to dive under the hood of any new version or distribution. This is part and parcel of playing with UNIX or Linux. And one of the great historical attributes of UNIX has been its transparency - you can always get to the bottom of things. Not quite so with the new kernel releases. More and more traditionally user-driven hardware manipulation and control is delegated into kernel's functionality. It's great in some respects - faster, more secure and easier to tie down system. But for an average sysadmin, ability to debug and fix is becoming more obscure and complex, if not difficult.

    Monday, October 29, 2007

    Re-installing Dell XPS M1330 (Part 4)

    Well, the machine is ready for Linux. I have preserved the original software by installing it in a much smaller partition, allowing most disk space to be left for Linux.

    Obtain installable Ubuntu CD-ROM
    ------------------------------------------------
    Well, the system is ready for Linux installation. One little detail first - need to get the Linux software itself. I decided to go for the highly recommended Ubuntu, after the less than successful attempt with CentOS. No time to order a ready made CD or DVD, so need to download the ISO image (onto an XP box) and burn the CD disk. One reason for the choice is that this is the distribution that Dell use when pre-installing their machines with Linux.

    1. Download Ubuntu 7.10 Gutsy Gibbon (ISO image).

    There are numerous sites that will sell disks with the image on it. But if you have a decent bandwidth, it's cheaper to download your own. My bandwidth is useless, but it was still quicker than ordering disks and waiting for delivery.
    I got the image from: http://www.ubuntu.com/getubuntu/download. It took nearly 3 hours for the 712MB image (ubuntu-7.10-desktop-i386.iso) to land on my Desktop.

    2. Download ISO file burning software (unless you already have it)

    Many commercial programs exist. I used a freeware program: ISO Recorder v2 from http://isorecorder.alexfeinman.com/isorecorder.htm. Once the ISO Recorder is installed, "Copy image to CD" option will appear when you right-click in the ISO file.

    3. Having inserted empty CD in the drive, locate the ISO file you have downloaded, right-click it, and select the "Copy image to CD" option. Follow the steps - it will take few minutes for the new disk to be written.

    Boot from the Ubuntu CD and install it on hard disk
    --------------------------------------------------------------------
    Select "Start or install Ubuntu". Watch the little orange bar for a couple of minutes, then a blank screen for a minute or so, eventually Ubuntu starts the services. This will initially start Ubuntu as Live CD (i.e. run directly off the CD). Linux is at that point in memory (and using the CD). However, we will use this to install Ubuntu permanently into the spare partition on the hard disk.

    Double-click the Install icon, to start Install program.

    Welcome screen - press "Forward" (notice default is English)

    Where are you? - Use the map to locate a city in your timezone (London for me).

    Time zone is shown as BST (GMT+1:00) - press "Forward"

    Keyboard layout - press "Forward" (unless you are not in the UK, in which case change it! )

    Prepare disk space - select "Manual" (see Note 1 below for the rationale of my partition layout that I am suggesting) - press "Forward"

    Prepare partitions - on my machine, the current layout showed:

    Device Type ... Size Used
    /dev/sda
    /dev/sda1 fat16 ... 49 MB 33 MB
    /dev/sda2 ntfs ... 42952 MB 14700 MB
    /dev/sda5 154890 MB unknown
    /dev/sda6 fat32 ... 2154 MB 50 MB

    Highlight /dev/sda5 and press "Delete partition" - it should now show as "free space"

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 150 MB ext3 /boot

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 2000 swap

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 5000 MB ext3 /

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 10000 MB ext3 /home

    Highlight the "free space" line and press "New partition".
    Fill the form with: -10000 MB ext3 /usr

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 1000 MB ext3 /var

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 850 MB ext3 /tmp

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 2500 MB ext3 /spare1

    Highlight the "free space" line and press "New partition".
    Fill the form with: - 2500 MB ext3 /spare2

    Press "Finish", then "Ignore" (if you got it, see Note 2 below)

    Migrate Docs and Settings - press "Forward"

    Who are you? - fill in the form; press "Forward"

    Ready to install

    Note 1.
    I never trust automatic partitioning tools - they never seem to split the disk in a sensible way.I want to share files with Windows, hence fat32 partition.

    I'm of a traditional UNIX school, where a separate partition is used for just about anything ;-). I always have at least one spare partition, for rescuing data from broken partitions, experimenting, trying new or experimental filesystem types, etc.

    This time I've ended up with 2 spare partitions, because one of them was going to be vfat type. This didn't work (see Note 2), but I will try changing the type later on, once the system is up and running.

    Note 2.
    Issues I had during the install:

    When partitioning, after creating all partitions I wanted, I have then selected the rest of the disk and assigned the "don’t_use" filesystem type. What a mistake - the process crashed. Waited a long time hoping that the little timer indicating that something is happening would time out and allow me to continue. Nope. Had to cancel the whole procedure and start from scratch (all the way from double-clicking in the Install icon). Second time round tried fat16 instead of fat32. Same problem. Tried to "Ignore" it, but when the actual partitioning started, got a new message:

    "Failed to create a file system: The fat 16 file system creation in partition #4 of SCSI1 (0,0,0) (sda) failed. Press "OK".

    This put me back into the partitioner (but I had to select "Manual" again. However, at least the partition information was remembered. Just had to go through each one and allocate type and mount point. At this point, I have also given up on the fat partition, and set it to free space (by deleting it).

    Once the complete partitioning process, you need to press "Finish". At this point, the Warning message popped:

    "File system doesn't have expected sizes for Windows to like it. Cluster size is 2k (expected 1k); number of clusters is 24026 (47959 expected); size of FATs is 94 sectors (188 expected). I chose to ignore this message and pressed "Ignore".

    Re-installing Dell XPS M1330 (Part 3)

    Using Dell MediaDirect (TM) 3.3 to partition disk
    --------------------------------------------------
    Before I move on, I need to give credit to another blogger, who published a quick howto about installing M1330 with dual boot configuration: (http://linuxevangelist.blogspot.com/2007/10/dual-boot-in-dell-xps-m1330-with.html). Without his information, it would've taken me a lot longer to realise that the MediaDirect disk is more than an application. It is a bootable CD, and is important for partitioning and making sure that Vista would be able to make use of the various media buttons the M1330 has (at this point I'm not sure if Linux will be able to use them ).

    Installing Vista
    --------------------------------------------------
    Put Vista disk in the drive and restart the box. Follow the few simple instructions. No problem with the install, except I had to insert the disk several times before it started - I hope I don't have an inherent CD or drive problem! A quick reboot into Vista to confirm it worked - it did, after a fashion. What surprised me is, though, it started into 800x600 resolution! A quick adjustment (Start --> Control Panel --> Appearance and Personalization: Adjust Screen Resolution) and slide the resolution to 1280x800.

    Worked fine, but I thought Windows do these things automatically. Hmmm.

    Installing Drivers and Utilities (grey Driver and Utilities disk)
    ---------------------------------------------------------------------------
    Insert the Drivers and Utilities CD disk in the drive. Select "Run..." in the AutoPlay pop up screen. Say "OK" to start. On my machine, the virus wizard showed a warning: "An unidentified program wants access to your computer". Not really knowing what it's about, I can only assume that driver setup.exe is regarded as potential virus. So, selected "Allow". A couple of more "OK" clicks and 30 seconds later the Dell Resource Disk printed a Welcome message with hardware, drivers and hardware utilities being displayed. Close this screen, and you will find that behind it the install wizard is waiting for you to press "Finish". Do that. Eject the disk (with the eject touch key above the main keyboard).

    Installing Dell Webcam Manager (blue Driver and Utilities disk)
    ------------------------------------------------------------------------------
    Insert the Drivers and Utilities CD disk in the drive. Select "Run..." in the pop up screen. Scroll to the bottom of the licence text and press "Yes" to accept the licence. Unless you have a good reason to change the default destination for the drivers to go to, accept the default location: c:\Program Files\DELL. Select the "Full Installation".

    The "Dell Webcam Software" screen will be displayed, and this stage of the installation should take not more that 5 minutes.

    Allow the laptop to restart (default action on "Finish"). The CD will be automatically ejected, and the machine will reboot.

    Installing Dell MediaDirect(TM) 3,3
    --------------------------------------------------
    Insert the Drivers and Utilities CD disk in the drive. Select "Run..." in the AutoPlay pop up screen. Say

    Another warning from the virus - press "Allow" again, Then "Enter" to start installation. First time round the disk got stuck again (you know when it happens, because it starts making repeatable noises). Had to eject the disk and restart the process. Not happy about it!

    But eventually it all worked, and MediaDirect installed itself in a separate partition. Another reboot to confirm it's all installed and working from Windows perspective. Vista booted fine, all touch keys work OK (although I haven't really played any media with it - can't wait to put Linux on and see how it can handle the same hardware).

    So, the next step is to obtain Linux - this time I'll go for Ubuntu - and install it in the free space.


    Friday, October 26, 2007

    Re-installing Dell XPS M1330 (Part 2)

    I only need Vista for MS for a few applications used at work. Other than that, everything I need can be done by Linux.

    Also, I don't want *all* applications installed by default, so I had to start from scratch. As every self-righteous know-it-all techie, I threw the Vista install disk in, to re-install, clean up the disk and repartition it in the process.

    Allowing your M1330 to boot from DVD
    --------------------------------------------------
    First little hiccup that surprised me was that CD/DVD is after hard disk in the BIOS booting sequence.

    Not a problem: reboot the system, hit F2 as soon as the first Dell screen appears and locate under "System" the "Bootable Sequence" menu item. Scroll down to it, press <Enter>. Now, with the list of available bootable devices displayed, reshuffle them to have HDD after DVD. Nice to see that booting from a USB device is available: reassuring if not surprising.

    There is some help at the bottom of the BIOS setup screen. I couldn't get how to actually move the entry. If up/down arrow keys are described as Up/Down arrows (to select the line), what could U/D mean (to move the entry)? Well, trial and error proved that U/D means Shift-Up or Shift-Down arrows. Obvious !?

    My preferred sequence would be:

    1. CD/DVD/CD-RW Drive
    2. USB Storage Device
    3. Internal HDD

    That's for my personal use - security consideration may dictate different approach (not a good idea to allow booting from removable media in a commercial environment).

    Once you have the correct sequence, do ESCAPE, then choose Save/Exit and Enter. That will accept your new setting and continue booting the system.

    During my first attempt, I have followed this with a fresh install of CentOS 5. It kind of worked, however, no sound, Ethernet or wireless were recognised. Screen required adjustments, but was fine after that. However, on reboot, although Vista was shown (as "other"), it wouldn't boot - missing MBR!

    Not very worried about any of this - I never expect my first install to work. But I decided to take a step back, and rethink my approach. A bit of googling didn't go amiss. There was a very useful blog entry from a chap who tried to achieve a similar configuration, and I took his advice. More in the next part...

    Re-installing Dell XPS M1330 (Part 1)

    I have invested a few pounds ;-) into a gorgeous toy. I want to start playing with applications that require a dual core processor, have a bit more memory and disk. For one thing, I will be investigating virtualisation, first step: ESX from VMWare, now that we are the authorised training place for them. If anything, I need to understand exactly the Linux portion of the product (Linux for ESX administrators course will follow soon).

    This is a great excuse to have a box with the spec:

    System Info:
    ---------------------------
    System: XPS M1330
    BIOS version: A06 (09/03/2007)

    Processor Type: Intel(R) Core(TM)2 Duo processor
    Max. Clock Speed: 2.2 GHz
    Processor Cache: 4096 KB
    Dual Core Present: Yes

    Memory Info
    ---------------------------
    Installed: 4096 MB
    Speed: 667 MHz
    Channel Mode: Dual
    Technology: DDR2 SDRAM
    Device Info
    ---------------------------
    Primary Hard Drive: 200 GB HDD
    Video Memory: 128 MB
    Panel Type: 13.3" Wide XGA
    Native Resolution: 1280 by 800

    It's got all sorts of other bits and pieces, WIFI, bluetooth - of course, fingerprint recognition, camera, and a product called MediaDirect, which I haven't yet sussed out.

    My first task is to reinstall it. I want a minimal install of the Vista the box came with, and Linux, which will take over most of the tasks. First quick reinstall has proven that RedHat derivatives couldn't cope. Very few devices were recognised with CentOS 5 or Fedora 6. So I decided to give the highly recommended Ubuntu 7.10 Gutsy.

    Well, I'm in business, incredibly impressed with Ubuntu. I am documenting every step of my attempts, and will be posting them in turn, as things progress.

    The next post will cover the partitioning and preparing for Ubuntu install without losing any facilities and drivers used by Vista.



    Wednesday, October 24, 2007

    An example of using eval

    When learning (or teaching) eval, the first - and very valuable - example of it is to see eval's ability to evaluate the value of the last positional parameter:

    $ set a b c d

    $ eval print -- \$$#

    d


    We use eval it to force the shell to perform a double scan, when we need to find a value of a value. First scan will evaluate the $# to the number of available parameters (in this case: 4); the second scan will check the value of it (d). This is 'bread and butter' of eval application.

    Other cases of using eval are a bit more obscure, and for that reason eval is often forgotten...

    Here is an example that is not 'that' obscure - and possible quite useful. A delegate wanted to rename all files in a given directory, to change the character case from lower to upper. What he devised, successfully, is as follows:

    for file in *

    do

    mv $file $(echo $file | tr '[a-z]' '[A-Z]')

    done



    This worked, until he found that some of the files contained 'unfriendly' characters: spaces. The script failed to cope with this.

    This is where eval stepped in:

    for file in *

    do

    eval mv '"$file"' \"$(echo "$file" | tr '[a-z]' '[A-Z]' )\"


    done

    In this case eval allows to insert an additional set of double quotes, which protected spaces embedded in file names.

    Wednesday, October 17, 2007

    ksh93 - test, test and then test a bit more

    Since ksh93 is now [1] available for most version of UNIX (and Linux), we have been tentatively moving our courses (especially scripting) towards the new syntax. At the moment the scripting course is still based predominantly on the pre-93 versions, but we now introduce a fair amount of comparisons, 'gotchas' and demos of new capabilities and syntax.

    Truth is, months later we still find new idiosyncrasies.

    Here is one I found today, whilst teaching... Imagine the following example, to illustrate the need for double quotes when creating and accessing variables:

    If you want to assign a value that has leading or trailing spaces or tabs, you need the quotes:

    $ address=" 6 Pie Corner"

    Would you expect to see the leading spaces if you didn't use the quotes when accessing the variable? Of course not! Well, in ksh93 it works! Haven't checked yet if this behaviour is driven by any particular setting or switch, but in my CentOS 5 ksh (Version M 1993-12-28 r), the following worked out of the box:

    $ print -- $address

    <space><space>6 Pie Corner


    [1] in the original posting this said 'not' - corrected 18/10/2007

    Monday, October 15, 2007

    No access to ntp source?

    When you install Linux on a PC, you may find that the hardware clock enforced the time. Normally, you would use the ntpd (network time protocol daemon) to synchronise the system (software) time with a selection of external sources.

    However, what if you are not connected, or for some reason just don't have access to time servers (for example the ntpd port 123 is blocked)?

    Well, unless you need to maintain a precise time (in which case you still need to find access to a reliable source), you can just use the good old date command and inform the hardware clock of the change.

    # date --utc 101517052007.00

    will update the system (software) clock and set the current time and date to: Oct 15 18:05:00 BST 2007.

    The only problem is that system clock doesn't run when your machine is powered off. What does continue to run is the hardware clock. It ticks forever. External power present or not. Because on start-up the hardware clock is used, you need to flush the system date into the hardware clock, and as long as the hardware clock is accurate enough, your newly adjusted time will be persistent over reboots.

    Use the hwclock tool to achieve this:

    # hwclock --systohc

    Do remember, though: this is 'quick and dirty'. If you require consistent and accurate time keeping, you need to synchronise the system clock with an external source...

    Saturday, August 18, 2007

    How much do people pay for Windows software?

    There is a discussion brewing in our local LUG, to do with almost philosophical aspect of software theft.
    The basis for the thread lie in one of the most interesting articles on the subject I have ever read:

    http://tlug.jp/articles/Windows_Is_Free

    As many before, it explores moral aspects of using "second hand" software, but less usually, it attempts to analise the implication of cracked software on the industry itself and how, ironically, the effectively free windows software distorts the balance of marketing power between windows, mac OS and linux.

    Keyboard layout in Solaris 10

    If there is a way of setting UK keyboard during Solaris 10 installation - I don't know it! However, the /boot/solaris/bootenv.rc has a directive for that - just change US to UK.

    A reboot, unfortunately is necessary...

    Monday, July 09, 2007

    Keyboard layout in Centos

    I have been playing with Centos 5, which is the community binary for binary version of RHEL 5 (with various elements, such as text and graphics depicting or referring to Red Hat replaced with Centos, quite legally, might I add). It's an excellent alternative, as long as you don't expect a 24/7 support, or automatic updates or any of the value added stuff that a formal contract from Red Hat provides.

    Anyway, the install from the DVD onto my Vaio PCG-V505BP went without any problems. Selected "Gnome Desktop", "Server" and "Server-GUI" software, and the only other customisation was disk partitioning (I like my partitions to be done the old-fashioned UNIX style).

    So, as I said, the installation completed successfully, and to my best knowledge all hardware was recognised OK (still testing, so can't be totally sure). One little surprise, though - the keyboard layout was the US, not UK! Well, it is quite possible that I messed it up myself (when selecting the keyboard during installation). Either way, I went to correct it by hand, and thought I'd document it. It's quite straightforward, but a thing to remember is that two different configuration files need to be changed.

    For CLI (character interface screen, accessed through CTRL-ALT-F1 - F6) you need to modify the /etc/sysconfig/keyboard. Change the KEYTABLE line to read:

    KEYTABLE="uk"

    This will have immediate effect, and any new CLI session will assume the correct keyboard.

    For GUI screen terminals, you need to change the Xorg configuration file: /etc/X11/xorg.conf. In the "Section InputDevice", identify the line with XkbLayout and modify it to read:

    Option "XkbLayout" "uk"

    Unlike CLI setting, this GUI change will only take place after GUI session is restarted. I have tried the standard CTRL-ALT-Backspace, to restart Xorg server, but it didn't work! Well, not for the first time. On many systems this is disabled.

    I refuse doing a full reboots lightly, so I tend to 'recycle' GUI instead. First of all, make sure you don't have any GUI-dependent users or applications before you carry out the next step (they may not like being kicked off the system without a warning).

    To 'recycle' GUI means switching runlevels to 3 than to 5 again. To do that: open a CLI session (press CTRL-ALT-F1), log in as root, and switch runlevel to 3 with:

    # init 3

    Once the 'anaconda' message appears on the screen - you are in runlevel 3, even though you see no new prompt. Hit "Enter", and the prompt will be printed. At that point, switch back into runlevel 5 with:

    # init 5

    Your new keyboard layout is now available to all users.

    Thursday, July 05, 2007

    Default gateway in Solaris 10

    I'm spending a lot of time switching between different versions of UNIX and Linux, and the detailed syntax of the command line stuff keeps catching me out. So I will start documenting for myself (and any QA-IQ colleagues) some of the most popular things that are needed in our classrooms.

    This week it is a turn of Solaris 10 (ix86), in our Swindon office. Our infrastructure is such that the 192.168.1.254 gateway requires an argument of 1 where the 'metric' value used to be. No rocket science - just the command line syntax, but it kept me unconnected for far too long (or am I getting too indoctrinated by the Linux syntax and the power of the ip command there?).

    Anyway: to add the default gateway to the Solaris 10 :

    # route add default 192.168.1.254 1

    Then obviously adjust the browser settings to the correct proxy for your location (with port 8080 on QA-IQ sites). In the Mozilla version provided with Solaris 10 you can find the settings in Edit --> Preferences --> Advanced --> Proxies.

    Get it back together again

    Had so many changes within the company - blog went onto the back burner. Things are getting calmer and easier again, and hopefully I can get on with it properly. With any luck, the postings will start coming out again...

    Sunday, May 06, 2007

    Forcing hp2400 to print double sided

    Needed to print a set of labs for a new version of a course. Run out of time, and although the manuals are being printed, the labs documents had to be done by hand! So to save the Amazon, I managed to get my printer to print double-sided! Although this is specifically for the hp2400, the algorythm of printing sequence and which way at which stage should be useful for any printer...

    1. Ensure all documents have an even number of pages

    2. First print the even pages with the last page on top.

    Select File --> Print...

    - in "Print:" drop down menu select "Even pages" (default is "All pages in range")

    Then select "Properties" --> Basics

    - in "Page Order" mark "Back to Front"

    Then press "OK" in Properties screen, and "OK" again in Print screen

    3. Replace the paper

    Pick up the freshly printed pages. Keep them together, in the same order they were printed and the same side up (i.e. printed side up). Rotate the whole bunch 180 degrees horizontally and insert in into the paper tray. Once in the paper tray, the orientation of the paper should be such that one can read the pages correctly, with the highest even page at the top.

    4. Print the odd pages with the ultimate result having the first page on top.

    Select File --> Print...

    - in "Print:" drop down menu select "Odd pages" (default is "All pages in range")

    Then select "Properties" --> Basics

    - in "Page Order" mark "Front to Back"

    Then press "OK" in Properties screen, and "OK" again in Print screen

    Blog Archive