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

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.

20071212

Nautilus bookmarks and Places problems

I rely rather heavily on the bookmarks/places sidebar in Nautilus (Gnome's file manager). I have a very large archive of freeware, evaluation software, reference material, and documents files sorted by OS and application type, category, or customer project number. It takes a lot of clicking to drill down into and the bookmarks allow me to jump quickly to the directories I use the most. I also have bookmarks to SMB shares on various subnets and across a VPN. Its worked rather well but I noticed that I couldn't sort the list the way I wanted. Normally you can just click-and-drag a bookmark and drop it where you want. But when I tried it didn't work correctly and ignored the action or replaced it with a different bookmark like it lost track of which one I was moving. I decided to resolve the problem by deleting several bookmarks I thought it could be having trouble with like the SMB shares. But it still didn't work. After some searching I figured out that the bookmarks are stored in the hidden text file ~/.gtk-bookmarks which is easy to edit manually. I found several bookmarks that Nautilus was not displaying which pointed to old targets that no longer existed. I deleted them and killed and restarted Nautilus and it seems happy now. It might be a design flaw or a bug. I'll have to investigate more after I upgrade to Gutsy.

20071210

Keyboard LED flashing panic

I was in the middle of replying to an email from my home-made desktop PC when it suddenly stopped responding to anything. The only activity was the Caps Lock and Scroll Lock LEDs flashing at about a 1 second (1Hz) interval. At first I thought a PS/2 connector had come loose on my D-Link DKVM-4 KVM or on the system but the USB mouse was also not responsive. After some Google searching with my laptop I figured out that the kernel had probably panicked and the LED activity was caused by the panic_blink function which is basically an idiot light. According to what I read the flashing can also involve the Num Lock LED but mine may have been off because the Num Lock was active at the time of the panic. While there is no information conveyed by any of them it does let you know that something serious happened, not just a loose connector or X hanging. There was a kernel patch submitted by Andrew Rodland back in 2002 to blink in Morse code but I don't think it was ever included in the main tree. In my experience, once a Linux system has been stable for a while a panic usually indicates a hardware problem. After a few hours of troubleshooting I determined that my 1GB PC-3200 DIMM had failed, probably because it wasn't seated in the socket properly. I'm surprised it lasted as long as it did.

20071203

Tedious Engineering

Spent last week doing more design work on a company's latest project for one of their automotive customers. Mostly working with AutoSketch 7 for creating basic 2D machining drawings for enclosures, Adobe Illustrator 10 for creating overlay labels for the enclosures, and Altium Designer 2004 (aka DXP 2004) for PCB design. I don't really like any of them but it's what the company uses.

AS7 is primitive but adequate for simple 2D drawings. It is useless for graphical design of labels because it's font handling is inadequate (although v9 may be better) and label manufacturers can't import it's SKF files. I usually export a DXF and import it into IA10 but its tricky and there are usually odd round-off errors. I suspect AS7's DXF format is the problem because it will often export DXFs it can't later import. Qcad can't read it at all, SagCAD shows some of the objects but endpoints of many lines are set to the sheet origin, but the VariCAD viewer shows most of it. I would consider buying the full version of VariCAD but I would have to be able to convert drawings to something AS7 likes which is unlikely. AS7 can be installed in Wine but there is a problem with the format of numbers in dimensions which may be related to bug #4348. I'll investigate more later. In Vista it functions but is unstable and often crashes during panning or messing with printer settings.

IA10 is annoying to use if you are from a drafting background. I'm used to drawing everything on a grid with precise absolute or relative locations of everything and IA10 is difficult to use that way. But the label graphics and cutouts need to match the enclosure cutouts so precision is required. It functions in Vista but I haven't tried it in Wine yet. The AppDB reports indicate mediocre results.

Altium DXP looks a lot nicer in a brochure than reality. It is a perfect example of a product from an acquisition-focused developer in that lots of new broken toys are merged in with every release. It works as "exceptionally" on Vista as it did with XP. It still throws exceptions all over the place but they only occur half as often on Vista. This is not from Vista's improvements but because Vista is half as fast as XP and it takes twice as long to encounter one so effectively the error density has gone down (along with productivity). The new feature Vista provides is that doing anything with the output job BOM report generator (and reportedly print previews) will kill it every time. I have to run it on XP in VMware. I've been meaning to try it on Wine but I need to free up some space and want upgrade to Gutsy first. According to the AppDB reports version 6 works partially. The company will probably upgrade to the new version at some point in order to take advantage of new features and bugs.

While this part-time contract work pays the bills I find it generally boring. Having to do network administration on Windows systems doesn't improve it any. At least it's a small company that doesn't require centralized e-mail and document sharing so I can continue to ignore the SharePoint and Exchange services. There are a few benefits in that I occasionally get obsolete office computer junk to play with and I have learned about a few useful tools. One in particular is Perforce, a cross-platform version control system. I don't know what benefits it brings to management of software development as compared to other solutions but it is rather useful for keeping track of my design-related files.

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.