Tag Archives: Linux

Watching Log Files on Linux/Unix

Most people I come across use tail -f fileName to watch files. The drawback, however, is that for a closer inspection of something I had just seen, I have to abort this and change to some file viewer (where I first need to find again what I want to check). So why not use a single program that can do both things? less fileName does this for you. What many seem to be unaware of, is that less has a built-in tail mode that can be activated with Shift-F and left with Control-C. Once back in normal view mode again, it is very easy to scroll up a few lines and inspect the interesting part of the file. And once finished, you can just press Shift-F again and are back to tail mode.

Upgrade MQTT Broker Mosquitto on Raspberry Pi: “The following packages have been kept back”

While exploring MQTT I had installed the Mosquitto message broker on my Raspberry Pi. However, the version that is in the Debian Wheezy repository is, as of this writing, really old (v0.15). So an upgrade was in order and fortunately the guys from Mosquitto have set up a Debian repo of their own and a description how to use it.

But on my system I then got the following message:
xxx@yyy:/etc/apt/sources.list.d# sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  mosquitto mosquitto-clients
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

The general recommendation to solve this is run
sudo apt-get dist-upgradeI did not want to do this for various reasons. So the approach I took instead, was to simply remove the old version with sudo apt-get remove mosquitto mosquitto-clients and re-install it, then taking the new version from the Mosquitto repo sudo apt-get install mosquitto mosquitto-clientswhich worked nicely for me.

Oracle DB 11g R2 on 32 bit Linux: DBCA does not start

There is an open bug (8930861) with Oracle 11g R2 that causes the Database Configuration Assistent (DBCA) to not start on 32 bit Linux. If you see somthing like

An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0xa2bbd36e, pid=19555, tid=3085252272
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0_17-b02 mixed mode)
# Problematic frame:
+# C [libnnz11.so+0x3c36e]+

you have probably hit it. (The above message is copied since I have meanwhile deleted the 32 bit VM. In my case the address was slightly different but the rest of the message was obviously coming from the same underlying reason.) The current workaround is to install on a 64 bit Linux. Given that probably no-one is running a 32 bit version in production these days, this seems acceptable. Also, chances are that this will never be fixed because of the aforementioned lack of 32 bit versions running in production.

Oracle DB does not start

Sometimes people wonder why Oracle DB (both 10g and 11g) will not start after installation on Linux/Unix. In many cases the simple reason is the content of /etc/oratab. For each database it contains a line in the format $ORACLE_SID:$ORACLE_HOME:START_DB_FLAG:The last column is set to “N” by default. Just change it to “Y” and run $ORACLE_HOME/bin/dbstart again. Your database should come up now.

Linux Network Mounts for a Laptop

When you are running Linux (or any other Unix-like OS) on a mobile computer, you may have a bit of a problem with mounting shares from a server. On a normal PC with a fixed connection to the server, you would simply add the appropriate entries to /etc/fstab and have them mounted automatically during startup. But since I am not “always on”, this was not an option. So I added the “noauto” option to the entries in /etc/fstab, which effectively means that they get ignored during system startup. Of course I could later call mount /my/mountpoint manually for each entry. But this is cumbersome. So I went and wrote a small script (download here). For security reasons the extension of the script is set to .sh.txt instead of .sh, so you will need to rename it before execution.

There are a few conditions for the script to work:

  • Effectively the script will call “mount /my/mountpoint” for each relevant entry in /etc/fstab. All configuration details for the actual mount operation need to be provided in /etc/fstab. So before running the script, make sure those manual calls go through without problems.
  • For CIFS mounts the credentials should be provided using the “credentials” option from mount.cifs (see respective man page for details). Those can then be protected properly. And should there be several people using the system, they can maintain their passwords by themselves.
  • Currently there is connectivity check to the server(s). So you will get delays/errors when calling the script without a proper connection.

The script will detect whether a particular mount point is in use and skip the respective entry for mounting. The same goes for umount when the mount point is not used.

For CIFS mounts you will most likely need to call the script with sudo. At least on Fedora 12 I could not get mount.cifs to work for normal users, event with the SETUID bit set.

Mount Windows Share with Fedora 12

The file system type for the mount command has been changed from smbfs to cifs. So using “-t smbfs” will not work any more. Instead you need to enter something like this:

mount -t cifs -o username=user[,uid=500,gid=500] //machine/share[/path] /mountpoint

There seems to be a documentation bug in the man pages, because they still mention smbfs.