Archive for the ‘Commands’ Category

If on starting matlab, you get this error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid

Set this environment variable.

$ export LC_ALL="en_US.utf8"

Matlab should then start ok.

A student wanted the latest version of ROOT added to the ups database. The software was already installed in /cdf/code/cdfsoft/root, but didn’t show up with ups list -a root. To fix this, I became the owner of all our cdf software and ran the following command:

ups declare root v_5_22_00j -r root/v5_22_00j-GCC_3_4_6/Linux+2.6 -f Linux+2 -z /cdf/code/cdfsoft/products/upsdb -m root.table -q GCC_3_4_6

It took a few times to get this correct. If you make a mistake you can run the undeclare command, or even easier, just delete the file in /cdf/code/cdfsoft/products/upsdb/root/v_5_22_00j and then run the declare command again.

All the software is installed in /cdf/code/cdfsoft/products. Then look in root/v5_22_00j-GCC_3_4_6 to find that version. The important bit for ups is the table file, which in this case is in /cdf/code/cdfsoft/products/root/v5_22_00j-GCC_3_4_6/Linux+2.6/ups/root.table.

[/ups]$ more root.table 
File    = table
Product = root

Group:

  Flavor     = ANY
  Qualifiers = "GCC_3_4_6"

  Flavor     = ANY
  Qualifiers = "GCC_3_4_6:debug"

  Flavor     = ANY
  Qualifiers = "64bit:GCC_3_4_6"

  Flavor     = ANY
  Qualifiers = "64bit:GCC_3_4_6:debug"

Common:
  Action = setup
    setupEnv()
    prodDir()
    envSet(ROOTSYS,${UPS_PROD_DIR});
    envPrepend(LD_LIBRARY_PATH,${ROOTSYS}/lib)
    envPrepend(PYTHONPATH,${ROOTSYS}/lib)
    pathPrepend(PATH,${ROOTSYS}/bin)
End:

This is the file that lists the flavor and qualifiers that must be used when declaring the version.

Error message looked like this:

[~]# yum -y upgrade
Loaded plugins: rhnplugin, security
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30977) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30977)
error: cannot open Packages database in /var/lib/rpm

Fix:

[ ~]# rm /var/lib/rpm/__db*
[ ~]# rpm -rebuilddb
[ ~]# yum clean all

Download source and run ./configure. Settings of my last compilation:

./configure linuxx8664gcc --prefix=/code/root_v5.30.00_rhel5_x64

Be sure the following are installed:
libX11-devel
libXpm-devel
libXft-devel
libXext-devel

After make install, add the library to /etc/ld.so.conf and run ldconfig -v. Here is what my /etc/ld.so.conf file contains:

include ld.so.conf.d/*.conf
/code/root_v5.30.00_rhel5_x64/lib/root

To run, set:

export ROOTSYS=/code/root_v5.30.00_rhel5_x64
export PATH=$ROOTSYS/bin:$PATH

I installed ruby 1.9.2 and had a problem with rubygems.

[root@server]# gem list
ERROR:  Loading command: list (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::ListCommand

To fix, I had to:

yum install zlib-devel

And then go back to the ruby source code and in ~/ruby-1.9.2-p0/ext/zlib, run the following:

[root@server zlib]# ruby extconf.rb
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for kind of operating system... Unix
checking for crc32_combine() in zlib.h... yes
checking for adler32_combine() in zlib.h... yes
creating Makefile
[root@server zlib]# make
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_ZLIB_H -DOS_CODE=OS_UNIX -DHAVE_CRC32_COMBINE -DHAVE_ADLER32_COMBINE -D_FILE_OFFSET_BITS=64 -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o zlib.o -c zlib.c
gcc -shared -o zlib.so zlib.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lz -lpthread -lrt -ldl -lcrypt -lm -lc
[root@server zlib]# make install
/usr/bin/install -c -m 0755 zlib.so /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux

Sendmail has a feature that puts in a delay after the initial client connect, before issuing the greeting. Some spammers don’t wait for the greeting, but just send their commands. Sendmail can then look for commands that come in before the greeting and know that these commands are bad. It works pretty well.

Edit /etc/mail/sendmail.mc

dnl # Pause to try to catch spammers.  Drops mail from spammers who don't
dnl # wait for the 5 second delay
FEATURE(`greet_pause',5000)

Edit /etc/mail/access to not use the delay for mail from the localhost

GreetPause:localhost	0

Then, put the changes into effect.

make -C /etc/mail
makemap hash /etc/mail/access.db < /etc/mail/access
/etc/rc.d/init.d/sendmail restart

Check what's being dropped with:

grep pre-greeting /var/log/maillog

After around 40 minutes, I had already dropped over 50 connections.

Some csh and tcsh users get automatically logged out of systems after 60 minutes of inactivity. To disable this, add to .cshrc file:


# Disable the autologout
unset autologout

You can see the current settings by running the set command.

Every five minutes or so, I’m getting an error message like this:

Traceback (most recent call last):
 File "/usr/lib/mailman/cron/gate_news", line 284, in ?
   main()
 File "/usr/lib/mailman/cron/gate_news", line 264, in main
   process_lists(lock)
 File "/usr/lib/mailman/cron/gate_news", line 194, in process_lists
   for listname in Utils.list_names():
 File "/usr/lib/mailman/Mailman/Utils.py", line 96, in list_names
   return Site.get_listnames()
 File "/usr/lib/mailman/Mailman/Site.py", line 110, in get_listnames
   for fn in os.listdir(mm_cfg.LIST_DATA_DIR):
OSError: [Errno 2] No such file or directory: '/var/lib/mailman/lists'

In /etc/cron.d/mailman,

# Every 5 mins, try to gate news to mail.  You can comment this one out
# if you don't want to allow gating, or don't have any going on right now,
# or want to exclusively use a callback strategy instead of polling.
#0,5,10,15,20,25,30,35,40,45,50,55 * * * * mailman /usr/lib/mailman/cron/gate_news

I don’t really understand what gating is and I don’t think we’re using it. So I’ve commented it out.

The elog program wants a server.crt and server.key file. We can make both with the Makefile in /etc/pki/tls/certs. However, these files will have a passphrase on them. This is bad because we want the elog program to start automatically at boot. If a passphrase is required, this won’t work. So we need to take the passphrase off.


make server.key
mv server.key server.key.withpassphrase
openssl rsa -in server.key.withpassphrase -out server.key
make server.crt

If you get a message like this every time you start OpenOffice:

and you know these files are bad or deleted or whatever and you no longer want them, you can tell openoffice to quit trying to recover them by deleting the file:

~/.openoffice.org/3/user/registry/data/org/openoffice/Office/Recovery.xcu