« Posts under sysadmin

Centos and BOINC/World Community Grid

There are RPM packages for Fedora but doesn’t seem one for CentOS. There is no updated instructions on running BOINC client via command line.

1) Download and run boinc_6.2.15_i686-pc-linux-gnu.sh
2) Run "./boinccmd –project_attach www.worldcommunitygrid.org " 
(Log into WCG, the key can be found on menu My Profile, near the bottom)
4) Run "./run_client --daemon" to begin the client
5) Check "tail stdoutdae.txt -f" for output

You might need to install these for dependencies:

yum install libXcomposite
yum install libXdamage

Optimizing TCP stack under CentOS/RHEL Linux

This is from one of our pretty old servers

more /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) for
# more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# From: http://forum.ev1servers.net/showthread.php?s=&threadid=19647
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 30
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Don't Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
# Make more local ports available
# net.ipv4.ip_local_port_range = 1024 65000
# Increase maximum amount of memory allocated to shm
kernel.shmmax = 1073741824
# Improve file system performance
vm.bdflush = 100 1200 128 512 15 5000 500 1884 2
# This will increase the amount of memory available for socket input/output queues
# net.ipv4.tcp_rmem = 4096 25165824 25165824
# net.core.rmem_max = 25165824
# net.core.rmem_default = 25165824
# net.ipv4.tcp_wmem = 4096 65536 25165824
# net.core.wmem_max = 25165824
# net.core.wmem_default = 65536
# net.core.optmem_max = 25165824

PHP Error – DOMDocument not found

If you see this error when your PHP version is already 5.x, make sure you install “yum install php-xmlrpc” and might have to restart the web server (just to be sure).

PHP Fatal error:  Class 'DOMDocument' not found in xxx

Gotchas with gettext in PHP

Be careful when you first try gettext in PHP, it can be very unreliable/unpredictable because of different naming conventions.

MyApp.po vs MyApp.mo

PO is the human-readable and you perform the translation in here. MO is the binary file and it’s cached by Apache. Thus, you need to restart Apache (XAMPP) after each change to MyApp.po, then recompile it via “msgfmt MyApp.po -o MyApp.mo”. If you forgot to recompile, it won’t have any of the new modifications.

Folder Structure

/MyApp/locale/vi_VN/LC_MESSAGES/MyApp.mo
/MyApp/locale/da_DK/LC_MESSAGES/MyApp.mo
/MyApp/locale/en_US/LC_MESSAGES/MyApp.mo

rrdtool and No font found

Recently we did an upgrade to CentOS 5.3 and rrdtool stopped working, specifically, rrdgraph. The reason is that there is no font installed in the system (not sure why, you can check it via “fc-list”). To fix this, do an “yum install xorg-x11-fonts-Type1” and make sure you see some fonts listed in “fc-list”. Also assume you already have fontconfig.

apf vs. newly assigned IP address

If you try to ping/traceroute and got this message, there are several places to look. First, disable the firewall and if it works again then you know it’s the firewall. In this case, APF. An call to “iptables -L -n” might be able to narrow down the root cause.

PING 173.x.x.x 56(84) bytes of data.
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted

Edit conf.apf

Switch this off (from 1 to 0) and “service apf restart”.

# Block all ipv4 address space marked reserved for future use (unassigned),
# such networks have no business talking on the Internet. However they may at
# some point become live address space. The USE_RD option further in this file
# allows for dynamic updating of this list on every full restart of APF. Refer
# to the 'internals/reserved.networks' file for listing of address space.
BLK_RESNET="0"

Getting started with EC2 tutorial

I just start playing with EC2 today and these are some useful notes and observation. The small standard instance is quite slow, only scores 50 under Unixbench-WHT. Our quads E5405 are around 410+, Q9550 is at 650-750.

I also was confused about S3 versus EBS. The console management makes life much easier, but could be improved even further. This is what you do after attaching a EBS volume to an instance:

mkfs -t ext3 /dev/sdx
mkdir /mnt/data-store
mount /dev/sdx /mnt/data-store

For CentOS AMI (ami-0459bc6d), you need to run this to be able to customize the AMI and build your own

depmod -a
modprobe loop

As for performance, it’s pretty disappointing indeed. I ran Unixbench WHT 4.1 and small instance only got 51 (CentOS 5 32-bit) and the large instance got 111 (CentOS 5 64-bit). If you run an instance 24/7, it’s much more expensive for the same performance of a dedicated server. Our quad core servers usually get 600+ on the same test. The price you pay for EC2 is “on-demand”, meaning that you need to automate it to the point scaling up during peak is seamlessly and not having to run a single or even multiple instances all the time.

Adaptec RAID under CentOS

Download the Storage Manager RPM for your card model and architecture from their site http://www.adaptec.com/en-US/support/raid/

If you run /usr/StorMan/arcconf and get this error:

./arcconf: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

Do this

export LD_PRELOAD=/usr/StorMan/libstdc++.so.5

root@r StorMan]# ./arcconf 

  | UCLI |  Adaptec uniform command line interface
  | UCLI |  Version 5.30 (B17509)
  | UCLI |  (C) Adaptec 2003-2008
  | UCLI |  All Rights Reserved

 COPYBACK      | toggles controller copy back mode
 CREATE        | creates a logical device
 DATASCRUB     | toggles the controller background consistency check mode
 DELETE        | deletes one or more logical devices
 FAILOVER      | toggles the controller autotomatic failover mode
 SNAPSHOT      | creates a copy of a logical device
 GETCONFIG     | prints controller information
 GETLOGS       | gets controller log information
 GETSTATUS     | displays the status of running tasks
 GETVERSION    | prints version information for all controllers
 IDENTIFY      | blinks LEDS on device(s) connected to a controller
 KEY           | installs a Feature Key onto a controller
 MODIFY        | performs RAID Level Migration or Online Capacity Expansion
 RESCAN        | checks for new or removed drives
 ROMUPDATE     | updates controller firmware
 SETALARM      | controls the controller alarm, if present
 SETCONFIG     | restores the default configuration
 SETCACHE      | adjusts physical or logical device cache mode
 SETNAME       | renames a logical device given its logical device number
 SETPRIORITY   | changes specific or global task priority
 SETSTATE      | manually sets the state of a physical or logical device
 TASK          | performs a task such as build/verify on a physical or logical device

Get info

[root@r StorMan]# ./arcconf getconfig 1
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : Adaptec 3405
   Controller Serial Number                 : 7C2102FD
   Physical Slot                            : 3
   Temperature                              : 32 C/ 89 F (Normal)
   Installed memory                         : 128 MB
   Copyback                                 : Disabled
   Background consistency check             : Disabled
   Automatic Failover                       : Enabled
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded          : 1/0/0
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (12379)
   Firmware                                 : 5.2-0 (12379)
   Driver                                   : 1.1-5 (2409)
   Boot Flash                               : 5.2-0 (12379)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Optimal
   Over temperature                         : No
   Capacity remaining                       : 99 percent
   Time remaining (at current draw)         : 3 days, 1 hours, 11 minutes

----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : raid 10
   RAID level                               : 10
   Status of logical device                 : Optimal
   Size                                     : 139798 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back) when protected by battery
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Group 0, Segment 0                       : Present (0,0) 3LQ1330009747KV9
   Group 0, Segment 1                       : Present (0,1) 3LQ1SJ7009747KHQ
   Group 1, Segment 0                       : Present (0,2) 3LQ2TB3009746GYX
   Group 1, Segment 1                       : Present (0,3) 3L17LJ6009750G35


----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device            : 0,0
         Reported Location                  : Connector 0, Device 0
         Vendor                             : SEAGATE
         Model                              : ST373455SS
         Firmware                           : 0002
         Serial number                      : 3LQ1323Y00009747KV9
         World-wide name                    : 5000C50004962A3
         Size                               : 70007 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device            : 0,1
         Reported Location                  : Connector 0, Device 1
         Vendor                             : SEAGATE
         Model                              : ST373455SS
         Firmware                           : 0002
         Serial number                      : 3LQ12SJ70747KHQ
         World-wide name                    : 5000C50004961D8
         Size                               : 70007 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device            : 0,2
         Reported Location                  : Connector 0, Device 2
         Vendor                             : SEAGATE
         Model                              : ST373455SS
         Firmware                           : 0002
         Serial number                      : 3LQ12T009746GYX
         World-wide name                    : 5000C500049604F
         Size                               : 70007 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device            : 0,3
         Reported Location                  : Connector 0, Device 3
         Vendor                             : SEAGATE
         Model                              : ST373455SS
         Firmware                           : 0002
         Serial number                      : 3LQ17LJ60000G35
         World-wide name                    : 5000C500049FE35
         Size                               : 70007 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No


Command completed successfully.

FreeNX is cool

If you ever need to access a CentOS (RHEL for that matter) server remotely, use FreeNX. It’s very easy to install, just follow the instructions on this page:

http://wiki.centos.org/HowTos/FreeNX

Just a note, you can leave the authentication via password (assuming you have a strong one) instead of a key-based pass-through authentication. The instructions are still pretty much the same, only you don’t have to perform some steps.

Performance: wow, it’s pretty fast and it looks just the same as my own desktop. I’m using the NoMachine Client for Ubuntu 8.10.

Gotta love Ubuntu

I manage many Linux servers (CentOS) but never tried or considered to use Linux on desktop as a main option. Today, I tried Ubuntu on an existing Vista PC and installation as a virtual machine without any partitioning is the bomb. It makes trying out Ubuntu (in additional to Live CD) a breeze, really simple! Kudos to the Ubuntu teams. The way things work also very similar to Windows (though Macs are different for sure). Microsoft should be worry, for many many users, Ubuntu will be more than enough and user-friendly enough. Just like Mac OSX, it’s easy to use and yet if you need to look under the hood, you can also easily to so. Competition is indeed healthy, now we have a browser war (I installed and use Firefox, IE, Safari, Chrome, Opera on a frequent basis), and an OS war (Linux, Win, MacOS).