Monday, December 30, 2013

[CC]IPMI over LAN on Ubuntu 12.04

Doing this on two of these machines:
System Information
Manufacturer: Supermicro
Product Name: X9DBL-3F/X9DBL-iF
In the IPMI section of the BIOS, set the IP/gateway/netmask addresses. (This can also be done from inside the Linux Kernel with `ipmitool` after loading the modules.) I left all the other IPMI settings as default.
After a reboot, visit the IP of the IPMI LAN device in a browser from a separate computer. I found everything worked except console redirection (SOL – Serial Over Lan,) as indeed this has to be setup inside the Linux Kernel.
These are the steps I took to make console redirection work:
1. The first thing I did was install the tools and setup the modules.
  • Install the needed software:
sudo apt-get install ipmitool freeipmi-tools
  • Find the information about the BMC (press ‘q’ to ‘quit’ less when done):
sudo ipmi-locate | less
  • I found the information needed in the first few lines of the output as seen here:
Probing KCS device using DMIDECODE... done IPMI Version: 2.0
 IPMI locate driver: DMIDECODE
 IPMI interface: KCS
 BMC driver device:
 BMC I/O base address: 0xCA2
 Register spacing: 1
  • Add the appropriate modules into the Kernel, for the ‘ipmi_si’ one use the information found with ipmi-locate like this:
sudo modprobe ipmi_si type=kcs ports=0xCA2 regspacings=1
sudo modprobe ipmi_devintf
sudo modprobe ipmi_msghandler
sudo modprobe ipmi_poweroff
sudo modprobe ipmi_watchdog
  • Now if you “ls -ahl /dev/ipmi*” you should see an ipmi0
2. Next, we need to setup a tty and tell grub to pass options to the Kernel command to redirect it’s console to that tty.
  • Make a copy of an existing tty and edit it. I’m using vim, but use whatever editor you like:
sudo cp /etc/init/tty1.conf /etc/init/ttyS1.conf
sudo vi /etc/init/ttyS1.conf
  • Edit the file to reflect ‘ttyS1′ instead of just ‘tty1′. Also edit the last line to use a baud rate of 115200, and tell it the type  ’vt100′. Mine looks like this when done:
# ttyS1 - getty
#
# This service maintains a getty on ttyS1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 115200 ttyS1 vt100
  • We must pass “console=tty1 console=ttyS1,115200n8″ as options to the command in our boot loader that starts the kernel. Note: the order of options passed to the kernel is important, the last “console” entry defines the ‘default’ console for the kernel. For grub-pc open up /etc/default/grub with your favorite editor and with sudo permissions and change GRUB_CMDLINE_LINUX=”" line to look like this:
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS1,115200n8"
  • Don’t forget to update grub after this: (I also changed ‘GRUB_HIDDEN_TIMEOUT_QUIET’ to false, and I uncommented the ‘GRUB_TERMINAL=console’ line.)
sudo update-grub
3. Now we’re pretty much ready to connect. The only problem I found was with the launch.jnlp file that the Supermicro webUI spits at you. I’ll show you the edits I made to make it work:
  • Again visit the IP pointed at your IPMI and login in to the webUI. Click the ‘Launch SOL’ button under the ‘Remote Control’ tab, choose to save the file instead of opening it in your browser’s web java application (‘IcedTea java web start’ in my case.)
  • Towards the beginning of the file, look for these lines:
<property name="jnlp.packEnabled" value="true"/>
<property name="jnlp.versionEnabled" value="true"/>
  • Copy those two lines and scroll down a little until you see the distribution you are running and paste them into the there. I did it for each distribution so I didn’t have to think about it. I ended up with entries looking like this:
<resources os="Linux" arch="x86_64">
  <property name="jnlp.packEnabled" value="true"/>
  <property name="jnlp.versionEnabled" value="true"/>
  <nativelib href="liblinux_x86_64.jar" download="eager" version="1.0.3"/>
</resources>
  • Lastly, scroll to the end of the file where you will see a list of “argument” xml tags. The one below the one that contains your IP probably contains a seemingly random string of letters, but it needs to be changed to the username you setup to login to the IPMI webUI, and the one below needs to be your password. Like this:
<argument>123.123.123.123</argument>
<argument>[username]</argument>
<argument>[password]</argument>
  • Save the file and run it and you should now be ready to sit in front of the machine remotely. Reboot the server to watch it boot up, offer you the opportunity to enter the BIOS, and then offer you a login prompt. :-)
P.S. Don’t forget to edit the factory installed users in your IPMI webUI and change their passwords and/or disable them!
EDIT 07/06/13:
Corrected the line:
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS1,115200n8"
to:
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS1,115200n8"
Also,
Corrected the line:
exec /sbin/getty -8 115200 tty1 vt100
to:
exec /sbin/getty -8 115200 ttyS1 vt100
Also,
Removed the lines from ttyS1.conf pertaining to ‘containers’:
and (
          not-container or
          container CONTAINER=lxc or
          container CONTAINER=lxc-libvirt)
Everything is running smoothly after this, even when networking is turned off in the kernel.

Tuesday, September 24, 2013

mapping Probe ID to Gene ID by using R

1) in or after 2006, there should be good Probe Id to GENE id map.

2) necessary package:
Biobase,
GEOquery

3) load the GPL platform file:
gpl5425 = getGEO('GPL5425',destdir=".")
         
## get annotation table
gpl5425_ann = Table(gpl5425)

#make the rownames to be ID
rownames(gpl5425_ann) = gpl5425_ann$ID

--------------------------------------------------------------------------------
                               ID                                        GB_ACC      GENE_SYMBOL                                    
AA799301_PROBE1 AA799301_PROBE1     AA799301   LOC498225            
AA799313_PROBE1 AA799313_PROBE1     AA799313      Siat10 ST3
AA799329_PROBE1 AA799329_PROBE1     AA799329     Col10a1      
AA799331_PROBE1 AA799331_PROBE1 NM_001007634        Pelo
--------------------------------------------------------------------------------

#assume the expression data is:
gse24417

--------------------------------------------------------------------------------
            ID_REF GSM204540 GSM204503 GSM204587 GSM204994
1 NM_016986_Probe1   14.5383   15.6827   14.0196   15.0969
2 NM_016987_Probe1   12.7629   15.6014   13.1481   14.4640
3 NM_016988_Probe1   14.0954   14.0583   13.6035   14.3924
4    M27893_Probe1   12.4787   12.6605   11.6335   14.0050
5 NM_012490_Probe1    8.9914    8.2654    9.2640    6.5239
--------------------------------------------------------------------------------

rownames(gse24417) = gse24417$ID_REF

#get the probe id, with upper character
pid = toupper(gse24417$ID_REF)

#get the gene symbol id
gid = gpl5425_ann[pid,]$GENE_SYMBOL

## gid contains empty value: "" , and NA value "NA", find the index of them and delete the lines.
blank_id = which( gid == "")
na_id = which(is.na(gid))

#now combine the final data
unwanted_index = c(blank_id,na_id)

gid = gid[-unwanted_index]
gse24417 = gse24417[-unwanted_index]

gse24417$ID_REF = gid

## now remove the repeated genes








Saturday, August 17, 2013

IPMItool

check this website:



Blink:
ipmitool -H 192.168.0.130 chassis identify
Set the ip address:
ipmitool -U root -P root -H 192.168.0.120 lan set 1 ipsrc static
ipmitool -U root -P root -H 192.168.0.120 lan set 1 ipaddr 192.168.0.102
ipmitool -U root -P root -H 192.168.0.120 lan set 1 netmask 255.255.255.0
Print net config:
ipmitool -U root -P root -H 192.168.0.120 lan print
Reboot the server:
ipmitool -H server-ipmi -U root -P root chassis power reset

ipmitool on localhost without an ip

modprobe ipmi_si
modprobe ipmi_devintf
Enable the root user with a password:
ipmitool user set password 2 admin

Force the Server into Bios

[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root  chassis bootparam set bootflag force_bios
Set Boot Device to force_bios
[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root chassis power reset
Chassis Power Control: Reset

Force the Server to Boot to Disk

[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root chassis bootparam set bootflag force_disk
Set Boot Device to force_disk
[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root chassis power reset
Chassis Power Control: Reset

Force the Server to Boot PXE

[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root chassis bootparam set bootflag force_pxe
Set Boot Device to force_pxe
[root@server ~]$ ipmitool -H 192.168.0.120 -U root -P root chassis power reset 
Chassis Power Control: Reset

Refernces

Tuesday, July 23, 2013

nxclient arrow keys not working.

Inside your nx session, open a terminal window and run:

setxkbmap -model evdev -layout us

Replacing "us" with your desired layout if it isn't the US layout. Your keymap should be correct now. If you start your nx session using an .xsession/.xinitrc style script, you can add the setxkbmap command to the startup script.

Monday, June 17, 2013

getGEO return a list

> Dear All,
>
> I am trying to analyze a Microarray series data using "GEOquery". I
> get the below
> error when trying to extract the information.
>
> > gse = getGEO("GSE15709");
> > Meta(gse)
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "Meta", for signature
> "list"
> > GSMList(gse)[[1]]
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "GSMList", for
> signature "list"
>
> Thanks in advance for your help.
>
>
getGEO() defaults to GSEMatrix=TRUE.  Per the documentation, this returns a
list of ExpressionSet objects.  So, gse[[1]] is an ExpressionSet.  The
accessors that you are using above are for returns from calls to getGEO()
with GSEMatrix=FALSE.  Unless there is a specific need to get information
from the full GSE SOFT file, I would recommend staying with GSEMatrix=TRUE
and working with the more standard ExpressionSet object(s).

Hope that helps.

Sean


#########################
B = as(gse[[1]],"ExpressionSet")

then good to go.

Tuesday, June 11, 2013

RMA over a data.frame or a matrix

> Dear List,
>  
> I was wondering if RMA function can be applied to a data frame or a matrix??
> Thanks.
>  
> -Sohail


Hi,

If your matrix contains the intensity data from actual microarrays,
this is a function you could use (or leverage):

#
# intensity and intensitySD are objects equivalent to matrices.
#   They should contain probe intensities in rows and samples in
#   columns. Probe intensities should be ordered the same way they
#   are in a .CEL file.
# chipType is a string containing the chip type (see function
#   cleancdfname()).
# chipSizeX and chipSizeY specify the number of features on the chip.
#
CreateAffyBatch <- function( intensity, intensitySD, chipType, chipSizeX, chipSizeY )
{
    exprs <- data.matrix( intensity )
    se.exprs <- data.matrix( intensitySD )

    sampleIndices <- 1 : ncol( exprs )
    sampleNames <- paste( "sample", sampleIndices, sep = "" )

    colnames( exprs ) <- sampleNames
    colnames( se.exprs ) <- sampleNames

    phenoData.data <- as.data.frame( sampleIndices )
    rownames( phenoData.data ) <- sampleNames
    colnames( phenoData.data ) <- "sample"
    
    if( length( findClass( "AnnotatedDataFrame" ) ) == 1 )
    {
        phenoData <- new( "AnnotatedDataFrame", data = phenoData.data )
        phenoData at varMetadata[[1]] <- "arbitrary numbering"
    } else {
        phenoData <- new( "phenoData", pData = phenoData.data, varLabels = list( sample = "arbitrary numbering" ) )
    }

    affyBatch <- new( "AffyBatch", exprs = exprs, se.exprs = se.exprs,
        cdfName = chipType, annotation = cleancdfname( chipType, addcdf = FALSE ),
        ncol = chipSizeX, nrow = chipSizeY, phenoData = phenoData )

    return( affyBatch )
}

Friday, May 10, 2013

Solving the Transcendental equation by matlab.

example:

TO solve:

cos(x)*cosh(x)+1=0


Matlab commands:

f = @(x) cos(x)*cosh(x) + 1;
fzero(f,2)


reference:

http://www.mathworks.com/help/matlab/ref/fzero.html

Thursday, April 25, 2013

Installed postfix, but no qshape? (CC)


Here’s a simple one…
I installed a new FC12, and postfix, using “yum install postfix”. Afterward, after configuring main.cf, postfix ran fine through our simple testing, so I put it in service on a limited basis. However, once we started using it, qshape failed, with an error indicating it was not found.
It took me a couple of hours of my poor google skills to find the answer, so hopefully, if you find yourself in the same pickle, you can use this and it will help you.
First, separately install all the perl packages with this command:
“yum groupinstall perl development”  once you have that all done, (and here’s the magic) run:
“yum install postfix-perl-scripts”.
I know, qshape is *supposed* to be installed with postfix.  Only it wasn’t. and it took me all morning to figure out how to get it in there….
…..It worked for me.

Wednesday, April 24, 2013

Blog for Linux System Administrators. : Sendmail vs Postfix vs Qmail vs Exim

Blog for Linux System Administrators. : Sendmail vs Postfix vs Qmail vs Exim: We have choice in using MTA in linux. We can use sendmail, postfix, qmail or exim. The selection of MTA depends on many factor such as follo...

Thursday, April 11, 2013

Process NIH GEO GSE data by geoQuery

How to get an Expression value table of a GSE* file from GEO website.

for example: GSE33147

>g = getGEO("GSE33147")

......

it may download a series data matrix file: GSE33147_series_matrix.txt.gz
then load the dat again:
>g = getGEO(filename="GSE33147_series_matrix.txt.gz")

check the data

>class(g)

get the ExpressionSet:

> e = as(g, "ExpressionSet")

get the data table
> f = exprs(e)

save:
> write.csv(f, file="***")

load the group gene names that you want: (assume you only want part of them)
the names are stored in file "top60.csv"
>genes = read.csv("top60.csv",header=T)

the genes are factors, we need change them to character,
> cgenes = as.character(genes[,1])               //the first column.

>

Wednesday, April 10, 2013

Processing Microarray data by using R and Bioinductor

Load all the .CEL.gz file from a folder:

>library(affy)
>data <- ReadAffy()

## For Affymetrix data, there is no concept of RAW data.
See page 72 of DNA microarray data analysis using Bioconductor.

Now get the RMA data
> data.rma <- rma(data)

or you can use the following if the size of data is too large.

>data.rma <- justRMA(data)


change the RMA result to expression values
data.e <- exprs(data.rma)

save the data.e
write.csv(data.e,file="data.csv")

##now process the data and map probe ID to gene ID
##by any script language ....such as python


now load the processed data to R again:
d <- read.table("processed_data.csv",header=T,sep=",")

now d is a string matrix, make it to float

df <- data.frame(d,row.names=1)    ## use the first column as name

calculate the mean and append to df

df$mean <- rowMeans(df)

ranking

dfr <- df[order(-df$mean),]

save the highest 60 to a .csv file

write.csv(dfs[1:60,],file="d60.csv",sep=",")


Tuesday, February 19, 2013

upgrade Ubuntu OS




sudo apt-get install update-manager-core
sudo vi /etc/update-manager/release-upgrades
change the line below from prompt=lts to prompt=normal.
sudo apt-get update && sudo apt-get upgrade
sudo do-release-upgrade