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.

20071124

My Linux-Aspected Black Friday Assault

I was thinking of ignoring the Black Friday sales this year as it's annoying to have to get up really early, stand in line freezing for hours, fight my way into the store along with a few hundred other people, get 1/10th of what I wanted, then spend another hour in the check-out line. But then I spent Wednesday night stuck at my office because a large snowstorm had blocked all the roads and they weren't be plowed out until the following afternoon. So to pass the time I started checking out the leaked BF advertisements to see what was available and I decided to try my luck at the Staples store in Alpena. Although they are known as an office supply store they have a lot of computer tech on sale, especially on Black Friday. I was interested mostly in Linux-compatible cameras and printers which meant skipping the Canon and newer Epson models. They carry Lexmark but none were on sale, not that it mattered as I wouldn't take one even if they were free. The best deals are offered during the "Early Bird" sale which was held 6:00 to 10:00 although other good deals were available throughout the weekend.

The next day, after Thanksgiving dinner, I head for bed early. I wake up at 4:00 and it's probably around 15°F (-9°C) outside. I put on long underwear, snow pants, a sweater, two coats, heavy boots, and a stocking cap then get in the car. I live out in the country and normally the roads are vacant this early but this time there were several cars in front of me, all heading into the town. I get to the store at 5:15 and there are many cars in the parking lot and about 50 people in line already. I suspect that many of them are holding places for others sitting in vehicles keeping warm so I expected the number to double when the store opened at 6:00. The manager came out some time later and handed out sales flyers and a store map. I found out they were not using item reservation tickets like some stores do so that meant that it was going to be a free-for-all assault. At 5:55 the crowd increase wasn't that much and some store staff blocked some line-cutters and sent them down to the end. I'm not sure where the end was at actually - the line was way around the corner. I'm guessing 200 or so people based on crowd later in the store. I check my list and map and wait impatiently - I can feel the excitement in the air. But when the doors finally opened it was more of an orderly surge instead of a stampede.

I took a chance and grabbed a cart. Grabbing a cart is not a small decision when it comes to BF shopping. It costs time because it is difficult to maneuver in a crowded store which potentially means losing out on popular items with limited inventory. But printers are too big to carry and I wasn't sure what else I would grab. I headed over to the likely area on the simple map and found it was a little inaccurate. The items were not on the shelf but on tables in the aisle towards the rear of the section which now jammed full of shoppers. I was worried that the minute or two of disorientation would cost me the HP camera I was after but I managed to get one. Conveniently they had bundled it with a 1GD SD card and 4x6in HP photo paper. This was about 6:03 and items were going fast so I then started grabbing anything even remotely desirable. My normal BF tactics are based on credit card power. I buy everything I can get because comparing items takes too much time. I then take them home for evaluation, offer rejects to friends and family, and return the leftovers. This has worked well in the past and it worked very well this time. I think my success was helped by three factors - the cold limited the competition, there was a large amount of inventory on hand, and I wasn't after the high-demand items. About a third of the shoppers were lined up for some laptops and GPS units on sale towards the rear of the store. I didn't need a laptop and decided to pass on the TomTom ONE 3rd Edition GPS and concentrated on the printers and other targets of opportunity. After I obtained everything else I could think of I did wander back to the now vacant rear section to see what was left. The TomTom was sold out so I grabbed one of the last Navigon 2100T. I could barely keep stuff from falling off the cart when I got in the check-out line at 6:15. I finally got out of the store around 7:00, loaded my car and headed to my office for assemsent of the haul.

First, I double-checked everything on the receipts, rebate forms, and my shopping list. A last-minute item I grabbed for the camera was a 2GB CF card that someone had discarded on a shelf next to where I was waiting in line. But the camera need SD so I returned it for a 2GB SD card for the same price. I decided a 2x1GB PC2-5300 CL5 SODIMM kit for a laptop wasn't much of a bargain at $47.98 and I could get it later (and with lower latency) when I actually had a laptop that could use it. The Navigon didn't make the cut either. Reviews gave it only passing marks against the TomTom and other models and it didn't have a USB connection. At $99.99 it was cheaper than the TomTom ($124.99) but I didn't have a strong need for it anyways. It didn't help that it used Windows CE 5 while the TomTom used Linux and had a SDK available. I did go back later and pick up a SanDisk “Ultra” SD card to see if the camera would save faster than with the economy card but it didn't seem to improve much. The camera doesn't have an optical viewfinder but I got used to it quickly. Interestingly, the camera case has a magnet to hold the flap closed instead of Velcro.

Here's the score after the initial returns:

Brand Model Description Base $ Tax $ Rebate $ Sub-total Normal $ Linux?
Brother MFC-440CN Inkjet Printer AiO with Ethernet $79.98 $4.80 $20.00 $64.78 $135-145 Mostly
Brother PT-1010 Portable labeler $19.99 $1.20 $10.00 $11.19 $43-45 N/A
Executive EPS-1200X 12-Sheet crosscut shredder $49.99 $3.00 $30.00 $22.99 $80 N/A
HP C5180 Inkjet Printer AiO with Ethernet $149.98 $9.00 $50.00 $108.98 $135-145 Perfectly
HP M737 8MP digital camera $129.98 $7.80 $30.00 $107.78 $147-162 Yes, PTP
HP Q7906A 100sht 4x6in glossy photo paper $12.99 $0.78
$13.77 $11-17 N/A
Logitech QuickCam Orbit MP 1.3MP Webcam with pan/tilt $104.99 $6.30 $85.00 $26.29 $78-100 Yes
PNY P-SD1G-RF3 1GB SD Flash $14.98 $0.90
$15.88 $14-17 Yes
Samsung CLP-300 Color laser printer $249.98 $15.00 $150.00 $114.98 $214-246 Mostly
Samsung ML-2510 B&W laser printer (w/$20 gift card) $119.99 $7.20 $70.00 $57.19 $101-114 Perfectly
SanDisk SDCZ6-4096-A10RB Cruzer Micro 4GB USB Flash drive $27.98 $1.68 $10.00 $19.66 $55-70 Yes
SanDisk SDSDB-2048-A11 2GB SD Card $14.98 $0.90
$15.88 $20-35 Yes
SanDisk SDSDH-2048-901 2GB SD Card $17.98 $1.08
$19.06 $47-53 Yes
SanDisk SDSDQ-2048-A11MK 2GB microSD kit w/adapters $17.98 $1.08
$19.06 $35-60 Yes
Staples 554638 500 sheets 8.5x11in 24lb paper $4.98 $0.30
$5.28 $7.49 N/A
Staples 648177 60sht 4x6in glossy photo paper $6.98 $0.42 $6.98 $0.42 $6.98 N/A
Staples 674535 600 sheets 8.5x11in 20lb paper $4.99 $0.30
$5.29 $5.99 N/A
Western Digital WD4000JSRTL 400GB SATA 300, 7200RPM $89.98 $5.40 $30.00 $65.38 $130 Yes


Total: $1,118.70 $67.12 $491.98 $693.84

It will be a while before I get through testing all this. Then of course there are all the rebates to submit. Thankfully Staples has on-line submission for most of their rebates.

20071121

FontPage on Wine

I was trying to get capella reader to operate on Wine but it couldn't find it's custom music notation fonts. Definitely a compatibility bug there but I also encountered a problem with Wine 0.9.49 not finding fonts in the windows/fonts directory. To get them to show up at all I had to stick them in ~/.fonts and relogin. To verify that they were registered correctly by Wine I used an old Windows freeware program, FontPage. It worked perfectly. The only issues were that it required the Visual Basic 6 runtime and threed32.ocx wouldn't load. The VB6 runtime will not install but if you run it with "vbrun60sp6.exe /C" it will extract the dlls and you can copy them to the windows/system32 folder (don't overwrite anything). The threed32.ocx problem I solved by looking at the Wine messages when I tried to start FontPage from a terminal. It needs mfc40.dll to be installed in windows/system32.

SMB browsing in Xubuntu/Thunar

The biggest usability problem in Xubuntu is that the file manager, Thunar, doesn't have integrated SMB browsing for Windows networks. This solution works but doesn't scale well beyond a single user because of the network directory location and permissions. I came up with a configuration that works better by locating it in each user's home directory instead. Optionally it can be auto-configured for new users when they are added. First you need to create a script to mount the network directory with fusesmb for the current user:

#! /bin/sh
fusesmb $HOME/network


Save to /usr/local/bin/auto-fusesmb, owned by root, and set execute permissions for everyone. Then create a xdg menu file to launch it:

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=fusesmb
Comment=SMB network browsing
Exec=auto-fusesmb
StartupNotify=false
Terminal=false
Hidden=false


Save this to ~/.config/autostart/fusesmb.desktop so it will lauch the script at login. This will show up in the Applications > Settings > Autostarted Applications dialog. Obviously you can create this using the dialog but now you know where it is stored. Then create the directory "network" in the user's home folder. Only the user needs any access permissions to it.

To create this setup automatically for newly added users, copy the .config/autostart/fusesmb.desktop file and network directory to /etc/skel and set the permissions the same as for the existing files (.profile, etc.) but change the owner and group for everything to root. When a new user is added, this skeleton directory will be the initial default so the ~/network directory will exist and the fusesmb.desktop file will cause auto-fusesmb to mount it whenever the user logs in.

blog start

It's created. Now I have to remember to post regularly without ranting.

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.