Monday, March 14, 2011

Stopping Runaway Processes: Magic SysRq Keys

Pre-sequitur:
Consider the following Wikipedia entry that I subsequently found after doing all this work: 
 http://en.wikipedia.org/wiki/Magic_SysRq_key
 But it doesn't invalidate my findings:

     w f e v b (in that order) are the more useful.
And many of the claimed functions simply do not work, as discussed below.
Always willing to be corrected...
======================================================================== 
I found out how to get the kernel's attention when it is in some kind of process panic or runaway process. Before this, I just pulled the plug... :-( 
So this is much more elegant: 
        Alt+Fn+SysRq+<command key>
where +<command key> is one or another of a long list of characters, discussed below. It seems that  
        w f e v b 
(in that order) are the more useful. 
----------------------------------------------------------------------- 
When I leave the machine idle for a while (going to bed, going to lunch) I often come back to find it frozen with mad disk thrashing going on. Sometimes I get its attention back with a mouse move or hitting the Esc key, but more often I just have to pull the plug.
What I find from /var/log/messages is that hald is doing a lot of stuff and won't let go of the system.
Today I noticed that the log ends with entries like:
Mar 12 14:07:42 P1630 kernel: [11391.748962] Out of memory: Kill process
1378 (hald) score 598 or sacrifice child
Mar 12 14:07:42 P1630 kernel: [11391.748968] Killed process 1504
(hald-runner) total-vm:56372kB, anon-rss:26496kB, file-rss:632kB
Googling tells me this is the response of the out of memory killer (oom_killer), so I"ve read a lot about how it calculates the score by which to decide which process to kill to free up memory, and the winner (or actually, loser) in each case is hald.
Pulling the plug is actually a PITA, Searching around (thanks DenverD) gave me a much more elegant solution:
        /usr/src/linux/Documentation/sysrq.txt
This  bears careful reading and even more careful experimentation, which I here report:
The Fujitsu P1630 keyboard has a Function (Fn) key which is used to invoke functions on other keys that are indicated by a box around the function name, such as SysRq. In this case the following are the results of various key combinations, where a comma implies a wait, a + implies pressing simultaneously, and <command key> implies any of the letters of the alphabet cited in the sysrq.txt source above:

Alt, Fn+SysRq+<command key> just brings up the screen shot module 
 
Alt+Fn+SysRq+<command key> does nothing for <command key> = d g h.
 Instead, dmesg shows a help screen:
 [13321.912458] SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-tasks(I) thaw-filesystems(J) saK
  show-backtrace-all-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) powerOff show-registers(P) show-all-timers(Q) unRaw Sync
 show-task-states(T) Unmount force-fb(V) show-blocked-tasks(W) dump-ftrace-buffer(Z)  
 
The following are the results for the remaining <command key> combinations:
 
Alt+Fn+SysRq+b  Will immediately reboot the system without syncing 
                or unmounting your disks.  
                This is clearly the most dangerous and exciting!
 
Alt+Fn+SysRq+e     Send a SIGTERM to all processes, except for init. 
                   Dumps you to the terminal prompt. 
                   This is almost as much fun as <b>...
 
Alt+Fn+SysRq+f     Calls oom_kill to kill a memory hog process. This is
                   probably the most commonly useful one, e.g.:
 [13385.402701] [11278]     0 11278     8026     2004   0       0             0 packagekitd
 [13385.402706] Out of memory: Kill process 3421 (firefox) score 122 or sacrifice child
 [13385.402716] Killed process 3631 (plugin-containe) total-vm:137648kB, anon-rss:840kB, file-rss:2436kB

Alt+Fn+SysRq+    i j k l m o all change the log levels:
        Alt+Fn+SysRq+i
        j[13859.996645] SysRq : Changing Loglevel [13859.996673] Loglevel set to 5 
        Alt+Fn+SysRq+j
          [14057.594808] SysRq : Changing Loglevel
         [14057.594837] Loglevel set to 1
        Alt+Fn+SysRq+k 
         [14158.143866] SysRq : Changing Loglevel
         [14158.143894] Loglevel set to 2
        Alt+Fn+SysRq+l 
         [14158.143866] SysRq : Changing Loglevel
         [14158.143894] Loglevel set to 3
        Alt+Fn+SysRq+m
          [14240.847738] SysRq : Changing Loglevel
         [14240.847767] Loglevel set to 0 
        Alt+Fn+SysRq+o
         [14399.663636] SysRq : Changing Loglevel
         [14399.663660] Loglevel set to 6
 
Alt+Fn+SysRq+n        This adjusts the niceness of the tasks.
         [14327.222095] SysRq : Nice All RT Tasks
 
Alt+Fn+SysRq+p  Will dump the current registers and flags 
                to your console to appear in dmesg).
 
Alt+Fn+SysRq+q  Will dump to dmesg per CPU lists of all 
                armed hrtimers (but NOT regular timer_list 
                timers) and detailed information about all
                clockevent devices.
 
Alt+Fn+SysRq+r  Turns off keyboard raw mode and sets it to XLATE.
        [14773.473596] SysRq : Keyboard mode set to system default
 
Alt+Fn+SysRq+s  Will attempt to sync all mounted filesystems.
        [14816.857775] SysRq : Emergency Sync
        [14816.860901] Emergency Sync complete
 
Alt+Fn+SysRq+t  Will dump a list of current tasks and their information to dmesg
 
Alt+Fn+SysRq+u  Will attempt to remount all mounted filesystems read-only
 
Alt+Fn+SysRq+v  Forcefully restores framebuffer console (same as b)
 
Alt+Fn+SysRq+w  Dumps tasks that are in uninterruptable (blocked) state.

So more experimentation later, but it seems like w f e v b (in that order) are the more useful.

How to Activate Macro Recording in LibreOffice 3.3.1

Tools > Macros > Record does not exist in LibreOffice 3.3.1 on first installation. But you can add it with
    http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=28782&p=131108&hilit=record#p131108

     menu -- > Tools -->Customize brings up a new window. Select the Menus tab.

On that tabpage there is a dropdown box where you can select the part of the menu where you want insert the new item. It starts with File selected. Scroll down to Tools | Macros

Then click on the Add button.

Another window opens. In the left window Category select : BASIC
In the right-hand window Commands select : Record Macro
Click button : Add
Click : Close
Click : OK
Repeat this process for any other additions you wish, e.g., Stop Recording, Run Macro.

Now we add toolbar icons:
 
Tools > Customize > Toolbars Tab > Toolbar: Formatting > (Scroll to end of list) > Add > Category: BASIC > Commands:
    >
Record
    >
Stop Recording
    >
Run Macro
    >
LibreOffice Basic Macro Organizer
 
    >Close > OK



Easy to do but obscure and undocumented...

Thursday, March 10, 2011

Another dead black beast: bluedevil!!

Posted details to http://tinyurl.com/66wr4q7.

The Waveinput contributor bpa has taught (um, re-taught) me a valuable lesson:

+ When pushing the car back up the hill, it is  best to go one step at a time. Tedious, but in the end more effective.

In this case it was one of adding one supporting application at a time, retesting, going back, doing it again.

And we have won:

+ Bluedevil requires the obex stack in addition to bluez! But none of the documentation I've seen describes this. So I have a self-assigned task to update the README file to make this clear.

Basically, we have loaded, unloaded, rebooted, reloaded, unloaded, etc. with a host of different combinations of stuff, finally deciding to do one-by-one:

+ Nuke all associated *blue* apps

+ Reboot

+ Add one thing at a time:
     - bluedevil (and nothing else that doesn't appear as being required)
     - on failure google around
     - discover obex
     -  Add obex elements one-at-a-time, repeat.

+ Success achieved in this manner after adding obexd and obex-client.

New README file to follow.

Wednesday, March 9, 2011

openSUSE 11.4 RC2 bêtes noires: One down, more to go...

Licked Squeezebox Server issues today, am delighting in Choral Evensong and Rachmaninoff as we speak.

Details posted to http://forums.slimdevices.com/showthread.php?t=80458&page=14:
:
So the key fixes were:

+ Providing a link to bootstrap.pm in one of the directories on the $PATH

+ Correcting the owner and group of the logs to squeezeboxserver

+ Setting up the firewall to masquerade the internal 192.168.x.0/24 network.

+ Explicitly setting Custom rules on the firewall to allow ports 3483 and 9000 in TCP and UDP.

Now for some tunes...

Tuesday, March 8, 2011

openSUSE 11.4 RC2 bêtes noires

Call me a self-flagellant.

I was so pleased with the smooth upgrade to KDE 4.5.5 that I decided to just go ahead and follow the instructions to upgrade to OpenSuSE 11.4 (oS11.4). Spent several hours RTFM on zypper, set up the 11.4 repos and removed the older ones, and pushed zypper dup. About an hour later it was all done.

[Footnote: OpenSuSE is now calling itself openSUSE so I guess we can all stop following the ancient German-based capitalization scheme...]

It went well enough. oS11.4 is at Release Candidate 2 Beta with only a few days to the full release. But there are some questions, if not bugs:

+ The splash screen is a grey streaked thing with a jagged gecko in the lower right corner that looks as if the video is corrupted until you notice that the gecko in the middle of the screen is perfect. So maybe this is a Beta reservation of some sort? It goes on and brings up the plasma desktop without fault or error. And indeed, the new video is crystal clear. Very cool.

+ There is a new tool KPackageKit that seems to be trying to takeover from YaST. It wakes up and downloads a scrunch of stuff, even though I had just done zypper dup the night before.

+ Squezebox Server (SBS) 7.5.3 won't connect. Part of it was a firewall thing (dropped port 3483 packets) solved by moving from guarddog to.the openSUSE firewall and turning on masquerading, but it still doesn't load. It shows as enabled but doesn't load, and when explicitly loaded does not respond. Now this may be an oS11.4 thing, or it may be an SBS 7.5.3 thing. I've posted to the forum, watch this space.

+ My mouse problems have been solved by replacing the keyboard (and its included stick mouse).

Other than that no noticeable problems except:

+ Bluedevil. Aaargh.

It was working on oS11.3 with KDE 4.5.5 but now doesn't. More to follow, but at present:
    - It sees the phone, the phone sees it, they pair.
    - The phone can send files to Bluedevil, but not vice versa
    - Neither can browse the other.

So this is what we've done:

1. Delete PC from N8, N8 from PC, reboot both.

2. Discover N8 on PC (Manage devices):
    a. It finds the N8, sends a PIN. Acknowledge all prompts on the N8 (PIN, services, access, etc.)
    b. Set up services on PC (Send files), follow prompts
    c. Transition into attempt to send file. Follow prompts, select file, destination, OK. Nothing happens. No audio on phone, no prompt on PC, no files on phone.

3. Discover PC on N8 (delete pairing on N8, search and pair):
    + You have to be really quick as the prompt doesn't last long on the PC, and after a few attempts does not appear at all. So reboot and try this step again:
        - Minimize all PC windows, with mouse at about 3 o'clock on the screen
        - Start the process on the N8
        -click the PIN approval
    + Success. Send from N8 to PC: (have mouse in same position)
        - Accept connection: success.
    + Send file from PC to N8: no joy, same as 2c. above.
    + Delete pairings on both devices, re-pair on PC, but do NOT transition to send.
    + Attempt send: once again you have to be quick. The notifications widget has the attempts but doesn't alert! But same as2c. above, no joy.

So:
    + Pairing does work in both directions, but you havae to be quick if pairing from phone to PC.
    + Better to pair on the PC - the prompts are too short-lived and obscure on the PC.
    + File transfer works from phone to PC regardless of pairing direction. But watch the notifications area for prompts and be quick.
    + Browsing a remote device does not work in either direction.

The installed version is 1.0.2-3.8.1. What happens if we uninstall and reinstall an older version?
We find version 1.0-2.9 at
    http://download.opensuse.org/repositories/KDE:/Release:/45/openSUSE_11.3/i586/
and give it a whirl.This was the version that worked for us before. But no joy. They all show
    0.6 KiB/s
    0.0 KiB/s
in the notifications section.

I've posted to
http://forums.opensuse.org/forums/english/get-technical-help-here/install-boot-login/455185-bluedevil-under-opensuse-11-4-rc2.html#post2300263
Se we await comments of others smarter than I.

FWIW, pretty much everything else works flawlessly on OS 11.4. Firefox 4 beta has a few problems, but that is not an OS 11.4 issue...

So all in all, a good couple of days.

Sunday, March 6, 2011

Success! Bluedevil on OpenSuSE 11.3

If you upgrade KDE to 4.5.5 or install KDE 4.4.4 development files (for ALL of KDE, OpenSuSE, and Bluedevil) then you can get Bluedevil to work, so far to the extent that I can now both receive AND SEND files between laptop and Bluetooth device. 

Woohoo!!
=========================================
Details:

Continuing to try solving.

The tarball responds

    ERROR: cmake/modules/FindKDE4Internal.cmake
Googling suggest running build-essential but this does not exist.

Repository search suggests it is in libKDE4, libKDEcore4,  libkde4-devel, libkdepim-libs4-devel, kdepim4-runtime-devel, or kdepim4-devel, which are not installed. So I install them all.

That problem is solved, but now it can't find libBlueDevil, no problem we have 1.0-3.3 available as an RPM. Install it and try again. But it still can't find it.

So I go to the gym to clear my head and try one more time.

Go search at http://software.opensuse.org/search, choose the v. 1.0-2.9 ymp. Again, it can't find kdebase4 > 4.6, but volunteers to install an older version, I click OK.

It runs and runs and runs and ... claims Installation was successful.

But it wasn't. bluedevil is not to be found.

Re-check yast2: It shows it as being installed. KDE also shows it as being installed but the icon bounces up and down and eventually dies.

Check yast2: it offers updates for libluedevil1 and libluedevil-devel. The latter was not installed Accept these and try again. Now the icon appears in the tray.
Woohoo!! Finally! I can send files to the N8 and it puts them in E:/Received files.
=====
But notso fasto. When I reboot I get the dreaded Unable to start ksmserver. But now I know, although have not heretofore tried
     zypper dup
 http://en.opensuse.org/SDB:System_upgrade
http://en.opensuse.org/SDB:Zypper_usage

This command uses the distribution upgrade algorithm, which handles package splits, unmaintaned packages, and similar. Use it to switch to another distribution release.
# zypper dup
It is recommended to enable only the main repository of the distribution you want to install plus a few important repositories you were using (even better - their version corresponding to the current main repository) during a dist-upgrade. You can achieve this by disabling the old repositories using zypper mr -da, adding the new repositories via zypper ar and issuing zypper dup. You can also specify repositories to be used using --repo option: zypper dup -r repo1 -r repo2 ...
This runs freaking forever, but on reboot, all is now working. Well, at least Bluedevil is working.
 Start > Favorites > Configure Desktop > Help > About KDE shows that I have been upgraded to KDE 4.5.5. Totally painlessly.
So now that was so much fun, I followed the advice of
     http://tinyurl.com/6kvoflv
 to upgrade to OpenSuSE 11.4!

Next step: return to resolve and review OpenSync.
Great progress, great day.

Friday, March 4, 2011

Dependency Hell

Note to reader: This is now 6 March 2011. I have learned more, so am editing this post to change things that no longer are correct. If you have saved information earlier than today then please review this article.

If you upgrade KDE to 4.5.5 or install KDE 4.4.4 development files (as posted later) then you can get Bluedevil to work, so far to the extent that I can now both receive AND SEND files between laptop and Bluetooth device. The strikethrough fonts below demonstrate the deprecated remarks.

  The solution appears to install devel packages for ALL of KDE, OpenSuSE, and bluedevil (libbluedevil1). So while it isn't presently easy, it is  doable

=================================================

A fresh morning, a fresh start:

http://download.opensuse.org/repositories/KDE:/Distro:/Factory/openSUSE_Factory/i586/
Download libbluedevil1-1.8-8.2.i586.rpm  and bluedevil-1.0.2-32.2.i586.rpm. The first installs flawlessly, the second complains about not having kdebase4-runtime >4.6.

This is where we crashed ksmserver yesterday. So this time I just skip that requirement and let it go ahead an install. But it fails.

OK, download and install kdebase4-runtime-4.6.0-287.1.i586.rpm since this time we have the zypper fix for the crash...

But it needs QTDeclarative.so.4. This is provided by lib32-qt, but that is not in the repositories.

So checked and updated the repositories and added OpenSuSE Build Service - KDE: Updated Apps.

We check https://build.opensuse.org for the dependencies. We have all the direct ones but as above kdebase4-runtime lacks some that do not exist in our repositories or yast2 web search:

dbus1-x11
kdebase4-runtime-branding-upstream
libIlmImf6
libexiv2-9
libjpeg62

So I am correct. We ain't there yet.