f-log

just another web log

28 Jun 2010 21:03
When I am not busy fixing problems caused by Ubuntu I like to take the time to shout at my machine...
Ubuntu completed updating to version 10, all seemed well, but ...
The machine would not boot. Grub would pop up and few lines of system messages before blackness and eventual a still hard drive.
My first though was to just leave it, but no it was no doing anything, Ctrl+Alt+Del worked, so I cycled it a few times.
By editing the Grub boot command I got rid of "quiet splash" and in its place put "nomodeset" (actually I tried a few other things first), this got me to see the failure point.
Checking Battery State [OK] which seems to affect ATI users mostly which meant lots of digging for Nvidia.
Turns out this is another well know and documented issue that Ubuntu/Canonical are in no hurry to fix.
First off I tried booting into single mode, change the Grub parameter from just "nomodeset" to "nomodeset single".
That got me a rather handy looking recovery menu with "Run in failsafe graphic mode", which dutifully loaded X and asked me if I wanted to reconfigure graphics settings, which I did, I really really did!
But it would just ask me the same set of questions before failing :(
So I tried again and selected "Drop to root shell prompt", woohoo some access, hang on, why is nothing I type coming up?
No characters were appearing as I typed and pressing enter repeated the prompt with out any line breaks.
From my LPIC training I knew one magic word reset no, it does not reboot the computer but instead resets the graphic console. Very handy when you have just cat a binary.
From there I could finally. sudo dpkg-reconfigure xserver-xorg which wanted dpkg --configure -a
and thendpkg-reconfigure xserver-xorg
dpkg-reconfigure gdm

Then reboot, with "nomodeset single", "Drop to root shell prompt",reset and start gdm and everything worked again.
Phew!
24 Jun 2010 20:34
So Ubuntu killing two machines on install is not an unknown thing
https://help.ubuntu.com/community/Grub2#Selected%20Problems%20and%20Bugs

and it may have been festering since 2006
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/45989
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/46520
but is still prevailant today
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/414996

http://www.google.co.uk/#hl=en&q=+site:ubuntuforums.org+grub_getcharwidth&sa=X&ei=eLIjTOjGBpDw0wSTja38BA&ved=0CB0QrQIwAQ&fp=be8fd41e0a386f13

All I know is I will take extra care when using a so called safe live CD !!
p.s. a quick fsck later and the laptop booted, updating to ubuntu 10 now ...
23 Jun 2010 23:21
Have you heard the Linux Live CD mantra ?
"A live CD will not and cannot affect your existing hard drive, EVER!"
Except with Ubuntu and its exploration using Grub2 (boot loader) which, in a specific set of circumstance will destroy the boot record!
My old Ubuntu laptop that has been updated many times and was suffering due to space restrictions. All I needed to do was wipe the hard disk and reinstall...
But, the network port was nuked by a bad cat5 cable(oops), the DVD drive seemed to work but will not boot, I have not seen a floppy disk for years and Ubuntu itself will not boot.
All I need to do is install Ubuntu onto the hard disk. Borrowed a 2.5 IDE USB enclosure only to find after prying it a part it was SATA.
Bought a PATA 2.5 case for £4 from amazon inc P&P, ripped out hard drive and ran Virtual Box with the Ubuntu 10 DVD cover disk and installed. Four hours later put hard drive back in laptop and not even Grub came up.
So downloaded Ubuntu 9 and 10 in CD ISO and burnt them to disks.
Put in Ubuntu 9 to Sarah's Windows XP machine and followed through the install wizard.
Before the installation begins a summary screen ensures the correct settings.
EVERY SETTING ON THE SUMMARY SCREEN WAS CORRECT.
So I left it installing, much quicker from CD, put hard drive back in the laptop and got a grub error
error: the symbol 'grub_getcharwidth" not found.
Odd, quick google showed this was not an uncommon error, but worse it advised the host machine may not boot.
Sure enough the windows machine would not boot, spent 2 and half fun hours trying to find the windows install CD that I had not used for over 4 years!
Eventually found ran recovery and fixmbr
One down one to got.
Rebooted from Ubuntu 9 live CD and followed through the install again. At the summary screen clicked advanced and found a hand pull down explaining it was about the wipe out the host hard drive even though the install was to the USB drive !
Changed it to the USB device and allowed it to install...
Checked windows booted OK [Check]
Put hard drive back in laptop and ...
Grub, Ubuntu, filesystem failed
doh!

20 Jun 2010 22:49
I may have had something to do with http://theworldcupdemo.com a silverlight blend of mapping and HD video, one word review 'slick'.
Find out more at http://www.earthware.co.uk
06 Jun 2010 21:58
disable auto-indenting in vim for the file you are currently working on:setl noai nocin nosi inde=
Pains me every time I copy and paste code.
06 Jun 2010 21:47
Now it is time for my the final part of my Android binary watch series.
Last time it seemed we were completing the final part of the application, adding an about box and handling screen rotation.
But what really polishes off the basic Android application is state. That is when you exit the application and restart (or, rather surprisingly rotate the screen) the settings are preserved.
private SharedPreferences UserPreferences;

/* Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (UserPreferences==null)
     UserPreferences = getSharedPreferences("[[YOUR PACKAGE NAME]]",MODE_PRIVATE );
    initialiseview();
}

/* onPause, onStop and onDestroy all need to save user preferences */
protected void onPause() {
    super.onPause();
    SaveUserPreferences();
}

protected void onStop() {
    super.onStop();
    SaveUserPreferences();
}

protected void onDestroy() {
    super.onDestroy();
    SaveUserPreferences();
}

/* save user preferences and the arrange new layout */
public void onConfigurationChanged(Configuration newConfig) {
    SaveUserPreferences();
    initialiseview();
    super.onConfigurationChanged(newConfig);
}     

/* save preferences, which in this case is store to INTs */
private void SaveUserPreferences() {
    SharedPreferences.Editor ed = UserPreferences.edit();
    ed.putInt("LayoutMode", LayoutMode);
    ed.putInt("ShowCalculations", ShowCalculations);
    ed.commit();
}

/* get preferences, defaults provided if they do not exist */
private void RecoverUserPreferences() {
    LayoutMode = UserPreferences.getInt("LayoutMode", 2);
    ShowCalculations = UserPreferences.getInt("ShowCalculations", 0);
}

as noted in the comments, the 'state' of the app can be stored with just two integers. One for the if the seconds are displayed (LayoutMode) and one defining whether or not the calculations are displayed.

I have two more very keen Android ideas but only time will tell if I have any time ...

Expect to have a couple of videos of the app running on YouTube soon.
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed

email

root

flog archives


Disclaimer:
This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk
In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]