Wednesday, 8 December 2010

SMT repo add

Lets say you have built and setup your own SMT already... and you want to add some custom rpms.. well here it is:

mkdir -p /srv/www/htdocs/my-repo/rpm/{i686,x86_64,noarch}

copy some RPMs into the respective arch directories

cd /srv/www/htdocs/my-repo/rpm/
createrepo -o $PWD .
gpg --gen-key

after a while you will get something like "gpg: key AEEF1332 marked as ultimately trusted"

gpg -a --detach-sign --default-key AEEF1332 repodata/repomd.xml
gpg -a --export AEEF1332 > repodata/repomd.xml.key

Now the RPM repo is done and can be used with YaST/zypper... but why not add it automagicaly to the smt configuration....

Add it for SLES 10:

smt-setup-custom-repos $( for i in $( smt-list-products -f csv \
| egrep "SUSE-Linux-Enterprise-Server.*(i(.*)86|x86_64)" | cut -d, -f1 \
| sed 's,",,g' ); do echo -n "--productid $i "; done ) \
--name 'My-Repo' \
--description 'Custom RPMs not part of SLES10-11 (i586/x86_64)' \
--exturl 'http://url/my-repo'

Add it for SLES11:

smt-setup-custom-repos $( for i in $( smt-list-products -f csv \
| egrep "SUSE_SLES.*(i(.*)86|x86_64)" | cut -d, -f1 \
| sed 's,",,g' ); do echo -n "--productid $i "; done ) \
--name 'My-Repo' \
--description 'Custom RPMs not part of SLES10-11 (i586/x86_64)' \
--exturl 'http://url/my-repo'

Or for both:

smt-list-products -f csv | egrep "SUSE_SLES.*(i(.*)86|x86_64)" | cut -d, -f1 | sed 's,",,g' > both
smt-list-products -f csv | egrep "SUSE-Linux-Enterprise-Server.*(i(.*)86|x86_64)" | cut -d, -f1 | sed 's,",,g' >> both
smt-setup-custom-repos $( for i in $(cat both); do echo -n "--productid $i "; done ) \
--name 'My-Repo' \
--description 'Custom RPMs not part of SLES10-11 (i586/x86_64)' \
--exturl 'http://url/my-repo'
rm both


And presto!


Now, after smt-mirror has been executed the next time (either by yourself or via the predefined crontab entry), SMT is able to assign this repository to clients. While this isn’t completely true - SMT is able to assign this custom catalog before running smt-mirror, but it just doesn’t make sense, since it doesn’t contain any data - it still works.

Now, once you install the next SLES10/SLES11 (hopefully you enabled suseRegister, that actually gathers the channels), SMT will assign this “update channel”, on top of all the others, to your system.


Cheers to http://blog.barfoo.org/ for the info

:)

Monday, 6 September 2010

mysql plesk error

After a mysql upgrade I got the following error while removing - adding users in mysql:
Error: Connection to the database server has failed:
Table ‘mysql.servers’ doesn’t exist

Solution (as root):

[root@server ~]# mysql_fix_privilege_tables --user=admin --password=<admin passord> --verbose

This script updates all the mysql privilege tables to be usable by
the current version of MySQL

ERROR 1060 (42S21) at line 102: Duplicate column name 'File_priv'
ERROR 1060 (42S21) at line 108: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 109: Duplicate column name 'Grant_priv'
.
.
.
ERROR 1060 (42S21) at line 647: Duplicate column name 'db_collation'
ERROR 1060 (42S21) at line 653: Duplicate column name 'body_utf8'
ERROR 1054 (42S22) at line 663: Unknown column 'Trigger_priv' in 'where clause'
done

Done!

:)

Monday, 8 February 2010

ossim locale

Quick note when installing OSSIM (2.1)

The error:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

It be comes a bit annoying since it is a default install... so here is the simple solution:

localedef -v -c -i en_GB -f UTF-8 en_GB.UTF-8

generates the locale manually and shuts it up :)

Thursday, 28 January 2010

umount trouble

Small note that I keep forgetting and I end up looking for it again and again:

If a mounted volume is used this is how we will find who is the bad boy that is using it:

The problem:

umount /media/disk/
umount: /media/disk: device is busy

The solution:

fuser -m /dev/sdc1
or
fuser -c /mnt/disk

will give us

/dev/sdc1: 538

so we can

ps auxw|grep 538

and

kill -9 538


woohoo! :)

an rpm repo in the making (quick)

Ok.. since we build the rpms we want.. lets build the yum repo we will distribute them from.

on the server side:

mkdir -p /srv/www/htdocs/custom-rpms
cp /usr/src/packages/RPMS/x86_64/*.rpm /srv/www/htdocs/custom-rpms/
cd /srv/www/htdocs/custom-rpms/
createrepo -v .
gpg --gen-key
gpg --list-keys
gpg -a --detach-sign --default-key repodata/repomd.xml
gpg -a --export > repodata/repomd.xml.key
from the client side:
(SLES 10)
zypper --no-gpg-checks --non-interactive sa http://your-smt-server/custom-rpms/

(or the recommended way)
rug set-prefs security-level checksum
rug sa http://your-smt-server/custom-rpms/ Custom-RPMS


more will come... :)

Thursday, 21 January 2010

an rpm in the making (quick)

Lets see....

We have /usr/src/packages/
In there we got:
BUILD -- (where the build process happens)
RPMS -- (where we will find the resulting rpm ... in x86_64 or other)
SOURCES -- (where the files mentioned as sources in the .spec file live)
SRPMS -- (we dont care about you) and
SPECS -- (where the .spec files live)

so...

we create the .spec file (dont ask how)

and we put the sources where they need to go

change to the /usr/src/pacakges/SPECS/ directory and run

rpmbuild --bb package-name.spec

and if your spec file is correct we should get an rpm ready in the /usr/src/packages/RPMS/x64_64/ directory

Have fun :)

Thursday, 14 January 2010

Useful netbackup commands

You are stuck using netbackup (which is a great product but nevertheless not fun!), do not despair! Here are some commands that might make your life easier:

Get the names and the number of backups saved for a client
bpimagelist -client -d 01/01/2007 | grep IMAGE | awk '{ print $6 }'

Find and eliminate all backups for a client
for i in $(bpimagelist -client -d 01/01/2007 | grep IMAGE | awk '{ print $6 }')
do
bpexpdate -backupid $i -d 0 -force (or not -force to ask y/n)
done


Get a list of the clients
bpplclients

Check out the netbackup processes running
bpps -x

Force quit all netbackup processes
bp.kill_all

Run an (expired) image cleanup
bpimage -cleanup

Predict the schedule for a policy
nbpemreq -predict -date 01/17/2010 -policy_filter

 

Thats all for now :)

Wednesday, 13 January 2010

force fsck

For whatever reason you would like to do this, this is how to:


Set the mount count to maximum of 1 mounts

tune2fs -c 1 /dev/sda1


fsck the partition

fsck -a /dev/sda1


and dont forget after you finish to set it back to 35

tune2fs -c 35 /dev/sda1


Thanks for playing :)