jump to navigation

Loading US Keyboard Map QWERTY on Linux 14 March 2011

Posted by Maulvi Bakar in : Linux,Work , 1 comment so far

Sometimes, when you’re supporting machines located on various parts of the world, you’ll encounter machines with funny keyboard arrangements.

This is normal!

Different parts of Europe and Canada uses different keyboard language layout. You’re using a machine with US Keyboard layout to access these machines and to change the layout to it, issue the following commands -

/bin/loadkeys /usr/share/kbd/keymaps/i386/qwerty/us.map.gz

Inside the same directory lists a bunch of other commonly/un-commonly used keyboard keymaps. Your mileage vary depending were you’re located from and what type of keyboard you’re using.

Enjoy!

Solaris Ping Results 17 February 2011

Posted by Maulvi Bakar in : Unix,Work , add a comment

Ever tried to ping a host on a Solaris machine?

$ ping pong

pong is alive

You’ll get a plain ‘is alive’ results. If you need packets received and timing information, you have to add the option -s like thus -

user@tennis:/usr/sbin > ping -s pong

PING pong: 56 data bytes
64 bytes from pong (x.x.x.x): icmp_seq=0. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=1. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=2. time=2. ms
64 bytes from pong (x.x.x.x): icmp_seq=3. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=4. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=5. time=0. ms

----pong PING Statistics----
6 packets transmitted, 6 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/2

Funny Solaris trying not to conform with the rest of the *NIX community.

Enjoy!

Customizing the Bash Prompt 19 December 2010

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

If you’re on Linux, most of the time the current existing bash prompt is fine. Other types of UNIX, in my case is Solaris, is somewhat spartan in appearance. You’ll either get a boring ‘$’ or ‘#’ or simply a display of version.

The table below are the various options available -

Personally, I just wanted to duplicate the bash prompt on Linux into Solaris. All I did was thus in the “/etc/profile” -

export PS1
PS1='[\u@\h:\w]\$ '

Remember to use single quotes ” ‘ ” rather than the double quotes. Otherwise the “\$” will not work.

Enjoy!

Howto: Disable GUI Desktop on Solaris 10

Posted by Maulvi Bakar in : Unix,Work , add a comment

My life seems to be centered around *NIX. After many false start, I am about to embark on a serious Solaris journey.

*NIX politics aside. I’ve formed judgment already, but I reserve publishing it at the moment. For the time being, enough said – it is a pure workplace choice.

# date;uname -a;uptime
Sun Dec 19 14:27:32 MYT 2010
SunOS solaris 5.10 Generic_142910-17 i86pc i386 i86pc
2:27pm up 25 min(s), 1 user, load average: 0.01, 0.11, 1.05

By default, Oracle Solaris 10 will start with Gnome/CDE GUI interface upon start-up. To disable GUI, especially if you intend to run a headless server, do this -

# /usr/dt/bin/dtconfig -d

To enable it again, simply -

# /usr/dt/bin/dtconfig -e

Enjoy!

HPUX Breaking Mirror and Extending LVM 2 June 2009

Posted by Maulvi Bakar in : Unix,Work , add a comment

I’m learning new things nowadays..  Particularly HPUX.  Not really my cup of tea since it not open-source but interesting enough though.

We had one machine with mirrored harddisks with one being faulty that needs removal.

Break mirror procedure..

1. Remove the mirror on the Logical Volume affected within the Volume Group
lvreduce -m 0 /dev/vg01/lvol1 /dev/dsk/c2t0d0
lvreduce -m 0 /dev/vg01/lvol2 /dev/dsk/c2t0d0

2. Now remove the Volume Group from the Physical Volume that is targeted for removal
vgreduce /dev/vg01 /dev/dsk/c2t0d0

3. Finally remove the Physical Volume from the Physical Disk
pvremove /dev/rdsk/c2t0d0
Please note the ‘r’.. ‘r’ stands for physical disk, while the one without is the physical volume..

Restore mirror procedure…

1. First, let’s verify things
ioscan -funC disk
pvdisplay /dev/dsk/c1t0d0        # get lvm info of existing disk.
pvdisplay /dev/dsk/c2t0d0        # get err, no lvm def on it, raw disk.

2. Now we create the Physical Volume within the Physical Disk and extend the Volume Group onto it.
pvcreate /dev/rdsk/c2t0d0        # add physical disk to be used by LVM
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00

2a. If you’re recreating a bootable disk, the commands below must be used instead -

pvcreate -B /dev/rdsk/c2t0d0        # add physical disk to be used by LVM and make it bootable
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00
mkboot -a "hpux -lq /stand/vmunix" /dev/dsk/c2t0d0     # install the bootloader

3. Check and verify!
strings /etc/lvmtab            # see new disk used by lvm

4. The next steps will actually perform the mirror, and it will fail if -m mirroring option is not activated with valid license
lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c2t0d0    # add mirror for lvol1
lvextend -m 1 /dev/vg01/lvol2 /dev/dsk/c2t0d0    # add mirror for lvol2

Enjoy!

Changing user’s file ownership across the board 25 December 2008

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

The guys from the promised database lands had their systems acting funny.  After investigation, they found out that, their files was having the wrong group ownership.

There’s a total of 70,000 files involved.  Promised lands or not, manually changing 70,000 files (and folders) is not a good prospect.  Well, I could go through the individual sub-folders but I would need to work from the last in-depth sub-folders and work my way out.  Even that does not guarantee accuracy, since there might be sub-folders with multiple owners which I’m not suppose to touch.  When that happen, then I have to go through it manually looking at each files and folders individually – not good.

There has to be a short-cut.

I know I can locate all the files that needs to be changed it’s ownership by using the following commands -
find ./ -user someuser -group wronggroup -print

It’ll list all the relevant files and sub-folders. At first, maybe I’ll output it into a file, all the results. Manipulate the file into an executable. Append each lines with a “chgrp correctgroup” and have something like – “chgrp correctgroup ./to/the/path/of/the/file”.

I am smart, hey! ;-)

Let’s prove that I can be smarter  :-P

Vanity and pride are different things, though the words are often used synonymously. A person may be proud without being vain. Pride relates more to our opinion of ourselves; vanity, to what we would have others think of us.

Jane Austen

No, I’m just trying to figure out the best way of doing things.

“xargs -t <commands>”

xargs is a command of Unix and most Unix-like operating systems. It is useful when one wants to pass a large number of arguments to a command. Arbitrarily long lists of parameters can't be passed to a command, so xargs will break the list of arguments into sublists small enough to be acceptable.

xargs - build and execute command lines from standard input

The “-t” is for the verbose option. It’ll spew out the output of the commands being executed.

Basically, every time the output of the earlier “find”, it’ll append the extra commands specified and have it executed. Voila, no need to make a separate executable. My solution is thus -

find ./ -user someuser -group wronggroup -print | xargs -t chgrp correctgroup

Happy 4th Anniversary to myself  ;-)

Merry Christmas everyone!

Enjoy!

Linux sparse file in /var/log/lastlog using RHEL3 19 November 2008

Posted by Maulvi Bakar in : Linux,Work , add a comment

The guys in the promised backup lands had their heads scratching.  Their backups seems to bloat an extra 1.2TB in size!  The culprit seems to be the

/var/log/lastlog

Lastlog is sparse file which contains unallocated blocks or “empty space” and it does not actually take up filesystem space.  Simple test like thus will have a very straightforward results -

$ du -H /var/log/lastlog
156kB   /var/log/lastlog

Furthermore, “lastlog” is a file that almost never grow anyway. A common issue apparently.

Usually it is suggested that either the file be excluded from the backup excercise or, if policy-wise not possible, then the backup application to be configured to handle the specific sparse file, in this case “lastlog”.

Sparse files can confuse some backup software. Usually tools like GNU tar requires the use of the -S parameter to fix it. If you are using some other software, consult the backup software’s manuals for options on how to deal with sparse files.

Enjoy!

RHEL4 U5 Install, Boots Up with “GRUB” error on screen. 29 October 2008

Posted by Maulvi Bakar in : Linux,Work , 1 comment so far

This one is a funny error. After finishing the installation, the system reboots and ‘poof’ on screen only displays “GRUB”.

My suspicion is that, GRUB somehow or rather did not install properly onto MBR. Considering previously that the system comes only with a single harddisk. Later on, after fixing a second harddisk, the OS was re-installed with RAID1. Maybe that’s the cause as the old GRUB was not properly overwritten.

Basically, I re-insert the installation CD and boot up into rescue mode.
linux rescue

Upon boot up, mount the filesystem thus -
# chroot /mnt/sysimage

Use grub the regenerate the grub stuff on both hdds thus -
# grub

On the grub command line, select the 1st harddisk
grub> root (hd0,0)

Initialize grub onto the 1st harddisk
grub> setup (hd0)

Do the same for the 2nd harddisk
grub> root (hd1,0)
grub> setup (hd1)

Exit the grub menu -
grub> exit

Reboot the system and your grub should behave normally now..

Enjoy

From the Badlands to the Hardlands and finally to the Promised Land. 18 October 2008

Posted by Maulvi Bakar in : Home,Work , 2 comments

Hmm..

My retirement seems to be quite short-lived. I thought I’m gonna retire from the so called promised land. Well, I did retire.. Thought of taking up agricultural activities, then the economy gone south.

Turns out, the promised land is a Hardland. Well, I’m a former Badlander. At first, I thought I can hack it. Hack it I did! 3 years!.. or somewhere close to it! The results? Diabetic, Low Blood Pressure or somewhere close to it too ;-)

The advise is to retire ;-) as if that is possible. Nope, it’s just that I need to be mindful of myself, my health and ultimately, all those who have a claim on my life (The spouse, the Inhouse Celebrity).

Then, I got head-hunted again! First from a Japanese Electronics Giant™, but they balked at my physical conditions. My suspicions is more due to my academics, being a graduate of the Jedi Academy (or maybe the Starfleet Academy ;-) . Then, it’s an American Technology Giant™ (purportedly to be the largest in the world! It’s true!). Now, these guys didn’t even care about my formal background, just so I can demonstrate my abilities.

Heh! Use the force Luke!

I am grateful to be given an opportunity with the American Technology Giant™. Now I truly believe I am in the promised land. I sincerely believe I may just retire here instead… Professionally of course.. The union-like work environment. The superb benefits package, especially medical, hospitalization which covers spouse and children, unlimited mind you! All these does help nudging me towards my decision.

Wish me luck!

Time Travelling in VMware Server for Linux (Guest & Host) 6 August 2008

Posted by Maulvi Bakar in : Home,Linux,Work , 2 comments

I run two VMware host machines at home. This is where I do most of my ‘Training’. Well, most of my knowledge on Linux are self-learned anyway. This is where I do my R&D.

Simply, theory is good. But how do you know whether the theory is practical? What potential pitfalls when you deploy a solution? Especially Free (Libre) and Open Source Solutions? Not to say FLOSS solutions are no good, but in a commercial environment, when paying customers are willing to pay good money to transfer their operational risks to you, you better be sure of the solution that you’re proposing.

FLOSS solutions backed by commercial vendors – eg. Red Hat, is a safe bet. You can propose it to customers and as a fall back, there’s always Red Hat. Problem starts with FLOSS solutions that specifically states – ‘No warranty/guarantee of any kind’ :-P

Not to say they’re no good, mind you. That’s where you as a FLOSS Service Provider comes in. To provide the kind of warranty/guarantee that the customer wants for such FLOSS solutions. The other advantage of FLOSS, if the customer’s not happy with a FLOSS vendor, being FLOSS, you can always go to another vendor. That forces FLOSS vendors to always provide the best service.

Anyway, I’m rambling and digressing -

My guest OSes keep travelling faster than my host OS, sometimes as fast as 2 seconds every 10 seconds. Need to tune the VMware server host a bit -

file – /etc/vmware/config

host.cpukHz = 3400000
hostinfo.noTSC = TRUE
tools.syncTime = TRUE

The first line is to specify the maximum CPU clock rate the system may run.
Second line is to specify that the cpu is not running at a constant clock rate (speedstep, cpufreq or power management is active when idle) and the timestamp counter is inaccurate an to use it as the least.
The last line sets the default to use vmware-tools timesync function.

Well, I hope this is a permanent solution.

Enjoy

MySQL query error