Tomcat6 – SLES11sp3 – "This account is currently not available."

The problem is located in the initscript (/etc/rc.d/init.d/tomcat6) with the invocation of the $SU command, which is either /sbin/runuser or /bin/su. Please note there are multiple places in the initscript where $SU is invoked, here is one typical example.

$SU – $TOMCAT_USER -c “${TOMCAT_SCRIPT} start” >> $TOMCAT_LOG 2>&1

The key element here to notice is that a command line is being passed via the -c argument, this requires the user ($TOMCAT_USER) to have a shell in which to execute the -c command. But system daemons shouldn’t have login shells for security reasons. If $TOMCAT_USER doesn’t have a login shell then $SU aborts with the message:

“This account is currently not available.”

The solution is to provide a temporary shell to $SU for the purpose of executing the -c command. This can be done with the -s arg to $SU. One possible solution would be to modify the definition of $SU in the script, thus:

# For SELinux we need to use 'runuser' not 'su'
if [ -x "/sbin/runuser" ]; then

would become:

if [ -x "/sbin/runuser" ]; then
SU="/sbin/runuser -s /bin/sh"
SU="/bin/su -s /bin/sh"

Testing whether a string is null.

Testing whether a string is null.

# Testing null strings and unquoted strings,
#+ but not strings and sealing wax, not to mention cabbages and kings . . .

# Using if [ … ]

# If a string has not been initialized, it has no defined value.
# This state is called “null” (not the same as zero!).

if [ -n $string1 ] # string1 has not been declared or initialized.
echo “String “string1″ is not null.”
echo “String “string1″ is null.”
fi # Wrong result.
# Shows $string1 as not null, although it was not initialized.

Continue reading “Testing whether a string is null.”

Strace – trace system calls and signals.

Strace is a useful diagnostic, instructional, and debugging tool. System administrators, diagnosticians and trouble-shooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them. Students, hackers and the overly-curious will find that a great deal can be learned about a system and its system calls by tracing even ordinary programs. And programmers will find that since system calls and signals are events that happen at the user/kernel interface, a close examination of this boundary is very useful for bug isolation, sanity checking and attempting to capture race conditions.
Debugging why some process isn’t connecting to a remote server can be exceedingly frustrating. DNS can fail, connect can hang, the server might send something unexpected back etc. You can use tcpdump to analyze a lot of that, and that too is a very nice tool, but a lot of the time strace will give you less chatter, simply because it will only ever return data related to the syscalls generated by “your” process. If you’re trying to figure out what one of hundreds of running processes connecting to the same database server does for example (where picking out the right connection with tcpdump is a nightmare), strace makes life a lot easier.
Continue reading “Strace – trace system calls and signals.”

Wireless disabled by hardware switch

To get back your wifi, type in a terminal:

root# rfkill list

and then you will see something like this:

0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: yes
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no

As you can see the phy0 is soft and hard blocked, so you need to unblock it:

root# rfkill unblock 0


root# rkill unblock all

and then press “Fn + F2” for a Dell laptop, and then restart your networking:

root# service network-manager restart

Install the spice-xpi on Debian wheezy or Ubuntu 12.04 LTS

To get the spice xpi working use the following steps:

1. Install the spice-client package which gives you /usr/bin/spicec
2. Extract the file from the latest Fedora (FC19) spice-xpi RPM.
3. Placed it in /usr/lib/mozilla/plugins/
4. Restart Firefox.

After restarting Firefox, you can now view the console from RHEV/OVIRT.

Write ISO to USB stick.

After inserting your USB stick, you can find out what device it is using the following command:

grep -Ff <(hwinfo --disk --short) <(hwinfo --usb --short)

Finally, once you've found your block device, write the image to it. Point 'dd' to the full path such as '/home/user/Downloads/Linux-x86_64.iso'

umount /dev/sdX
dd if=/path/to/downloaded.iso of=/dev/sdX