Diary and notebook of whatever tech problems are irritating me at the moment.

20080309

Living on the edge with Ubuntu Hardy Alpha

I was having some problems getting Wine to compile with OpenGL support in Ubuntu Gutsy on my laptop. The config script could never find the OpenGL dev libraries. I had been messing around with learning package management and other things and I broke something somewhere and couldn't find it. Instead of reinstalling Gutsy I decided to test Hardy alpha 5. This way I could report any bugs I encountered so they could get fixed before the final release and also fix the Wine problem. The laptop is a Toshiba M35X-S114, a Celeron 1.3GHz with an Intel 855GME chipset. It's Linux compatibility is better than average but not spectacular. I expected breakage with Hardy and was not disappointed. Alpha testing is living on the edge as packages are constantly being updated so system reliability can vary wildly from one update to the next. I often would start it up in the morning, install a dozen updates, a few minutes later reload the package lists and find more updates.

The biggest immediate issue I encountered was X locking up randomly with the Intel driver. It would also lock the system whenever I switched to a virtual terminal. I've encountered the latter problem before when the framebuffer drivers used by the kernel for the splash screen conflict with the X drivers. I edited the Grub menu (/boot/grub/menu.lst) and changed the "splash" entries to "nosplash" which made the system usable. It now locks up rarely during use but fairly often during logouts, shut downs, and reboots. No errors show up in the logs. I'll have to set up an SSH server on it so I can monitor it remotely the next time it hangs assuming it's just X and not the kernel itself. If it is the kernel then the SSH server will die immediately and I probably won't see any error messages. In that case the solution would be to use a serial console but the laptop doesn't have a serial port and I don't have a USB serial adapter. The advantage of a serial console is that the kernel handles it directly and "out of band" so networking issues don't affect it.

Another possibly related graphics issue is that the Gnome display properties utility crashes whenever I attempt to use it (bug #198951). I use this to correct the screen resolution when a game or Wine application aborts and doesn't reset it back after changing it. I can do a "xrandr -s 1024x768" in the terminal for now.

Another constant annoyance is the crashing of the Gnome settings daemon at every login (bug #197153). There was an update that came through and fixed it but two days later another one caused the problem to return.

There is also an issue with the battery monitor always reporting a 51% charge, hal setting the cdrom (/dev/sg0) to group root instead of cdrom and complaining it can't unmount the volume when the drive's eject button is used, and I can't disable the SCIM language control which keeps changing my keyboard language randomly (bug #199314).

Firefox v3 beta works more or less. I like the new smart bookmark which lists recently used or bookmarked links. It crashes once in a while but I haven't determined if an addon or plugin is responsible. I installed the Sun Java plugin but it can't seem to detect it and is not listed in about:plugins.

In spite of these problems the system is usable and 3D in Wine now works.

20080214

Re: Krazy Kubuntu Annoyances

Carla Schroder (tuxchick) recently posted a Kubuntu critique on LinuxPlanet titled Krazy Kubuntu Annoyances. I saw this on both Linux Today and LXer.com but I'm replying here as commenting is annoying on both sites because they strip out most html tags.

I've been setting up an advanced home office network to replace my existing haphazard mess. I haven't been posing much lately because this it taking a lot longer than planned due to changing design, learning the details of systems I only had superficial experience with, and Ubuntu bugs. Originally I didn't have a server or central authentication and was just using Samba to share access the lazy "map to guest = bad user" in smb.conf way. I have IPCop on an old box for firewall, DNS, and VPN. Internet access is via an Ethernet connected cable modem and there's five subnets for my office, household, wireless, public servers (unused), and an isolated one. The isolated network allows me to retrieve user documents from a malware infected system (Windows of course) without it being able to access the rest of my network or the Internet. This arrangement worked for a while but my primary workstation was running out of disk space and I decided to set up a proper network and server to make it easier to control access and synchronize my data remotely. I also plan on building a Debian/Ubuntu repository mirror, public wifi with a "usage agreement" access page like many places have, and a public game server for some Linux games like Tremulous. Nothing really ridiculous but a lot of work as I've found out.

So far about half of my time has been spent diagnosing various problems that often are Ubuntu Gutsy bugs. Not always server-related but it's often hard to tell where the problem is when you're in the middle of a major restructuring and there are a large number of variables. About half have been data storage problems and the other networking.

The storage issues are the result of me hitting the limit of Ubuntu's alternate installer. It's fine for basic setup with RAID or LVM but I had to make my life difficult by mixing PATA and SATA drives with RAID+LVM+LUKS/dm-crypt+pam_mount including encrypted root and swap. It didn't handle that well. I could go on for hours about the problems and other bug reports I filed but more on that later.

Networking-wise I encountered many problems including some of the ones Carla mentioned. Not all were bugs but just design decisions whose basis is hard to understand or track down. The ones we've encountered are by no means all as there are many bug reports at launchpad and on various forums about networking problems that don't occur with Knoppix or other distros. I'm using Ubuntu on most systems so some of my problems are Gnome-specific but many are not.

Network Manager seems to be the cause of a lot of complaints. First, just having the wrong ethernet chip will cause Network Manager to disconnect it for you even if it was working at boot. Or maybe it will refuse to shut down because of it. Then there are the general IPv6 issues. Of course you still have to deal with the normal industry-wide problems like not being able to resolve host names when using a laptop with multicast-DNS (Avahi) active on a Windows network using a something.local domain.

The the link local auto-config emulates Window's behavior but I'm not sure if it's good or bad. On Windows networks I always used a class C network address and if a PC ended up with a class B then I knew that it wasn't seeing the DHCP server and had auto-configured one.

I've had some issues with the host file not being set up properly which seemed to cause a major slowdown in Gnome. It took me a while to straighten it out. The odd 127.0.1.1 entry confused me but apparently it was requested because of compatibility and historical reasons.

For printer configuration I use the CUPS web interface if the graphical utilities don't suffice.

The Bluetooth support seemed to be driven by phone integration usability concerns but it was low priority according to the Gutsy blueprint. The Hardy blueprint has an entry for networkless installation fixes but I don't see anything regarding my drive setup problems, only post-installation management.

20080120

Disabling hibernate and suspend buttons

On systems with broken hibernate and suspend its a good idea to disable the option in Gnome and KDE to prevent inadvertent usage and potential lock-ups.

In Gnome use the gconf-editor. On systems using sudo to prevent direct root login launch it by "gksu gconf-editor". Browse the configuration tree to:
/apps/gnome-power-manager/general
Uncheck "can_hibernate" and "can_suspend". Right-click them and select "Set as Mandatory". Users will probably have to relogin before it takes effect.

In KDE, create a file:
/usr/share/kubuntu-default-settings/kde-profile/default/share/config/power-managerrc
In this file add:
disableSuspend=1
disableHibernate=1

20080101

Find tricks

These are some find examples with moderately complicated regular expressions that I've used for administration tasks. Note that regular expressions used by find, grep, and other programs have some variants with both the old "basic" form and the newer "extended" forms. Find defaults to the extended version based emacs but some of it's tests like -name use "shell patterns" instead (see the sh man page). In the regex man page the "(!)" identifies some of the syntax and behaviour that may not be compatible with other regular expression implementations.

The first example cleans out the Unreal Tournament 2004 cache from the home folders of all users. The purpose of cleaning out the cache is that every time the client connects to a server that is using a map, vehicle, or other add-on that it doesn't already have locally it downloads it to the cache. The cache on a system of an avid on-line gamer will easily exceed many gigabytes and can run their home directory out of space on smaller drives. On some distributions, it is impossible to log in if there is no home space available.

find /home -regex '.*/\.ut2004\(/Cache\|/.*/Cache\)' -exec rm -rf {} \;

Breakdown:

. = metacharacter implying any single character

* = any quantity of the previous character (in this case any quantity of any character because of the "." metacharacter)

/ = detect the slash to set a reference to a directory when combined with the next part.

\.ut2004 = the backslash escapes "." so that it is treated as a period and not a metacharacter. Combined with the previous ".*/" it limits the results to hidden /.ut2004 and not /..ut2004, /xut2004, or any other directory.

\(...\|...\) = This sets up a pair of branches with alternation as indicated by the vertical bar. The parenthesis define the range of expressions that make up each branch. The vertical bar is escaped to keep the shell from thinking it's a pipe and the parenthesis are escaped to indicate they are not being searched for.

\(/Cache\|/.*/Cache\) = The combined alteration limits results to .ut2004/Cache and any other items named Cache inside the .ut2004 directory. The parenthesis are important - without them find will return /.ut2004/Cache and anything anywhere with a subdirectory named Cache (like in .mozilla).

The entire regular expression is protected by single quotes so find knows they belong together. You could also limit the results to directories by adding the "-type d" test.

-exec rm -rf {} \; = This tells find that for every item it returns it is to execute rm with the parameters -rf (to delete directory trees) followed by the path with which will dynamically replace the {}. The command line is terminated by an escaped semicolon.

Here are some other find examples I've found useful.

Find any user's Mozilla/Firefox cache:
find /home -regex '.*/\.mozilla/.*/Cache'

Find any user's hidden trash directory:
find /home -regex '.*/home/[^/]*/\.Trash'

When installing updates to applications in Wine you will occasionally encounter duplicate file and directory name problems, sort of a reverse name collision. It can occur because Linux names are case sensitive but Windows is not. This means it is possible to have two files, "readme.txt" and README.TXT" in the same Linux directory but not in a Windows one. If an application update is in the form of a executable or self-extracting archive, Wine will resolve capitalization differences and ensure that a replacement file from an update that has a upper-case name will correctly overwrite a target file with a lower-case name. But if the update is from a zip or other archive and contains names with different case, then you just can't extract them and copy them on top of the installed application's directories as duplicates will result. In order to work around this you either have to install a Windows archive utility like 7-Zip and use it to extract the files and take advantage of Wine's name resolution function, or manually change the names to match. Since Windows applications generally don't care about file or directory name case, another option is to rename everything to lower case. You can do this by combining the find command with the rename command:
find <directory or file name> -depth -execdir rename 'y/A-Z/a-z/' {} \;

By default, find has some optimizations that will speed up searches in large directory trees. One of these is to skip checking subdirectories by assuming that two less exist than the total becasue of the "." and ".." entries. This will cause find to miss directories on file systems that do not have hard links for these like CD-ROM and vfat. To prevent this from occurring, use the -noleaf option.

20071226

Resetting a terminal

Sometimes while troubleshooting a system I end up with scrambled terminal settings resulting in odd colours or graphics characters instead of text. This usually happens when I accidentally send binary data to the stdout and the terminal emulator (getty in Ubuntu) detects an escape code and switches modes. To fix it, enter "setterm -reset". This sends a reset character string through the terminal which usually sets it back to the default settings.

20071224

Root ending up in the wrong home with sudo

On Ubuntu and some other distributions direct login to root is disabled and sudo has to be used. The idea is to discourage running as root as this is bad for security (just like running as administrator in Windows). It is possible to get to a root shell but there is a right way and wrong way to do it. The wrong way doesn't change the environment variables like $HOME which will cause programs like Midnight Commander to save their config files to the originating user's home directory but with root ownership.

This is the WRONG way which leaves $HOME still set to the originating user's home:

sudo -s (or) sudo /bin/sh

This is the correct way which sets $HOME to /root:

sudo su (or) sudo su - (or) sudo -i

To experiment, enter the above commands followed by "echo $HOME". Enter "exit" to return to the original shell.

20071223

Compiz on multi-head setup = multi-problems

I rebuilt up my primary desktop system with Gutsy and tried out Compiz with my non-Xinerama multi-head setup. It didn't handle it well and after a few hours of trying to fix it I switched back to plain-old Gnome. I reported my findings as bug #178341. There were many bug reports about most of the problems I experienced but it seemed like there was some fundamental problem that was causing them.

First, no window borders (ie, decorations) were present on windows in the second head. I had to reload the decorator with "gtk-window-decorator --replace" to get them to show up. Windows can be manipulated using mouse + keyboard but it's annoying.

Second, the Quit button on the second head would show an invisible power/logout window. I could cancel it with Esc or log out with Alt-L. Other people who have encountered this one mistakenly thought it was a desktop freeze and killed X.

Third, the long default menu pop-up delay was really irritating but it only was present on the primary head, not the secondary. Setting gtk-menu-popup-delay=0 in ~/.gtkrc.mine didn't have any effect on either one. The excessive delay makes the system seem slow like Vista. Regardless, it should be the same on both heads and this leads me to believe that the config files are not being read properly on the second head.

Fourth, the workspace switcher applet didn't function correctly. If I changed the number of workspaces on the second head it would affect only the primary head. It didn't get along with Compiz either but it's a known limitation. Minor issue but further proof of something being broken within.

Other than some Nautilus errors in .xsession-errors there was nothing useful in the logs.

I may have to wait until Hardy for Compiz to be usable on my system. It wasn't an easy decision for the Ubuntu dev team to include Compiz because of the known issues with drivers and stability but it will mean more stability for the Hardy LTS (5-year support) version. The problems I encountered are hopefully specific to multi-head setups as they are not typical for most systems; it would create an unfavourable impression on new users.

About Me

Omnifarious Implementer = I do just about everything. With my usual occupations this means anything an electrical engineer does not feel like doing including PCB design, electronic troubleshooting and repair, part sourcing, inventory control, enclosure machining, label design, PC support, network administration, plant maintenance, janitorial, etc. Non-occupational includes residential plumbing, heating, electrical, farming, automotive and small engine repair. There is plenty more but you get the idea.