Thursday, November 29, 2012

install torque client

 cd /software/
  934  ls
  935  cd torque/
  936  ls
  937  cd 4.1.2/
  938  ls
  939  ./torque-package-mom-linux-x86_64.sh --help
  940  ./torque-package-mom-linux-x86_64.sh --listfiles
  941  ls
  942  ./torque-package-clients-linux-x86_64.sh --listfiles
  943  ./torque-package-clients-linux-x86_64.sh --install
  944  clear
  945  qsub
  946  exit
  947  df -h
  948  cd /software/
  949  ls
  950  cd torque/
  951  la
  952  ls
  953  cd 4.1.2/
  954  ls
  955  ls -ltr
  956  pwd
  957  cd /software/toolss
  958  cd /software/tools
  959  ls
  960  cd ..
  961  ls
  962  cd torque/
  963  ls
  964  cd 4.1.2/
  965  ls
  966  ls -ltr
  967  sh ./torque-package-clients-linux-x86_64.sh
  968  sh ./torque-package-clients-linux-x86_64.sh --install --verbose
  969  ls
  970  cd ..
  971  ls
  972  cd ..
  973  ls
  974  pwd
  975  cd src/
  976  ls
  977  cd torque-4.1.2
  978  ls
  979  cd con
  980  ls
  981  cd contrib/
  982  ls
  983  cd init.d
  984  ls
  985  ls -l /etc/init.d|grep trq
  986  cp -a trqauthd /etc/init.d/
  987  cd /etc/init.d
  988  ls -ltr
  989  getent passwd
  990  ls
  991  service trqauthd start
  992  qstat
  993  pbsnodes -l
  994  chkconfig --add trqauthd
  995  chkconfig trqauthd
  996  chkconfig --list|grep trqauthd
  999  vim /etc/hosts



//modify the torquemaster, and add new host to the manager by "qmgr -c"

Tuesday, November 20, 2012

specified unpartitioned disk sda in partition command

When getting this error message in a kickstart;
specified unpartitioned disk sda in partition command
Its possibly due to dmraid information still present on the disk from an earlier installation. Verify by running (press F2 after kickstart halts):
$ dmraid -r -D /dev/sda
You should get information about the disk being member of a raidset.

The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
$ dd if=/dev/zero of=/dev/sda
It will take some time as the entire disk is being written to. If you want to make a more surgical approach, just erase the last couple of sectors. First run fdisk;
$ fdisk -l
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
Then run the following command. Adapt the values for ”bs” and ”seek” to suit your actual harddrive. You get the values from the fdisk output above. In the below example, i’m deleting the last 10 sectors of the disk (91201 – 10 = 91191):
dd if=/dev/zero of=/dev/sda bs=8225280 seek=91191 count=1
Verify that the dmraid information is actually gone;
dmraid -r -D /dev/sda
The output should now be different from before, saying the disk is not a member. If so, you should be able to use it to kickstart on. 

specified unpartitioned disk sda in partition command

When getting this error message in a kickstart;
specified unpartitioned disk sda in partition command
Its possibly due to dmraid information still present on the disk from an earlier installation. Verify by running (press F2 after kickstart halts):
$ dmraid -r -D /dev/sda
You should get information about the disk being member of a raidset.

The inforamation can be stored in different locations on the harddrive, to my knowledge its commonly in the end though. If you dont want to consider this further, you can delete the entire disk by running;
$ dd if=/dev/zero of=/dev/sda
It will take some time as the entire disk is being written to. If you want to make a more surgical approach, just erase the last couple of sectors. First run fdisk;
$ fdisk -l
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
Then run the following command. Adapt the values for ”bs” and ”seek” to suit your actual harddrive. You get the values from the fdisk output above. In the below example, i’m deleting the last 10 sectors of the disk (91201 – 10 = 91191):
dd if=/dev/zero of=/dev/sda bs=8225280 seek=91191 count=1
Verify that the dmraid information is actually gone;
dmraid -r -D /dev/sda
The output should now be different from before, saying the disk is not a member. If so, you should be able to use it to kickstart on. 

Tuesday, October 30, 2012

Predefined Macros

There are predefined macros that are used by most compilers, you can find the list [here]. GCC compiler predefined macros can be found [here].

http://sourceforge.net/p/predef/wiki/OperatingSystems/

http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html


#ifdef _WIN64
   //define something for Windows (64-bit)
#elif _WIN32
   //define something for Windows (32-bit)
#elif __APPLE__
    #include "TargetConditionals.h"
    #if TARGET_OS_IPHONE    
         // iOS device
    #elif TARGET_IPHONE_SIMULATOR
        // iOS Simulator
    #elif TARGET_OS_MAC
        // Other kinds of Mac OS
    #else
        // Unsupported platform
    #endif
#elif __linux
    // linux
#elif __unix // all unices not caught above
    // Unix
#elif __posix
    // POSIX
#endif

Thursday, October 11, 2012

centos 6.3 enter single user mode and fix lvm partiton

1) enter grub.
2) add "single" as kernel paramters
3) boot into single user mode.
4) if file system is read-only, do:
  mount -o remount,rw /
5) recreate the volume group:
 vgcreate new_vol_name /dev/sd*
6) create logical volume and use full volume groupt
lvcreate -l 100%FREE -n new_lv_name  your_vg_name
7)format the logical volume
a, http://blog.tsunanet.net/2011/08/mkfsxfs-raid10-optimal-performance.html
b,http://wikihelp.autodesk.com/Creative_Finishing/enu/2012/Help/05_Installation_Guides/Installation_and_Configuration_Guide_for_Linux_Workstations/0118-Advanced118/0194-Manually194/0199-Creating199

//comment: use the second (autodesk one) method is fast and stable.
remeber, if your disk has BBU setup. you need to disable barrier.
just do it while mount the xfs partion with "-o nobarrier". please google centos documents.

reference:
1) http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html

2:

Root your box, and mount LVM partitions

I was teaching a friend how to root a box by adding:

init=/bin/bash
to the kernel line in grub, and then wanted to show him how to install some apps from the command line. I had never done this with LVM partitions, and was surprised when I got the following error:

File based locking initialization failed
Doh! I forgot to remount root read/write:

mount -o remount,rw /
Finally, I was able to mount all my LVM partitions with:
lvm vgscan
lvm vgchange -ay
lvm lvs
mount -a
haha! I'm getting rusty :P

Thursday, September 6, 2012

centos kickstarts configure file example


Linux Documentation Sucks

Every time I try to lookup how to do something in Linux, I get a deluge of out of date, incomplete, and just plain wrong documentation. This is the PXE/Kickstart guide I wish I would have read before I wasted 3 days. Thanks for nothing, RedHat documentation team.

Outline of the steps

* Obtain installation media
* Create Kickstart config file
* Setup NFS server
* Obtain PXE bootloader
* Create PXE config file
* Setup TFTP server
* Setup DHCP server

Installation Media

I was installing CentOS 5.5/x86_64 during this process, so I downloaded the two DVD images via torrent onto my NFS server. My BitTorrent client created the directory CentOS-5.5-x86_64-bin-DVD with the files:
CentOS-5.5-x86_64-bin-DVD-1of2.iso  md5sum.txt      sha1sum.txt      sha256sum.txt
CentOS-5.5-x86_64-bin-DVD-2of2.iso  md5sum.txt.asc  sha1sum.txt.asc  sha256sum.txt.asc
I moved this directory to /share/images to make it available via NFS.

Next I mounted the first ISO file as a loop image and copied the initrd and kernel to my DHCP server:
$ sudo mount /share/images/CentOS-5.5-x86_64-bin-DVD/CentOS-5.5-x86_64-bin-DVD-1of2.iso /mnt/dvd/ -t iso9660 -o loop
$ scp /mnt/dvd/images/pxeboot/*i* root@dhcp-server:/tftpboot

Kickstart File

I created the directory /share/kickstart for Kickstart config files on my NFS server.

I created the Kickstart file (test64-ks) using a previous CentOS install as a basis, and editing it based on snippets I found scattered around the 'Web.
# Kickstart file automatically generated by anaconda.
# Modified substantially by chort

install
nfs --server 10.25.0.129 --dir /share/images/CentOS-5.5-x86_64-bin-DVD/
#url --url http://mirror.centos.org/centos/5.4/os/x86_64
lang en_US.UTF-8
keyboard us

# don't define more NICs than you have, the install will bomb if you do
network --device eth0 --onboot yes --bootproto static --ip 10.25.42.139 --netmask 255.255.0.0 --gateway 10.25.0.1 --nameserver 10.25.0.5
#network --device eth1 --onboot no --bootproto dhcp
#network --device eth2 --onboot no --bootproto dhcp
#network --device eth3 --onboot no --bootproto dhcp

# grab the hash from an account in /etc/shadow that has the password you want to use
rootpw --iscrypted $1$fi0JeZ1p$Il0CxFxe0jqpNnkrOqC.0.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc America/Los_Angeles

bootloader --location=mbr --driveorder=sda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda
# 100MB /boot partition
part /boot --fstype ext3 --size=100 --ondisk=sda
# everything else goes to LVM
part pv.4 --size=0 --grow --ondisk=sda
volgroup VolGroup00 --pesize=32768 pv.4
# 2GB swap fs
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=2048
# 5GB / fs
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=5120
# 10GB + remaining space for /opt fs
logvol /opt --fstype ext3 --name=LogVol02 --vgname=VolGroup00 --size=10240 --grow

%packages
@base
@core
@dialup
@editors
@text-internet
keyutils
trousers
fipscheck
device-mapper-multipath
bind
bind-chroot
bind-devel
caching-nameserver
compat-libstdc++-33
compat-glibc
gdb
ltrace
ntp
OpenIPMI-tools
screen
sendmail-cf
strace
sysstat
-bluez-utils

%post
/usr/bin/yum -y update >> /root/post_install.log 2>&1
/sbin/chkconfig --del bluetooth
/sbin/chkconfig --del cups
/sbin/chkconfig ntpd on
/sbin/chkconfig named on

NFS Server

Make sure NFS is enabled:
$ for i in nfs nfslock portmap ; do sudo chkconfig --list $i ; done

Edit /etc/exports to enable access to the share for the machines that will PXE boot:
# sample /etc/exports file
#/               master(rw) trusty(rw,no_root_squash)
#/projects       proj*.local.domain(rw)
#/usr            *.local.domain(ro) @trusted(rw)
#/home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
#/pub            (ro,insecure,all_squash)
#/pub            (ro,insecure,all_squash)

/share  *.bkeefer.se.example.com(ro,no_root_squash)

I restart the nfs service after I edit /etc/exports
$ sudo service nfs restart

Bootloader

Next, on the DHCP server, I grabbed the PXE bootloader from the syslinux package. You should be able to install this through yum:
$ sudo yum install syslinux

Copy the bootloader to the TFTP server directory:
$ sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot

Create the pxelinux.cfg directory in /tftpboot and edit the default file:
# You can have multiple kernels, if so name each with it's version
# This configuration only has one possible kernel so I didn't rename it
default linux
label linux
  kernel vmlinuz
  append ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network ks=nfs:10.25.0.129:/share/kickstart/test64-ks

TFTP Server

Configure the TFTP server by editing /etc/xinetd.conf/tftp file:
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol.  The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
 socket_type  = dgram
 protocol  = udp
 wait   = yes
 user   = root
 server   = /usr/sbin/in.tftpd
 server_args  = -vvs /tftpboot
 disable   = no
 per_source  = 11
 cps   = 100 2
 flags   = IPv4
}
I changed "disable = yes" -> "disable = no" and "server_args = -s /tftpboot" -> "server_args = -vvs /tftpboot". xinetd probably doesn't need to be restarted, but I did any way:
$ sudo service xinetd restart

I had only a single machine to boot, so I used a fixed IP base on the Ethernet address. Make sure you edit /var/lib/dhcp.lease* to erase references to the MAC and restart dhcpd. Here's the /etc/dhcpd.conf
shared-network SE-NET {

 subnet 10.25.42.0 netmask 255.255.255.0 {
  authoritative;
  allow booting;
  option routers   10.25.0.1;
  option subnet-mask  255.255.0.0;
  option domain-name  "bkeefer.se.example.com";
  option domain-name-servers 10.25.0.5;
  option time-offset  -28800;
  option ntp-servers  ntp.example.com;

  host test64 {
   hardware ethernet 00:0c:29:b3:81:99;
   fixed-address 10.25.42.139;
   next-server 10.25.0.5;
   filename "pxelinux.0";
  }
 }
}

I haven't had any luck with restarting dhcpd, so I do stop followed by start:
$ sudo service dhcpd stop && sudo service dhcpd start

Note that there are also forward and reverse DNS entries to match 10.25.42.139 to test64.bkeefer.se.example.com .

Final Step

At this point you should be able to edit the BIOS for the machine you're booting to make sure the network card is in the boot order (as long as there's no OS installed, it should boot off the NIC no matter where it is in the order).

Conclusion

There, was that so hard? You'd think with the hundreds of millions of dollars RedHat takes in every year they could afford to test their documentation, and maybe even write start-to-finish guides instead of disconnected snippets.

Please e-mail me at with any suggestions or feedback.  Thanks!






This site © copyright 2003-2010 Brian Keefer.  Opinions expressed on this site are my own and do not reflect those of my employer.

Wednesday, August 8, 2012

Perl CPAN install at user directory