X Server Crashes on Resume from Suspend
The MM10 sometimes wakes from suspend to chuck me out to the Gnome logon, losing my session. Then when I try logging on again, Gnome is broken.
I suspected XServer crashes. Yep according to /var/log/Xorg.0.log . Looked at internet. It’s sort of pear-shaped. Sorry, that was a pear I was looking at then. Googled it. Turns out the net is littered with veterans from the war against this one.
Looks like XServer is trying to do its own power management via ACPI, and that seems to get broken when other thingies are trying to suspend/resume at the same time. Still unconvinced. But here are the magical incantations:
In Xorg.conf:
Section "ServerFlags" Option "NoPM" "true" EndSection
also, need to pass a flag to X at startup. X is started by the display manager (Gnome/gdm) in my case. On debian, gdm’s config is /etc/gdm/gdm.conf. It has several clauses for starting different flavours of X session. Change all of the lines of the following kind to add the -noacpi flag:
command=/usr/bin/X -noacpi -audit 0
About to try this. Wish me luck.
Credits: too numerous to mention. Try googling ‘x server crashes resume suspend’
UPDATE:
Didn’t work. Blah. If you want, try it. Others have found success.
Suspending MM10 (again)
If you end up using pm-utils for power management (make sure you DO NOT install acpi-functions), drop a file called ’sharpmm10′ (or any name you like) into /etc/pm/config.d, which reads as follows:
ADD_PARAMETERS="--quirk-dpms-suspend --quirk-dpms-on" SUSPEND_MODULES="ath_rate_sample ath_hal ath_pci"
gnome-power-manager kicks of pm-utils.
I hate power management in linux.
Hardy Heron and MM10 SLOWWWWW
Well, I’ve two MM10s, one with Hardy Heron and one with Debian lenny.
Hardy Heron is much slower.
I think that’s because of encrypted LVM, but I can’t be sure.
Anyhow, I’m not convinced I get much extra with Hardy Heron, now that I’ve pretty much hacked a working Debian together.
Hardy Heron STILL didn’t give me suspend and hibernate out of the box.
I got that working under Debian.
But now I’ve broken it again
safe-upgrade ‘ing lenny on MM10
After aptitude safe-upgrade , I’m downgraded to a previous version of NetworkManager, and network-applet-gnome. These don’t work on the MM10 with madwifi.
Luckily, disconnected as I was, I still had the snapshot sources for the two packages in /var/tmp …
I re-configured, rebuilt, ran make install
The lenny NetworkManager stuff installs into /usr/local/sbin, but my version went into /usr/sbin, because I used the following configure line:
./configure --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc --localstatedir=/var
So, to clean up:
cd /usr/local/sbin mv NetworkManager NetworkManager.dontuse mv NetworkManagerDispatcher NetworkManagerDispatcher.dontuse ln -s /usr/sbin/NetworkManager /usr/sbin/NetworkManagerDispatcher .
Finally, ran restart:
/etc/init.d/NetworkManager restart
and off it goes, connecting. And here I am again! Byeeeeee.
Patterns Facilitated by Java: IOC
Bin thinkin bout Inversion of Control:
BEFORE: “Containerless” — (not IOC), “Main” code kicked off, initialises objects, invokes first methods, off you go! Other objects create new objects, and create relationships between themselves…
Configuration is read by objects, and is ‘passive’ (used-by).
AFTER: IOC: Configuration is used by ‘application environment’ to ‘plumb’ a system together, instantiating objects and creating dependencies between them, invoking methods as described in the configuration.
In a sense, Configuration is ‘active’, and drives the system.
Of course, a text file is not active itself, but the ‘container’ or ‘application server’ uses it.
The configuration is declarative, not procedural
That is, instead of everything starting by normal imperative programming instructions, creating objects, and invoking methods in sequence, a 4GL (e.g.written in an XML language) describes what the system looks like and the dependencies between object creation, destruction and method invokation the application server sets it up, and ‘works it’ as described, ensuring all dependencies between components are resolved in the correct order.
Here’s an IOC:
- I want a system which has a KeyboardListener, a DisplayDriver, a GUI and a StartupAndShutdownController
- Start up the StartupAndShutdownController as soon as possible. Use ‘Start’ method.
- Register KeyboardListener to be notified by StartupAndShutdownController when Startup has begun by invoking it’s ‘StartListening’ event.
- Start up the DisplayDriver, and as soon as possible. Use ‘Start’ method.
- Register GUI to be notified by DisplayDriver’s ReadyForUse event, and KeyboardListener’s KeyPressed events
- When GUI starts, …
Oh, for goodness sake, why didn’t I choose an easier example! Ahem. The rest is left as an exercise.
Note, however, that the description is a bullet-list, rather than a numbered list. The dependencies are described, and the order of clauses does not matter.
For an application server to go from configuration files/data to an instantiated set of objects, the application server needs to be able to create objects based on an external description, that the compiler does not know about at compile time, and may change without re-compilation (for example, depending on a class name stored in a text file)
Here is the point Java naturally overtakes C++: it is dynamic enough to act like an interpreted (as opposed to compiled) language when in needs to be, and has class loaders which can take a string at run-time, and create an instantiation of the relevant class name.
C++ Programmers can already see ways around this, but also know it may be tricky to make this ultimately flexible, and will sigh with jealousy at the ease of Java in this respect.
Why bother?
To add IOC to the systems-programming mix is an art.
It doesn’t solve anything in itself.
It is another spin on Component Based Development (CBD)… ever heard of vendors trying to flog graphical systems for assembling systems from ‘business components’, for use by business-people? Well, that will not happen for many reasons, some of them psychological, some of them practical (basically, it takes all kinds to make a world).
However, CBD can bring the technologists, ops-people and business-people to almost a common language, and can partition a solution implementation into bits the business want to know about, and bits they’d prefer not to know about…and that is at a much higher declarative level than a non-IOC world.
However, selecting which bits to ‘componentise’, and what configuration and methods to expose to an IOC world is an art, and requires business input.
SpotlightFS on Leopard
Luckily, SpotlightFS continues to be developed. I went straight to the MacFuse Google Code page, and it just mentioned an unsupported Tiger version.
To install, I did:
0) Ensured I had MacPorts
1) Install:
port install spotlightfs
Failed for me, because I had the Tiger version hanging around still, so I de-installed it:
/Library/Filesystems/fusefs.fs/Support/uninstall-macfuse-core.sh
Then the next attempt running port install spotlightfs failed because of a ‘header not found error’. I did a port search fuse, and apart form the wonderfully named ‘libconfuse’, there was also a ‘libfuse’…assuming something wasn’t working with Darwin Ports’ dependency checking, I installed everything in this order:
port install libfuse port install fusefs port install libfuse port install spotlightfs
Yes, I did libfuse twice…but just in case that’s significant, I offer it up anyway…didn’t seem to harm anything.
Can package systems resolve two-way dependencies?
E.g., say Pkg1 depends on the headers of Pkg2 to build, but Pkg2 depends on the libraries of Pkg1 to build… The correct answer is:
- Install Pkg1 source
- Install Pkg2 source (although at this point, it could happen before Pkg1)
- Build Pkg1
- Build Pkg2
I know sometimes you get the ‘devel’ package separate from the ‘run’ package, and that would mean it’s possible to do the above manually, but do package systems like DarwinPorts do it automatically?
Nice drop-shadows etc. in Ubuntu
I tried turning on ‘Nice Effects’ in Ubuntu’s Appearance preferences, but received an unhelpful ‘did not work’ error. I think that the next version of Gnome should have a random witticism generator instead. At least then it may disarm the urge to shout at the screen, fist clenched.
It turns out that ‘Nice Effects’ depends on Compiz, and my diddly laptop cannot handle that (at least Compiz won’t build). Bah!
The ‘Didn’t Work’ dialog, and the ‘Because of a Problem’ dialogs in Gnome remind me of a recalcitrant teen serving in a shop, who has been forced to do the job by his parents as they refused to continue supplementing his Mobile Phone account unless he got up and squeezed every ounce of oomph from his meagre motivational reservoir, and did something a little more productive than sitting in his darkened room listening to Emo Classics, Vol 3: The Best Depressing Music In the World, Ever…
Me in shop, to a young person of the above cast: “Excuse me, have you got this in blue?”
Teen: “Dunno…No.”,
Me: “Um, have you looked in the stock room?”,
Teen: “No”…
Have you noticed no matter how much weariness, sadness, irritation (or combination thereof) which you attempt to convey in your expression or voice at that point really doesn’t make any impression whatsoever? Then it dawns on you that this fragment of all of our futures truly does not see any issue, or reason to take further action. You’re an ex-problem.
Back to the Gnome example: the correct error message would be helpful and empathetic. In this case, it (the error message) would tell me—probably addressing me as ‘Sir’–how terribly sorry it was, but it could not fulfil my request as it was missing a vital component, and that unfortunately, to it’s eternal sadness, it cannot use that component on Sir’s behalf, as Sir’s hardware is shall we say, not quite the latest model (the error would pause to convey a potentially distressing fact, and to emphasise its regret). On the other hand, the error might continue, if Sir was in need of a lesser, but still most gratifying enhancement of Sir’s visual and graphical spectacle, then Sir might consider the package just down the road on the left, by the name of ‘xcompmgr’. The error would finish by saying, if Sir was to take possession of suitable hardware in the future, then Sir would of course be most welcome to return to this dialogue, whereupon the manager, Mr Gnome, would personally attend to his needs. Good day.
There you are, teen-boy-in-shop, that’s customer service!
xcompmgr
Some nice settings:
xcompmgr -cCfF -r4 -o.65 -l2 -t2 -D2
The incantations to make it work…
in /etc/X11/xorg.conf:
Section "Extensions" Option "Composite" "Enable" EndSection ... Section "Device" Identifier "Silicon Motion, Inc. SM720 Lynx3DM" Driver "siliconmotion" Option "UseBIOS" "off" Option "pci_burst" "on" Option "fifo_aggressive" "on" Option "RenderAccel" "true" Option "AllowGLXWithComposite" "true" BusID "PCI:0:9:0" VideoRam 16384 EndSection
The only thing in the Driver section that is (or may be) necessary is AllowGLXWithComposite. The rest are aggressive acceleration options for SiliconMotion, which do actually seem to speed things up.
I’m not sure about the VideoRam argument. This is stating that the siliconmotion driver should treat the inbuilt graphics card as though it has 16M of Video RAM, when in fact all of the specs show that the Lynx 3DM chip only has 8M of Video RAM. So what’s the point?
Like a lot of this, I don’t have the time to discover the reason, and so it remains a magical incantation that makes me feel better, and is gentler on the skin than repetitive hand-washing.
BTW. I don’t have anything against teens. I was one once.
WordPress XMLRPC
In Drivel, select MovableType, and enter the following URL: ‘http://<journalName>.wordpress.com/xmlrpc.php
Ubuntu Hardy Heron on MM10
Vanilla install of Ubuntu 8.xx on MM10, with Ubuntu Desktop (gnome) and encrypted LVM…
1. Didn’t auto-detect monitor. Need to go in and edit /etc/X11/xorg.conf manually
2. longrun not installed by default
3. Authentication seems flaky. Sometimes I am asked several times for my password.
4. To get to a root prompt:
$ sudo su
Optionally, can use ‘passwd’ then to set a root password, which is undefined by default on Ubuntu
5. Suspend doesn’t work.
6. Need to resize fonts a bit — too large for DiddlySharp
7. Otherwise, looking good!
We’re all Heels
Google’d for ‘hibernate linux post sleep’, because I want to run scripts on wake-up to kick the MM10 back up to longrun ‘performance’ (always defaults to ‘economy’). Near the top of the results was this article on TechRebublic written this month (March 2008) by Jack Wallen.
Jack states he has ten years’ experience with ‘Linux’ (BTW, see a comment to my previous post to decode what I mean by ‘Linux’ — Jack uses some convenient shortcuts too).
Too many people are waving their Achilles Heels at Linux, and I’m just as guilty.
If I say something a little unthinking, and a little inflammatory, will y’all please take it as a provocative viewpoint of the n00b, and feel free to educate me. I just believe that if I try to be precisely correct in my postings, I’ll never write anything; I’ll never annoy anyone and I’ll never learn anything.
I really like Linux (OK, to be precise, the Debian Distro. Gnome Desktop on Linux 2.6.24 patched with Suspend2, with most packages taken from Lenny). It just seems the processes surrounding it[s development could cause more pain than necessary.
