Solutions Log by Dan Reiland

21Mar/112

Unable to Browse Windows Network Shares in Ubuntu

Issue:
When attempting to browse Windows network shares from Gnome Nautilus, the window will become unresponsive and the operation will eventually timeout.

Affects:

  • Ubuntu 10.04 LTS
  • Ubuntu 10.10

Cause:
wins is not enabled as a host resolution mechanism in /etc/nsswitch.conf; winbind is not installed.

Resolution:
Open /etc/nsswitch.conf in your favorite editor and ensure the hosts line matches the precise order below (you are adding wins).

 hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4

Install winbind

sudo apt-get install winbind

References:
http://ubuntuforums.org/showthread.php?t=1169149

21Mar/110

Empathy Reports Network Error When Connecting to MSN

Issue:
telepathy-butterfly

Affects:

  • Ubuntu 10.04 LTS
  • Ubuntu 10.10

Cause:
A bug is present in the telepathy-butterfly package.

Resolution:
An update is pending approval and will be available for both Ubuntu 10.04 and 10.10. Informal patches are available, however, I prefer to stick to the mainline distribution as much as possible to avoid introducing tightly coupled dependencies.

Remove telepathy-butterfly and its dependencies.

sudo killall telepathy-butterfly
sudo dpkg --purge telepathy-butterfly
sudo apt-get install telepathy-haze

Reconfigure your MSN connections and attempt to activate them. You should experience no additional issues.

References:
https://bugs.launchpad.net/ubuntu/+source/telepathy-butterfly/+bug/513346

Tagged as: No Comments
28Feb/110

Updating rubygems on Ubuntu

If you have ever tried to update rubygems on a base Ubuntu 10.04 or 10.10 install you will have been greeted with:

# gem update --system
ERROR:  While executing gem ... (RuntimeError)
    gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.

You can work around this limitation:

# gem install rubygems-update
# /var/lib/gems/1.8/bin/update_rubygems

You will now be able to update rubygems using the standard set of commands.

Reference:
http://www.tinymission.com/blog/blogengine.web/post/2010/11/03/Updating-to-Rails-30-on-Ubuntu-1004.aspx

Tagged as: No Comments
13Jan/110

rsyslog consumes excessive memory when forwarding logs with compression

Issue:
rsyslog consumed growing amounts of memory when forwarding over TCP with compression enabled.

*.* @@(z1)hostname.domain.tld

Cause:
The compression flag causes the rsyslog process to allocate, and never release, memory. I have not determined root cause but the likely culprits are zlib or TLS (both involved when compression is enabled in this situation).

Resolution:
Do not use compression when forwarding with rsyslog. With the compression flag dropped, I was unable to reproduce the errant behavior.

*.* @@hostname.domain.tld

References:
http://www.rsyslog.com/doc/rsyslog_conf_actions.html

26Oct/100

/etc/hosts entries not being used for non-root users

Issue:
Non-root users are unable to resolve addresses for entries in /etc/hosts.

user@gentoo ~ $ ping localhost
ping: unknown host localhost

Troubleshooting:

Potential causes:

  • Malformed content or improper permissions on /etc/hosts
  • Malformed content or improper permissions on /etc/host.conf
  • Malformed content or improper permissions on /etc/nsswitch.conf

Diagnostics:
One may consider nslookup or dig to be suitable diagnostic tools given the use case, however, they are applicable only when troubleshooting DNS server name resolution issues; these tools do not bother to look at /etc/hosts. strace is suitable given the diagnostic task at hand.

user@gentoo ~ $ strace -e open ping localhost
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libc.so.6", O_RDONLY)        = 3
open("/etc/resolv.conf", O_RDONLY)      = 3
open("/etc/resolv.conf", O_RDONLY)      = 3
open("/etc/nsswitch.conf", O_RDONLY)    = -1 EACCES (Permission denied)
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libnss_dns.so.2", O_RDONLY)  = 3
open("/lib/libresolv.so.2", O_RDONLY)   = 3
open("/etc/host.conf", O_RDONLY)        = 3
ping: unknown host localhost

Cause:
As reported by our strace diagnostic, our user has insufficient privileges to read /etc/nsswitch.conf resulting in the file never being utilized for name resolution. In our case, /etc/nsswitch.conf had a permission mode of 600, allowing only the owner (root in our case) read/write access.

Steps to Reproduce:
Change the mode of /etc/resolv.conf, /etc/host.conf, /etc/hosts to 600.

Resolution:
Change the mode of /etc/nsswitch.conf to 644.

user@gentoo ~ $ sudo chomod 644 /etc/nsswitch.conf
user@gentoo ~ $ strace -e open ping localhost
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libc.so.6", O_RDONLY)        = 3
open("/etc/resolv.conf", O_RDONLY)      = 3
open("/etc/resolv.conf", O_RDONLY)      = 3
open("/etc/nsswitch.conf", O_RDONLY)    = 3
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libnss_files.so.2", O_RDONLY) = 3
open("/etc/host.conf", O_RDONLY)        = 3
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 3
ping: icmp open socket: Operation not permitted
user@gentoo ~ $ ping -c 2 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.066 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.056 ms
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.056/0.061/0.066/0.005 ms

Note: We expect "ping: icmp open socket: Operation not permitted" -- non-root users are not allowed to open raw sockets.

Tagged as: No Comments
9Feb/100

xinetd per_source limit issues

Issue:
Users note availability issues when accessing services backed by xinetd (subversion, rsync, etc.)

Identification:
Syslog on the affected server will present multiple lines containing daemon per_source_limit for 0.0.0.0.

Cause:
You have exceeded per_source_limit defaults imposed by your xinetd configuration. Many distributions include per_source limits that may not be suitable for your use case. Evaluate your needs carefully.

Resolution:
Modify the default setting for per_source in /etc/xinetd.conf or modify the service specific configuration (recommended) under /etc/xinet.d. per_source limits may be set as follows:

per_source = 10

per_source may be set to an integer or UNLIMITED (the number represents the number of connections allowed per host). A sensible fixed value is always better than UNLIMITED.

Reference: xinetd.conf(5)

Tagged as: No Comments
4Dec/090

Replace Pipes with Tabs in a Delimited File

Issue:
It is often necessary to replace delimiters in a file with a form the receiving party expects. sed is my favorite method of meeting the need.

Solution:
Replace double pipes with tabs

sed 's/||/           /g' file.in > file.out

Note: If you find the tab key simply does not work, try CTRL+V+I from your terminal.
Reference: http://forums.devshed.com/unix-help-35/replacing-tabs-with-spaces-372623.html

Caveats:
Special consideration (and a regex) will be required for data where delimiters are present in the data itself. Consider your use case and apply appropriately.

7Oct/090

Create a pidof command to find PID numbers easily

Most UNIX environments include the pidof command which is put to use whenever one needs to quickly determine, by name, the pid of a running program. Apple's Mac OS X lacks the pidof command, however, one may approximate its function with the following shell script:

#!/bin/sh
ps axc|awk "{if (\$5==\"$1\") print \$1}";

Save the script as /bin/pidof and be sure to set its executable bit:

chmod a+x /bin/pidof
Tagged as: , No Comments
6Oct/090

Strip empty (null) lines from a file

sed meets the need; the recipe follows:

sed '/^$/d' filename
27Aug/090

Disable disk checking during boot on Linux systems

Issue:
Linux (appropriately) checks filesystems after a number of boot cycles.

Cause:
This is by design. By default, ext[2,3,4] filesystems are automatically checked every 34 mounts or 180 days (whichever comes first).

Resolution:
In some cases (ephemeral machine instances in a cloud) this behavior is undesirable. It may be tuned with the following:

To disable it use the following at the terminal:

tune2fs -c 0 -i 0 /dev/hdXY

Set it to check after 30 system boots

tune2fs -c 30 -i 0 /dev/hdXY

Also ensure that your /etc/fstab file reflects a similar setting. The sixth column should contain a 0 (never check) rather than a 1 (check at boot).