Monday, August 23, 2010

Oracle Express 10g (Oracle XE) on Suse Linux Enterprise 11 (SLES 11)

Sometimes things are simple.

I was having troubles to install Oracle XE on a SLES 11 Box.
The Lister would start. But not the Web Interface (http://localhost:8080/apex)

Since my Oracle knowledge is limited I was stuck. Only this Post gave me a hint where to look

oracle@ivml2114:~/app/oracle/product/10.2.0>./server/bin/oracle_env.sh                                                                                     
oracle@ivml2114:~/app/oracle/product/10.2.0> lsnrctl start                                                                                                  

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-AUG-2010 11:29:42

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started
oracle@ivml2114:~/app/oracle/product/10.2.0> sqlplus /nolog              

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 23 11:30:00 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect sys/ as sysdba
oracleXE: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
ERROR:                                                                                                                
ORA-12547: TNS:lost contact                                                                                          


Bingo! This is a 64 Bit System. Oracle Xe is 32 Bit. Argh. I did check for the dependencie mentioned in the Oracle docu. But of course missed this.

#zypper in libaio-32bit

To be sure I then re-installed Oracle XE. And you know what? It Works!

Thursday, August 12, 2010

Using ifup/down with local Lan and Wireless

I have a Notebook sitting in the living room. Its mostly for reading Mails/Blogs, checking the Weather. Occasionally I hook it up to the TV to watch Movies. Here's where the trouble starts: To do that I connect the Notebook to a Physical Network for Bandwidth reasons. The Movies sit on a NAS.
I configured the Notebook to be on IfUp/-Down in contrast to using Networkmanager since It will only connect to one pre-configured Wireles LAN. This way I am able to remotely connect to the Notebook even though nobody is logged in. The NM will only connect on login. 

My FritzBox hands out IP-Addresses from the same Subnet to all Clients on WLAN and LAN. This causes troubles when the Notebook is connected to the Physical LAN. The WLAN and LAN interface compete to be the default gateway. After plugging in the routing gets mixed up and I loose connection.

The solution is easy: Tell ifplugd to switch off the other Card on Ifup.

In Yast I configured the Devices to be started on cable connect. This changes the /etc/sysconfig/network/ifcfg-eth0 and ifcfg-wlan0 files to :

... 
 STARTMODE='ifplugd'
...

Then I changed the Script /etc/ifplugd/ifplugd.action. The script is called whenever a change in connection is detected by ifplugd. Its called with the Device (et0/wlan0) as $1 and the command (up/down) as $2. My change simply Downs the respective "other" Interface:

...
[ "$1" = eth0 ] OTHER = wlan0                                                   
[ "$1" = wlan0 ] OTHER = eth0                                                   
                                                                                
[ "$2" = "up" ] && exec /sbin/ifup $1 -o ifplugd && exec /sbin/ifdown $OTHER    
[ "$2" = "down" ] && exec /sbin/ifdown $1 -o ifplugd && exec /sbin/ifup $OTHER  
...

I only tested this on OpenSuse 11.3 but I think it will work with most other Distros that have ifplugd,

Tuesday, April 13, 2010

Set up git on Synology NAS

I just installed a NAS at home.
It's going to be my primary Data Silo so naturally I need to store my (backup-/published-) git repos there.

The Synology thing I bought comes with Linux/Busybox. Hacking around is surprisingly easy, they actually encourage you to do it.

Of course I could have gone the easy way of nfs-mounting my shares and then have used local paths to update the repos. But I wanted to be able to do this from the road using ssh. So I needed git to be Installed.

Here is what I needed to do to install git on the Box:
  1. Open ssh. Easy its in the GUI.
  2. Create users and shares
  3. Set up your User accounts to:

    • Have a proper Home Directory
    • Be able to log in using Public/Private keys
  4. Configure Additional Software Repositories
  5. Install git
  6. Configure sshd so that git+ssh works

1. Open ssh


Open the Web interface of the Box.
Select the "Management" View.
Go to "Network Services" -> "Terminal"
Select "Enable SSH service" and click "OK"
done

2. Create users and shares
Go to "Privileges" -> "User" and create a User
We need at leas one share to be able to transfer a File to the Box.

3.Set up your User accounts
Use ssh to log in as "root" on the box. Use the "Admin" password that you provided when
Initially setting up the NAS.

You will see the Busybox promt:
BusyBox v1.1.0 (2010.03.12-16:58+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

syn>

create home directories for your users:
mkdir -p /volume1/home/user1

Then edit /etc/passwd to enable the user for ssh use. We change he home dir set the login shell:
...
user1:x:1026:100::/volume1/home/user1:/bin/sh
...

By the way. /bin/sh is NOT Bash here. Its Busybox (ash).
Now you should be able to access the NAS through ssh with that user.

For convenience we want to be able to use Public/Private keys for login:

Edit /etc/ssh/sshd_config and change the Lines regarding Public Key Authentication:
...
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
...


Restart sshd:
/usr/syno/etc/rc.d/S95sshd.sh restart

Oddly this sometimes only works half way. If your sshd does not come back, simply switch it back on in the Web interface.

Now copy your public key to a share and move it to the authorized_keys file:
mkdir -p /volume1/home/user1/.ssh
mv /volume1/someshare/id_dsa.pub /volume1/home/user1/.ssh/authorized_keys

Now you should be able to log in without a password.

4. Configure Additional Software Repositories

Pretty straight forward as described in the Synology wiki

Copy the boostrap file to a Share ( syno-mvkw-bootstrap_1.2-7_arm.xsh), then run it as root on the box:
sh /volume1/someshare/syno-mvkw-bootstrap_1.2-7_arm.xsh



5. Install git
Look for the git package:
ipkg list|grep git
dcraw - 1.376-2 - Decoding raw digital photos.
digitemp - 3.6.0-1 - Reads 1-Wire Temperature sensor (http://www.digitemp.com)
git - 1.6.6.2-1 - GIT is a directory tree content manager that can be used for distributed revision control.
git-lite - 1.6.6.2-1 - GIT is a directory tree content manager that can be used for distributed revision control.
git-manpages - 1.6.6.2-1 - manpages of git
git-svn - 1.6.6.2-1 - git as svn client
gitosis - git20090917-1 - Git repository hosting application.
gphoto2 - 2.4.1-1 - Command line digital camera software applications
libdlna - 0.2.3-2 - Reference DLNA (Digital Living Network Alliance) open-source implementation for Linux.
libgphoto2 - 2.4.1-1 - digital camera software libraries
sane-backends - 1.0.20+git20091022-1 - SANE is a universal scanner interface
squeezecenter - 7.3.3-1 - Streaming Audio Server for Logitech Squeezebox
stgit - 0.14.3-2 - StGit is a Python application providing similar functionality to Quilt (i.e. pushing/popping patches to/from a stack) on top of
tig - 0.15-1 - Tig is a git repository browser that additionally can act as a pager for output from various git commands.

Install it:
ipgk install git


Now we can create a repo for publishing. Log in as your user:
mkdir -p /volume1/git/test
cd /volume1/git/test
git init --bare
Initialized empty Git repository in /volume1/git/test/


6.Configure sshd so that git+ssh works
Now git works in regular login shells. When using git to clone the new repo this fails:
git clone ssh://192.168.178.29/volume1/git/test
Initialized empty Git repository in /data/t/.git/
sh: git-upload-pack: not found
fatal: The remote end hung up unexpectedly

This means that the "git-upload-pack" on the NAS was not found in the $PATH.
The ipkg Packages are installed to /opt/(s)bin which is not in sshds standard path.
Since sshd for BusyBox was configured not to parse /etc/profile or ~/.profile we have to fall back to providing a ~/.ssh/environment file with the correct path:
PATH=/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin

The Path can be copied from /root/.profile
To switch on user environments in sshd, configure /etc/ssh/sshd_config :
...
PermitUserEnvironment yes
...

Then restart sshd.

Have fun!

Sunday, April 5, 2009

Configure netconfig for static search domains

I wrote this for Novell's Cool Solutions: http://www.novell.com/communities/node/6782/configure-netconfig-static-domain-search-lists

In SLE11 we have a new (better) way to set up automatic network configuration.

Its called netconfig (man 8 netconfig). Its a "modular tool to modify network configuration".

Well in my SLED11 RC1 Box it pretty much worked out of the box. Except:

  • When using Modem devices (eg UMTS/G3 via a Phone) DNS Servers where not added to /etc/resolv.conf ( see bnc#429772 )

  • Static search entries did not work / where overwritten by NetworkManager


Netconfig uses a bunch of scripts in /etc/netconfig.d to do the actual work. Its configuration resides in /etc/sysconfig/network/config

The following tries to fully explains what is happening. If you're just interested in the Solution skip down to Summary.

The Search Domain Problem

If you're just as lazy as me you don't want to type Fully Qualified Domain Names all the time. Of course you could use /etc/hosts but thats boring and not very transportable.

So I set up NETCONFIG_DNS_STATIC_SEARCHLIST in /etc/sysconfig/network/config. But it doesn't work when using NetworkManager. The NM overwrites the search entries in /etc/resolv.conf if it finds something in DHCP. Bummer.

What is happening

netconfig uses a bunch of script (modules) to decide what to do in certain situations. The Modules are configured using the NETCONFIG* Variables in /etc/sysconfig/network/config.

The variable NETCONFIG_DNS_POLICY is used to control how netconfig should set up Name Servers in /etc/resolv.conf

Excerpt from /etc/sysconfig/network/config (default):
...
## Type: string
## Default: "auto"
#
# Defines the DNS merge policy as documented in netconfig(8) manual page.
# Set to "" to disable DNS configuration.
#
NETCONFIG_DNS_POLICY="auto"
...

Unfortunately man 8 netconfig only has this to say about NETCONFIG_DNS_POLICY:

NETCONFIG_DNS_POLICY -Defines the DNS merge policy.

Nothing about what the actual Values could be.

The /etc/netconfig.d/dns-resolver script is responsible for setting resolv.conf so we find our possible values here:

Excerpt from /etc/netconfig.d/dns-resolver (SLED 11 RC1 Version):
...
# just for the case we need the original value...
_NETCONFIG_DNS_POLICY="$NETCONFIG_DNS_POLICY"
if [ "$_NETCONFIG_DNS_POLICY" = "auto" ]; then
if [ "x$NETWORKMANAGER" = "xyes" ] ; then
#
# Use NetworkManager policy merged data
#
_NETCONFIG_DNS_POLICY='STATIC_FALLBACK NetworkManager'
else
#
# We use static settings and extend them
# with interface specific if available
#
_NETCONFIG_DNS_POLICY='STATIC *'
fi
elif [ "x$_NETCONFIG_DNS_POLICY" = "x" ]; then
#
# empty policy means do not touch anything.
# successful exit.
#
exit 0;
fi
#
# A * or ? is evaluated in the "for loop", so we need to replace it
#
_NETCONFIG_DNS_POLICY=`echo "$_NETCONFIG_DNS_POLICY" | \
sed 's/\*/__ALL__/g' | sed 's/\?/__ONE__/g'`

sf=0
for POL in $_NETCONFIG_DNS_POLICY; do
case "$POL" in
(NetworkManager)
if [ "x$NETWORKMANAGER" = "xyes" ] ; then
debug "Use NetworkManager policy merged settings"
CFG="$STATEDIR/NetworkManager.netconfig"
if [ -r "$CFG" ] ; then
get_dns_settings "$CFG"
fi
break
fi
;;
(STATIC)
debug "Keep Static"
DNS_SEARCHLIST="$DNS_SEARCHLIST $NETCONFIG_DNS_STATIC_SEARCHLIST"
DNS_SERVERS="$DNS_SERVERS $NETCONFIG_DNS_STATIC_SERVERS"
;;
(STATIC_FALLBACK)
debug "Static Fallback"
sf=1
;;
(*)
#
# revert the replacement; now we want the evaluation
#
POL=`echo "$POL" | sed 's/__ALL__/*/g' | sed 's/__ONE__/?/g'`
debug "Other: $POL"
for IFDIR in $STATEDIR/$POL; do
test -d "$IFDIR" -a \
-d "/sys/class/net/${IFDIR##*/}" || continue
# proceed every interface we find with this match
manage_interfaceconfig "$IFDIR"
done
;;
esac
done
...

This tells us that we can use the values auto, STATIC, STATIC_FALLBACK, NetworkManager and /sys/class/net/ Interfaces ( with * and ? wildcards ).

The Cause

What it also tells us is that the default auto is translated to STATIC_FALLBACK NetworkManager.

STATIC_FALLBACK only uses the value in NETCONFIG_DNS_STATIC_SEARCHLIST if the NetworkManager does not provide a value.

Excerpts from /etc/netconfig.d/dns-resolver
...
if [ $sf -eq 1 -a -z "$DNS_SEARCHLIST" ]; then
DNS_SEARCHLIST="$NETCONFIG_DNS_STATIC_SEARCHLIST"
fi
...

The Solution

Change the configuration in NETCONFIG_DNS_POLICY from STATIC_FALLBACK to STATIC

Excerpt from /etc/sysconfig/network/config
NETCONFIG_DNS_POLICY="STATIC NetworkManager"

Et voila! Working hostname search.

Summary

To use a static domain search configure your search :

Excerpt from /etc/sysconfig/network/config
NETCONFIG_DNS_STATIC_SEARCHLIST="my.domain.tld"

And then configure netconfig to keep static configurations even when oder modules provide the information:

Excerpt from /etc/sysconfig/network/config
NETCONFIG_DNS_POLICY="STATIC NetworkManager"

Configure netconfig for modem use

I wrote this one for Novell's Cool Solutions: http://www.novell.com/communities/node/6781/configure-netconfig-modem-use

In SLE11 we have a new (better) way to set up automatic network configuration.

Its called netconfig (man 8 netconfig). Its a "modular tool to modify network configuration".

Well in my SLED11 RC1 Box it pretty much worked out of the box. Except:

  • When using Modem devices (eg UMTS/G3 via a Phone) DNS Servers where not added to /etc/resolv.conf

  • Static search entries did not work / where overwritten by NetworkManager


Netconfig uses a bunch of scripts in /etc/netconfig.d to do the actual work. Its configuration resides in /etc/sysconfig/network/config

The following tries to fully explains what is happening. If you're just interested in the Solution skip down to Summary.

The modem device Problem

I use a Nokia E51 for UMTS/3G Internet connection when on the road. The setup is fairly easy using a USB Cable. Just plug in the Phone and configure it as if it was a USB Modem. (for Bluetooth setup see Accessing the Internet via Bluetooth and Mobile Phone )

Unfortunately when I do that I never got DNS servers put into /etc/resolv.conf.

What is happening

netconfig uses a bunch of script (modules) to decide what to do in certain situations. The Modules are configured using the NETCONFIG* Variables in /etc/sysconfig/network/config.

The variable NETCONFIG_DNS_POLICY is used to control how netconfig should set up Name Servers in /etc/resolv.conf

Excerpt from /etc/sysconfig/network/config (default):
...
## Type: string
## Default: "auto"
#
# Defines the DNS merge policy as documented in netconfig(8) manual page.
# Set to "" to disable DNS configuration.
#
NETCONFIG_DNS_POLICY="auto"
...

Unfortunately man 8 netconfig only has this to say about NETCONFIG_DNS_POLICY:

NETCONFIG_DNS_POLICY -Defines the DNS merge policy.

Nothing about what the actual Values could be.

The /etc/netconfig.d/dns-resolver script is responsible for setting resolv.conf so we find our possible values here:

Excerpt from /etc/netconfig.d/dns-resolver (SLED 11 Rc1 Version):
...
# just for the case we need the original value...
_NETCONFIG_DNS_POLICY="$NETCONFIG_DNS_POLICY"
if [ "$_NETCONFIG_DNS_POLICY" = "auto" ]; then
if [ "x$NETWORKMANAGER" = "xyes" ] ; then
#
# Use NetworkManager policy merged data
#
_NETCONFIG_DNS_POLICY='STATIC_FALLBACK NetworkManager'
else
#
# We use static settings and extend them
# with interface specific if available
#
_NETCONFIG_DNS_POLICY='STATIC *'
fi
elif [ "x$_NETCONFIG_DNS_POLICY" = "x" ]; then
#
# empty policy means do not touch anything.
# successful exit.
#
exit 0;
fi
#
# A * or ? is evaluated in the "for loop", so we need to replace it
#
_NETCONFIG_DNS_POLICY=`echo "$_NETCONFIG_DNS_POLICY" | \
sed 's/\*/__ALL__/g' | sed 's/\?/__ONE__/g'`
sf=0
for POL in $_NETCONFIG_DNS_POLICY; do
case "$POL" in
(NetworkManager)
if [ "x$NETWORKMANAGER" = "xyes" ] ; then
debug "Use NetworkManager policy merged settings"
CFG="$STATEDIR/NetworkManager.netconfig"
if [ -r "$CFG" ] ; then
get_dns_settings "$CFG"
fi
break
fi
;;
(STATIC)
debug "Keep Static"
DNS_SEARCHLIST="$DNS_SEARCHLIST $NETCONFIG_DNS_STATIC_SEARCHLIST"
DNS_SERVERS="$DNS_SERVERS $NETCONFIG_DNS_STATIC_SERVERS"
;;
(STATIC_FALLBACK)
debug "Static Fallback"
sf=1
;;
(*)
#
# revert the replacement; now we want the evaluation
#
POL=`echo "$POL" | sed 's/__ALL__/*/g' | sed 's/__ONE__/?/g'`
debug "Other: $POL"
for IFDIR in $STATEDIR/$POL; do
test -d "$IFDIR" -a \
-d "/sys/class/net/${IFDIR##*/}" || continue
# proceed every interface we find with this match
manage_interfaceconfig "$IFDIR"
done
;;


esac
done
...

This tells us that we can use the values auto, STATIC, STATIC_FALLBACK, NetworkManager and /sys/class/net/ Interfaces ( with * and ? wildcards ).

The Cause

What it also tells us is that the default auto only is translated to STATIC_FALLBACK NetworkManager and no devices.

This is why any ppp or modem device connections will not be used for Name Server setup in the default configuration.

There is a good reason for that. /etc/resolv.conf only supports up to 3 nameserver Entries.

This means if you have for instance 2 DNS Servers in ppp and 2 more coming from NetworkManager one is going to fall off the grid.

So for the sake of a stable NetworkManager setup the default was chosen to not include ppp* or modem* devices. See bnc#429772 )

The Solution

Configure NETCONFIG_DNS_POLICY to include all Network Devices we need. In my case I need modem0. Of cource preserve STATIC and NetworkManager as well. Put NetworkManager last. Its a bit of a Bully and wants to be the last one to do things.

Excerpt from /etc/sysconfig/network/config
NETCONFIG_DNS_POLICY="STATIC_FALLBACK modem* NetworkManager"

Et voila! Working DNS resolving when dialing in via Modem.

Summary

To be able to have DNS resolution when dialed in via modem configure netconfig to look for your (ppp or modem) devices:

Excerpt from /etc/sysconfig/network/config
NETCONFIG_DNS_POLICY="STATIC_FALLBACK modem* NetworkManager"

Please be aware that all sources might provide Name Servers. This could mean that there will be more that the max of 3 for /etc/ressolv.conf.

Sunday, December 7, 2008

Feed Statistics

Hi,

I just realized that I didn't knew if there is actually anybody besides me is reading this stuff. ( You shouldn't. I told you so ;-) ) So I switched to feedburner for RSS feed tracking.

Shout at me through chris ( the at sign ) wonko.de if this breaks anything for you.

Wednesday, November 12, 2008

Cleaning a Hard Drive

Recovering deleted files from Hard Drives is not as hard as one might think. Simplified its mostly only a removal of the Index entry pointing to the space occupied by the data.

If you want to make sure that the Data is destroyed you have to make sure that is overwritten. Actually it needs to be overwritten multiple times with random data so that recovering the data becomes really hard.

I use scrub (diskscrub package / http://diskscrub.sourceforge.net ) before giving away Drives. scrub also has a feature where it fills up the remaining space of a file system. This helps if you need to get rid of some NDA stuff and don't want to nuke the whole thing.

scrub can write patterns direct to disk, destroying any file system (preferred method), or it can write patterns on files, or on file system free space.

Scrub writes NNSA NAP-14.x, DoD 5220.22-M, BSI, 35-pass gutmann, or one of several other selectable pattern sequences.

Diskscrub in the openSUSE buildservice:
http://download.opensuse.org/repositories/home:/elvigia/