Fix Windows 7 when stuck at “Starting Windows”

June 8th, 2010

OK, I dual boot W7 Home Premium and Xubuntu 10.04. I also like to try out various live cds, boot cds and so on.

Every now and then, when I boot to W7, it gets stuck at the “Starting Windows” splash screen, pretty glowing colours but thats it. If I start up in safe mode it gets as far as classpnp.sys and then just hangs.

So I boot back into Xubuntu and open up Gparted; to find that the W7 partition has become hidden (this is probably my fault for fiddling about :))

To fix, unmount W7 partition, and then Manage Flags and untick the “hidden” flag, then reboot into W7.

If you are not dual booting, you can use any Ubuntu Live CD or Parted-Magic Live CD, or there are paid for Live CDs that will do a similar thing.

There is another method if this doesn’t work (or “hidden”) isn’t the problem.

1. Boot windows but press F8 to get up the recovery menu, and choose “Repair Windows

2. Login in as an Administrator (your own account will do if that type of account)

3. You eventually get some menu choices, pick Command Prompt

4. Type dism /online/get-packages
(If that doesn’t work try dism image:c: /get-packages)

5. You should get a list of the updates installed. Find the most recent one and write down the full filename

Filenames look something like this:
WUClient-SelfUpdate-Core-opLevel~31bf3856ad35~x86~~7.4.7600.226

6. Then run: dism /online/remove-package /PackageName:nameof package
(Again, if that doesn’t work, try dism /image:c:/remove-package /PackageName:name of package

7. Reboot PC

8. If you still have a problem, perform this procedure again, removing the latest package, until you find the one that causes the problem

Another Useful Copy Command

May 8th, 2010

I last came up with this subject a while ago, whilst working on my own backup. Been needing something slightly different, which allows pulling out files of the same type. This one uses find rather than a straight cp function.

 find /pathtoinputdir/ -name “*.*” -type f -exec cp -urvp {} /pathtooutputdir \;

I’ll break it down again:

 find /pathtoinputdir/ (pretty obvious, you could use just / to search your whole drive)

 -name “*.*”  (what to search for, replace *.* with anything you want to search for, but say you wanted to find all your jpg files, change it to *.jpg)

-type -f   (brings back files as opposed to directories)

-exec   (allows a function to run based upon what is found by find)

cp -urvp {}  (the copy with arguments and some magic (the brackets) which allows files and directories with spaces, newlines etc. See my other post to get descriptions of the cp arguments. You could replace cp with mv if you wanted to move and not copy)

/pathtooutputdir  (straight forward again, I create it first)

\;    (more magic to go with the brackets)

Word of warning, if you have lots of files with the same name but different contents, you will overwrite the older ones with the latest one, regardless of content

Disconnecting the Battery from a Range Rover L322 (2002 ->) Uk specification RHD

March 12th, 2010

In the old days, you just untightened and removed the two terminals from the battery, and that was that, but now its got over-complicated! I hadn’t used the Rangie for a week or so, and got a flat battery, couldn’t jump it from the little Mazda Eunos, so needed to try a charge up before it was off to Halfords for a new battery. Read through the Rave CD which required reading of four different sections, just to disconnect the battery, so here it is in all its glory:

DISCONNECTION:

  1. Turn off the ignition, and remove the key. (Keep the key close by you though, as the alarm may go off and you need to disable it)
  2. Ensure the alarm is disabled.
  3. Wait at least 2 minutes ( I gave it 5) for car systems to shut down such as the SatNav and Fuel Guage
  4. Yes, now you can lift the bonnet and disconnect the Earth terminal (brown lead)
  5. Now wait 10 minutes ( I gave it 20) for the SRS system to shut down. This is important because of what is to follow!
  6. You have a positive lead running to a fitting on the bulkhead in front of the battery, this fitting is used for connecting jump leads. Undo the nut (13mm) at the back, and release the cable, placing out of the way.
  7. Now unclip the cover for the battery terminal nut and undo the nut until loose.
  8. Now unclip and take apart the multiplug which runs to the positive connector.
  9. Now unclip the cover and undo and remove the nut for the battery disconnect system. Lift off the cable and set aside. (This is why item 5 is important, as this thing is designed to explode and break the battery connection in the event of a crash, so it works alongside the SRS)
  10. OK, now you can wiggle and remove the positive connector from the battery terminal.
  11. Battery disconnected!

Range Rover Battery Schematic


RECONNECTION:

  1. Refit the battery disconnect lead to the positive connector unit and tighten nut.
  2. Refit the positive connector to the battery terminal and tighten nut.
  3. Reconnect the “jump lead” cable to the bulkhead and tighten the nut.
  4. Reconnect the multiplug.
  5. Reconnect the negative terminal and tighten nut.
  6. Start the engine, and allow systems to fire up and do their thing.
  7. Finally, with the engine running, turn the steering wheel from full LH lock to full RH lock. This resets the DSC so it knows about the steering wheel position.
  8. Hopefully, everything back to normal. :)

NB: I left the battery in-situ to charge it, even though handbook and workshop manual recommend removal (Removal is for another blog post, which might mean gaining greater access under the bonnet, and pulley and levers to lift the flaming thing out!)

Am I Open Source or What? (on a Windows 7 PC ?)

March 11th, 2010

It’s list time again:

Because so much good open source software has been ported to Windows, its possible to do just about everything on Windows with the open source programs I use regularly on my main Xubuntu 9.10 system:

Open Source:

Open Office
Abiword
Gnumeric (a bit buggy)
Gimp
Inkscape
Gwhere
Geany
Audacity
ProjectX (java)
HJSplit (java)
Frostwire (java)
VirtualBox
FireFTP (firefox extension)
Firefox (of course!)
Mplayer & SMplayer
VLC

This list will grow. Keep up the good work guys :)

Plus, some notable “freeware” applications:

PhotoFiltre
ProgDVB6
puTTY
ImgBurn
AVGFree 9
Shark007 Codecs Pack
UltraVNC
VNCViewer
Windows Movie Maker 2.6
CPUz
JellyBean Key Finder
WirelessKeyView
Google Chrome
CCleaner
DeFraggler (Piritin)
Free Screen To Video (Koyote Software)
Winamp (with iAmp skin)
WizMouse (scroll without focus)
Powerpoint Presentation Viewer
RocketDock (just like my wbar!)
CDex
Adobe Reader 9
Scanner Application that comes with my Brother Network Printer (Brother very good at drivers and support for Windows and Linux)

Shareware I just can’t live without:

Winrar

Hacks:

Also done a few registry hacks to sort out the awful unintuitive default behaviour of Windows Explorer. These are easily found on any Windows 7 sites.

Remove Libraries from Explorer
Remove Favourites from Explorer
Remove HomeGroups from Explorer
Adding Directories “I want” to the SendTo drop down
Removing “Drives” from SendTo
Adding Copy To folder and Move To Folder to Right Click
Adding Open Command Prompt to Right Click

Nearly got my Windows PC behaving and looking just like “Linux”  :D

Windows 7 & Xubuntu (Dual Boot) & Samba File Server: Do’s and Dont’s

March 11th, 2010

Been dual booting W7 and Ubuntu for some time using the RC version, but upon purchasing an Asus EB1012, which is now proudly bolted out of sight to the back of my 24″ Hanns.G screen, I found I had a proper licensed copy of W7 Home Premium to look after, alongside side my 9.10 Xubuntu install. With a linux samba server also on the Lan I needed everything to run smoothly, and after fiddling about for a few weeks, I believe I am finally there.

DO:

1. Dual boot W7 with Linux. It makes so much sense, as what you can do in Linux is what you can’t do in W7, and vice versa (although the latter has now almost dimished to zero :))

Setting Up for Samba Server File Access

2. The following to get your samba server working with W7 to stop it BSODing:

edit your /etc/samba/smb.conf on the server and ensure that:

  • Your workgroup name is listed
  • Your netbios name is listed, and is the same as your workgroup (OK, this means you can only have one samba server, but it helps
  • Ensure that your security entry is set to user

So in the [global] section of smb.conf you should have these entries (assumes workgroup of MYHOME)

workgroup = MYHOME
netbios name = MYHOME
security = user

3. Follow all the steps in this howto by stormbringer on ubuntuforums to setup your samba server and shares.

4. Follow all the steps for W7 in this howto by dmizer on ubuntuforums to setup W7 for samba access

5. Add a registry key to W7 for LmCompatibilityLevel=2 - see here

6. Make sure your W7 workgroup matches the one in your smb.conf file

7. Have a look at your Antivirus program. Crashes have bee experienced when using free versions of Avast, Avira and AVG. I have AVG 9 Free installed and have disabled the Resident Shield and Link Scanner (the latter of these is apparently the root cause). If this doesn’t fix things, uninstall your AV all together.

8. Add your linux file server to your lmhosts.sam file in Windows 7. You will need to open notepad as administrator to do this. Simply add the ip, followed by a space or tab, followed by the netbios name you chose:

192.168.0.100   MYHOME

Save and reboot to get it to take effect.

Sharing Files on the Dual Boot

9. Create an NTFS shared partition separate from Ubuntu or Windows. If you don’t have the space, keep your files on the windows partition somewhere. ntfs file access is facile under ubuntu and you can automount through fstab with a simple line like this:

UUID=05AAD3F54R0B9BDA                           /media/DATA     ntfs-3g defaults 0 0

And of course you would use a similar line for accessing the windows partition.

At the moment, you won’t easily be able to access your Ubuntu partition from windows, well, not with read/write access, but to get at least read access, you would need to do some work prior to installation. I’m not going to recommend this route, as I believe it leads to instability. So you will need to be strong, and always copy or move files to your shared partition when in ubuntu. If you really must have read access, look here

DON’T:

1. Try to use Ext2ifs or Ext2fsd to access your ext4 partition. It doesn’t work, (bar the workaround above) and can cause your W7 to crash.

2. Don’t use EXT3 as your file system for a shared partition. Although it “works”, its just asking for trouble, because you will need to run one of the two programs in 1. above, which can increase instability.

3. Use Samba as your file server when on the ubuntu side of the dual boot. Setup NFS on the server for linux file access. Much better.

As you can probably see, I have set out to keep things as native as possible; give W7 what it expects to find and it will work well, give Ubuntu what it expects to find and the same applies….

Observation, after a recent Windows update, or due to something unrelated to all the above, my Server disappeared from the Network section, so have found the need to create a persistent mapped network drive. Wonder if it will ever come back….? [EDIT] it did, following a cold reboot the next day.

Mp3 playlist script - for current directory and sub folders

February 18th, 2010

Making mp3 playlists, a “simple” script

#!/bin/bash

touch ${PWD##*/}.m3u
export IFS=$’\n’
for i in $(find $1 -name “*.mp3″ -type f)
do
echo “$i” |sed ’s/..\(.*\)/\1/’ >> ${PWD##*/}.m3u
done

shuf ${PWD##*/}.m3u > ${PWD##*/}2.m3u
shuf ${PWD##*/}2.m3u > ${PWD##*/}.m3u
rm ${PWD##*/}2.m3u

You can leave out the last three lines if you don’t want to shuffle the list.

There is probably improved/easier code than this but it works for me.

To use, simply copy the code into a text file, save with a name of your choice, and make the file script executable. Put the file in your path, and then run in the directory you want to make a playlist from. it will work on all sub directories of that folder.

Video Tearing Fixed - Xubuntu 9.10 - Nvidia ION

February 14th, 2010

I use mplayer as my default video player, and have always had video tearing of some sort on my main PC. Having recently updated my PC to an Asus EB1012 net-top with the Nvidia ION graphics chip I found that enabling the vdpau options with mplayer gave me tear free playback. So I set out to resolve it for other file types (e.g. mp4 / avi)

I run Xubuntu by preference and normally use the Compositor to add transparency and shadows, and the default output plugin for mplayer is xv.

1. Turn off the compositor

2. This should produce tear free playback in totem and vlc

3. Open up nvidia-settings and ensure Sync to Vblank is ticked in  X Server XVideo Settings, and Sync to VBlank and Allow Flipping is ticked in Open GL Settings

4. edit the ~/.mplayer/config file

I grabbed the config file from GeexBox, as this served as a useful template to set up profiles for various file types.

For h264 / vdpau files (mkv) that use the GPU to process

[extension.mkv]
profile-desc=”Profile for Matroska files”
profile=lang
vo=vdpau
vc=ffh264vdpau

For HD Files (mp4)

[extension.mp4]
profile-desc=”Profile for HD mp4 files”
vo=gl
vfm=ffmpeg
lavdopts=lowres=0:fast=1:skiploopfilter=all
autosync=30
cache=32768

For “normal” (avi) files

[extension.avi]
profile-desc=”Profile for deinterlacing avi files”
vo=gl
vf=pp=lb/hb/vb/dr

The default section looks like this:

[default]
vo=vdpau,xv,gl
ontop=yes
double=yes
dr=yes
framedrop=yes
cache=8192
lirc=no
alang=en
slang=en

I have to make sure I check encoded options and rename the extension accordingly, but 95% of the time, this configuration works fine for me

Here is the entire ~/.mplayer/config file:

[deinterlace]
profile-desc=”Profile for picture de-interlacing”
vf-add=pp=fd

[dvd]
profile-desc=”Profile for DVD playback”
profile=deinterlace
dvd-speed=4
cache=8192

[lang]
profile-desc=”Profile for language”
alang=en

[protocol.dvd]
profile-desc=”Profile for dvd:// streams”
profile=dvd
profile=lang

[protocol.dvdnav]
profile-desc=”Profile for dvdnav:// streams”
profile=dvd
profile=lang
nocache=yes

[protocol.cdda]
profile-desc=”Profile for cdda:// streams”
cdda=speed=2

[protocol.tv]
profile-desc=”Profile for tv:// streams”
profile=deinterlace

[extension.mkv]
profile-desc=”Profile for Matroska files”
profile=lang
vo=vdpau
vc=ffh264vdpau

[extension.mp4]
profile-desc=”Profile for HD mp4 files”
vo=gl
vfm=ffmpeg
lavdopts=lowres=0:fast=1:skiploopfilter=all
autosync=30
cache=32768

[extension.avi]
profile-desc=”Profile for deinterlacing avi files”
vo=gl
vf=pp=lb/hb/vb/dr

[default]
vo=vdpau,xv,gl
ontop=yes
double=yes
dr=yes
framedrop=yes
cache=8192
lirc=no
alang=en
slang=en

Xubuntu 9.04 + Quick and Dirty VNC Remote Access

January 31st, 2010

Xubuntu doesn’t come with the Remote Desktop screen you find in Ubuntu. All the VNC howtos (some which used to work) on the forums seem to come to nothing for me. I am happy to share directly via vnc over my LAN. Here is all I needed to do:

On the “remote” xubuntu machine

sudo apt-get install vino

vino-preferences (to get the screen - as mentioned above) up

Tick boxes as required, I tick the top two and then untick the next but require a password for access.

Add a startup item to Sessions and Startup -> Autostart

usr/lib/vino/vino-server

Reboot (or just start with the command above)

On the local “xubuntu” machine
(you may have other options here)

Install GRDC

sudo apt-get install grdc

Open up Grdc, enter the remote machine details and away you go. Response is a bit slow, but its the one that works!

I don’t need this very often, as I have become more adept at using ssh and ssh -X, but it is handy once in a while.

Firefox 3.5.7 Update killed / crashed / broke Firefox on Windows 7

January 31st, 2010

This is more of a news bulletin than anything else.

My new PC has Windows 7 by default, so I am playing with it every now and then when not booting into Xubuntu 9.10. Yesterday Firefox went after an update for itself, from 3.5.6 to 3.5.7. The update went OK, but then firefox flatly refused to start. Not even showing up in Processes or Applications in the Task Manager. A reboot didn’t help either.

The resolution was to download and install Firefox 3.6 (I tried to uninstall first but Windows Control Panel told me that Firefox was already uninstalled! (go figure). Anyway all working good now.

Create GeeXBoX LiveUSB using UnetBootIn on Linux

January 4th, 2010

I know we have the win32 installer,
I know we can install to USB from CD,
but I wanted to use only Linux to
create a live USB that replicates the CD.

Requirements

UnetBootIn (in Xubuntu repos)
Standard or Custom GeexBox iso ( I used a Custom GeexBox 1.2.3)
USB Flash Drive (Used a Buffalo 1GB)

This all carried out on Xubuntu 9.04

Part I - Create Bootable USB Drive

Insert USB Drive to your PC running Linux (Ubuntu etc)
Start UnetBootIn
Tick the Disk Image Radio Button, ensure ISO is selected in the drop down and then select your GeexBox iso
Select your USB drive from the drop down box
Click OK and Wait until you get the Reboot or Exit buttons appear
Click Exit

Part II - Get the right GEEXBOX directory

Mount the GeexBox iso so you can access files
I use Gmountiso but you can create a directory and issue a command in the terminal

sudo mkdir /media/gb-iso
sudo mount -o loop /path/to/geexbox.iso /media/gb-iso

Go to your root directory of your USB drive and delete (yes, delete!) the entire GEEXBOX directory
Got to /media/gb-iso and copy the GEEXBOX directory, pasting it to the root of your USB drive.

Why have we done this? UnetBootIn does something to the GEEXBOX directory files, you need the unadulterated ones on the iso.

Part III - Edit syslinux.cfg

In a terminal, run the command:

sudo blkid -L

On newer systems (e.g. Karmic) run

sudo blkid

or

sudo blkid -o full

You will get all the UUID’s from your drives and partitions.
Note down the UUID for your USB drive
Mine was 0633-157B

Open up syslinux.cfg on the USB drive in your favourite text editor
Make it look like this:

########################################
default vesamenu.c32
prompt 0
timeout 20

MENU BACKGROUND /GEEXBOX/boot/splash.png
MENU TITLE Welcome to GeeXboX i386 1.2.3 (C) 2002-2009
MENU VSHIFT 11
MENU ROWS 6
MENU TABMSGROW 15
MENU CMDLINEROW 14
MENU HELPMSGROW 16
MENU TABMSG Press [Tab] to edit options, [F1] for boot options.
MENU COLOR sel 7;37;40 #e0000000 #fa833b all
MENU COLOR border 30;44 #00000000 #00000000 none

label ubnentry0
menu label Start GeeXboX …
kernel /GEEXBOX/boot/vmlinuz
append initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0633-157B lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr quiet

label ubnentry1
menu label Start GeeXboX for HDTV …
kernel /GEEXBOX/boot/vmlinuz
append initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0633-157B lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet

label ubnentry2
menu label Install GeeXboX to disk …
kernel /GEEXBOX/boot/vmlinuz
append initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0633-157B lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr installator quiet

label ubnentry3
menu label Start in debugging mode …
kernel /GEEXBOX/boot/vmlinuz
append initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0633-157B lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=0 vga=789 video=vesafb:ywrap,mtrr debugging

label ubnentry4
menu label Start HDTV edition in debugging mode …
kernel /GEEXBOX/boot/vmlinuz
append initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=UUID=0633-157B lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=0 vga=789 video=vesafb:ywrap,mtrr hdtv debugging

########################################

Make sure you replace my UUID entry with your own for each stanza

Save syslinux.cfg

Part IV - Clean Up

Unmount the iso

sudo umount /media/gb-iso

Delete the directory if you wish

sudo rmdir /media/gb-iso

You are done. Either safely remove your USB drive, or leave it in and reboot.
You may need to edit your bios settings to allow booting from USB.
And there you have it, LiveUSB, just like the CD, but you can edit settings if you wish.