Archive

Posts Tagged ‘linux’

Linux:Creating floppy image file and copying files into it

May 29th, 2009

The fastest way to do it :

# mkdosfs -C floppydisk.img 1440
# mount -o loop floppydisk.img /media/cdrom
# cp /path/to/files/* /media/cdrom/
# umount /media/cdrom

note: assuming /media/cdrom path is exists (most likely so), and you have root access.

credit: http://untitledfinale.wordpress.com/2007/10/09/create-mount-and-copy-floppy-disks-images-under-linux/

Author: bayu Categories: linux Tags: ,

Linux: lowercasing the filenames

May 22nd, 2009

I really hate uppercase when it comes to filenames. It’s really simple to translate words to lowercase using perl’s “tr”.

  my @FILES=`ls /path/to/bignames`;
  foreach my $line (@FILES){
    $line=trim($line);
 
  	if ($line ne "" && $line !~ /^./ && $line =~ /[A-Z]+/) {
  	  my $smalline = $line;
	    $smalline =~ tr/[A-Z]/[a-z]/;
      $out=`mv -v $line $smalline`;
    }

and this is the complete rename-to-lowercase script.

Please read terms of use before downloading the script(s)

Author: bayu Categories: linux Tags: , , , , ,

Linux: system crashes when virtualbox installed above the xen kernel

May 20th, 2009

I did it in Centos 5.2 and RHEL 5.
see http://www.virtualbox.org/ticket/203

Author: bayu Categories: linux Tags: , , ,

synaptics: some packages didn’t show up on search result

May 13th, 2009

have you ever found that when you do a quick search in synaptics, you know the packages is there but they doesn’t show up in the search result? This probably a bug, but there’s workaround for this.

# update-apt-xapian-index -f

Author: bayu Categories: linux Tags: , ,

Linux: Changing the kernel semaphore setting in linux

May 4th, 2009

To check shared memory segment, semaphore array, and message queue limits, issue the ipcs -l command.

Modify the kernel parameters by adding the following entries to the default system control configuration file,
/etc/sysctl.conf:
kernel.sem = 250 256000 32 1024
Set the numbers as needed, and the above numbers are respectively :
1.max semaphores per array
2.max semaphores system wide
3.max ops per semop call
4.max number of arrays
where :
max semaphores system wide = max number of arrays x max semaphores/array

Run sysctl with -p parameter to load in sysctl settings from the default file /etc/sysctl.conf.
sysctl -p
The entries from the sysctl.conf file are read during startup by the network initialization script.
On some distributions you may be required to add sysctl -p in one of the system initialization files (for example, rc.local) so that kernel parameters are set after each reboot.

Author: bayu Categories: linux Tags: , , ,

Linux: Fixing a broken grub

May 3rd, 2009

The grub corrupted or replaced by another boot loader? follow this steps to fix it.

  1. Boot the system using any linux live having grub installed in it.
  2. Under the root user, execute “grub” to access the grub prompt.
  3. Use “find /boot/grub/stage1″ command in the grub prompt to find where the file is. The result should be like (hd0,2), (hd0,0), etc
  4. Use “root (hd0,2)” command, the (h0,2) taken according to the result in 3rd step.
  5. Use “setup (hd0,2)” command to install grub in the partition, or just (hd0) to install it on the Master Boot Record (MBR) of the disk 0.

good luck!

Author: bayu Categories: linux Tags: , , , , ,

hp ux: Network tools

May 3rd, 2009

The HP UX is bundled with several network adminitration tool:

  • lanscan : to see MAC Adress, interface status, and hardware path

# lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
0/0/0/0 0×00306EC32104 0 UP lan0 snap0 1 ETHER Yes 119

  • ifconfig : looks like the same command in linux, to see of configure the IP Addresses, turning on/off the NIC, etc.

# ifconfig lan0
lan0: flags=843<UP,BROADCAST,RUNNING,MULTICAST>
inet 150.150.8.1 netmask ffff0000 broadcast 150.150.255.255

  • lanadmin : to see detailed LAN interfaces of the machine

LAN INTERFACE STATUS DISPLAY
Tue , Jun 17,2008 09:12:05

PPA Number = 0
Description = lan0 HP PCI 10/100Base-TX Core [10BASE-T,HD,AUTO,TT=1500]
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 10000000
Station Address = 0×306ec32104
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 1186783
Inbound Octets = 42032376
Inbound Unicast Packets = 15518
Inbound Non-Unicast Packets = 501152
Inbound Discards = 1
Inbound Errors = 0
Inbound Unknown Protocols = 14605
Outbound Octets = 1719024
Outbound Unicast Packets = 17140
Outbound Non-Unicast Packets = 722
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Ethernet-like Statistics Group

Index = 1
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 1053
Multiple Collision Frames = 99
Deferred Transmissions = 136
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0

  • linkloop : a tool to tests layer 2 connectivity

# linkloop 0×00108303aabf
Link connectivity to LAN station: 0×00108303aabf
– OK

Author: bayu Categories: hp ux Tags: , , , , ,

Using remote X font server

May 3rd, 2009

When using an X application remotely, sometimes the application needs specific fonts that are not available on our X server. Some of them might still work with a different fonts. Unluckily, one of mine doesn’t

I found some messages when I use remote X server on an application :

ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Unable to load any usable fontset
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Cannot convert string “-*-helvetica-medium-r-*-120-*” to type FontSet

The solution is to use the font server in which the application is installed

on apllication side (in this example is an hp-ux server) :

  1. open /etc/rc.config.d/xfs , set RUN_X_FONT_SERVER=1.
  2. Execute ”/sbin/init.d/xfs start”

on X server side (my laptop is using OpenSUSE linux) :

  1. Log on as user that going to run the application remotely.
  2. Execute ”xset +fp tcp/<hp-ux_hostname>:7000” .
  3. Execute ”xset fp rehash” .
  4. Execute ”xset -q”.
  5. Do a remote log on, secure tunnel might helps much if you have a firewall issue.
  6. Set DISPLAY variable if needed – “export DISPLAY=x.x.x.x:0.0″
  7. Run the X application remotely.

Credits: http://forums12.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1212545170579+28353475&threadId=224569

Author: bayu Categories: hp ux Tags: , , , , ,
Switch to our mobile site