Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am trying to install and start db2 on my linux machine using the following script:

#!/usr/bin/env bash

MKDIR=/bin/mkdir
RM=/bin/rm
TAR=/bin/tar

DB2_SERVER_PROGRAM_PATH=/home/alok/Documents/Installers
DB2_SERVER_PROGRAM=v10.5_linuxx64_expc.tar.gz

echo "changing to $DB_SERVER_PROGRAM_PATH"
cd ${DB2_SERVER_PROGRAM_PATH}
echo "removing expc"
${RM} -rf expc
echo "untarring ${DB2_SERVER_PROGRAM}"
${TAR} zxf ${DB2_SERVER_PROGRAM}

echo "changing to expc"
cd expc

echo "Installing db2 as root"
sudo ./db2_install

echo "Adding user group db2grp1 as root"
sudo groupadd db2grp1
echo "Adding user group dasadm1 as root"
sudo groupadd dasadm1
echo "Adding user group db2fgrp1 as root"
sudo groupadd db2fgrp1

echo "Adding user db2inst1. Please provide password for new user db2inst1."
sudo useradd -g db2grp1 -G dasadm1 -m db2inst1
sudo passwd db2inst1

echo "Adding user dasusr1. Please provide password for new user dasusr1."
sudo useradd -g dasadm1 -G db2grp1 -m dasusr1
sudo passwd dasusr1

echo "Adding user db2fenc1. Please provide password for new user db2fenc1."
sudo useradd -g db2fgrp1 -m db2fenc1
sudo passwd db2fenc1

cd /opt/ibm/db2/V10.5/instance

echo "Creating DAS as root via user dasusr1."
sudo ./dascrt -u dasusr1

echo "Creating database instance as root via user db2fenc1 and db2inst1."
sudo ./db2icrt -u db2fenc1 db2inst1

echo "Setting communication protocol to tcpip as user db2inst1."
sudo -u db2inst1 ../adm/db2set DB2COMM=tcpip
echo "Setting SVCENAME 50000 for dbm cfg as user db2inst1."
sudo -u db2inst1 ../bin/db2 update dbm cfg using SVCENAME 50000

echo "starting db2 as user db2inst1."
sudo chmod +x ../adm/db2start
sudo -u db2inst1 ../adm/db2start

netstat -an | grep 50000

Everything works fine, till I get to the penultimate line:

sudo -u db2inst1 ../adm/db2start

SQL1641N  The db2start command failed because one or more DB2 database
manager program files was prevented from executing with root 
privileges by file system mount settings.

Now I checked /etc/fstab and it says:

proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/sda1       /               ext4    errors=remount-ro,user_xattr 0       1
UUID=d4d794eb-1e68-4ddf-a9ec-249a22f084fb none            swap    sw             0       0
/swapfile swap swap defaults 0 0

My installation path, /opt/ibm/db2/V10.5/adm is basically on /dev/sda1 and it's not mounted using the nosuid option.

Here is the output of mount:

alok@hostname:~$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro,user_xattr)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
shmfs on /dev/shm type tmpfs (rw,size=2048m)
gvfs-fuse-daemon on /home/alok/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=alok)

This again indicates that / is not mounted in nosuid mode. So why am I getting error SQL1641N? Is it a different problem throwing out this message instead?

share|improve this question
    
I chmod'd the db2start file to +s and this started working. Shouldn't this have been done by the installer to begin with? –  alok Sep 13 '13 at 8:57
    
Yes but how is that relevant at all? My installation is a root installation (see the script) in the question –  alok Sep 16 '13 at 3:09

1 Answer 1

up vote 3 down vote accepted

The files in /opt/ibm/db2/V10.5/ are not to be used for a specific instance. When you run the db2icrt command, it copies a series of files and directories into ~db2inst1/sqllib, and sets the permissions accordingly. (Some of the directories in ~db2inst1/sqllib will be soft links back to directories in /opt/ibm/db2/V10.5).

For example, you should find that ~db2inst1/sqllib/adm/db2start has permissions set to 6555 (i.e. -r-sr-sr-x), owned by root, and have the group owner set to the instance owner's primary group.

You should not be executing things from /opt/ibm/db2/V10.5/adm. That is why the permissions of the files in that directory are set the way they are – /opt/ibm/db2/V10.5/adm/db2start should be 0444.

So, to start your instance, you should be executing ~db2inst1/sqllib/adm/db2start.

Be aware that you also need to initialize the db2inst1 user environment prior to starting the instance, so you should use the -i option for sudo to handle this:

sudo -i -u db2inst1 /home/db2inst1/sqllib/adm/db2start

One last note: All of this configuration (except perhaps the db2start) can be done using a response file and db2setup. db2_install has been deprecated, so using response files is the way to handle this going forward.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.