Thursday 31 December 2009

Fix for: Kernel panic - not syncing:VFS: Unable to mount root fs on unknown

Fixed by following this from http://ubuntuforums.org/archive/index.php/t-620860.html

The "why" is fairly easy, the fix is a bit lengthy. The short answer is that the initrd image was not updated or was updated with an incorrect disk setting. This can turn into a very long and detailed set of steps. So I will outline what is needed, and then have you boot from the install cdrom to fix it. If some of the steps in the outline indicate that a file setting is wrong, I will leave it up to you on how to edit the file to fix it :-). So first an explanation on the steps, then figure out how to get you access to disk to fix it.

The initrd image is located in '/boot' and looks like the line below, the numbers after the key words "initrd.img-xxxxxxxx" will be dependent on what kernel you have installed. There can be more than one of these initrd.img files.


Example - initrd.img file

/boot/initrd.img-2.6.22-14-generic


Quick Summary

In your case, since grub is loading, and it's loading the kernel, it means that your Grub install is ok. You did not mention it, but I assume that since Grub is the boot loader, that you also use it to boot to Windows. From the error message that you provided, it appears that Windows is on the first partition, however Ubuntu is on either the second or third partition. Since you have booted into Windows using Grub, it's also confirmation that Grub is working properly and the issue is likely the initrd.img.

A Quick Grub Review

Grub creates it's own internal mapping of disk drives. The format is like this:

hd( 0, 0 )

The first parameter is the disk drive.
The second parameter is the disk partition.

All numbering starts at zero [0]. So the first disk drive is [0], the second one is [1] and so forth. The same applies to partitions, the first partition is [0], the second partition is [1].

In your error message, the last line indicates that the kernel is looking on disk 1, partition 1 for the Ubuntu installation. "unknown-block(0,0)"

[6.543860] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

How To Fix It

There are two items that need to be checked: 1) the disk that grub is going to boot from, and 2) the partition that it is to use to load Ubuntu. In your case the first item is correct because windows boots, it's the second one that is wrong, and it's can be wrong in one or two places.

Verify that the Grub device mapping is correct. This requires access to the partition where '/boot' exists. The file is called /boot/grub/device.map, it's a plain text file that will have one or more lines telling grub what disks is suppose to know about.

/boot/grub/device.map

For SATA or SCSI it will look like this:

(hd0) /dev/sda

For IDE

(hd0) /dev/hda



There are two locations for the partition that is to be used, one is in the Grub menu, and the other one is in the initrd.img file.

Here is an example of the Grub Menu file: /boot/grub/menu.lst

You are interested in the lines that look like this:

title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,1)
kernel /vmlinuz-2.6.22-14-generic root=/dev/md1 ro
initrd /initrd.img-2.6.22-14-generic

title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd0,1)
kernel /vmlinuz-2.6.22-14-generic root=/dev/md1 ro single
initrd /initrd.img-2.6.22-14-generic

Your Windows entry will be located at the bottom of the file and will look like this:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Windows NT/2000/XP
root (hd0,0)
savedefault
makeactive
chainloader +1

The above example is from a system that is using RAID1, so the 'root' is a bit different from yours. Make sure your 'root' points to the correct partition for your Ubuntu installation.

If your Ubuntu installation is on partition 2, then the root will be '(hd0,1)', if your Ubuntu installation is on partition 3, then the root will be '(hd0,2). It's repeated here:

If root is on the second partition, then 'root hd(0,1)'
If root is on the third partition, then 'root hd(0,2)'

The second location for the partition is in the initrd.img file. It's just safer to rebuild it then to try to mess with it.

update-initramfs -c -k 2.6.22-14-generic
update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic

It's likely that you are doing this from a cdrom boot, so make sure you specify the kernel name. Do not try something like update-initramfs -c -k `uname -r`, it will just fail and mess up your image.

---

Okay, so now how to access the disk? Fastest way is to boot with the install cdrom and let it come up in the Ubuntu GUI.

Note: Most of the following section was from here, because was I too lazy to type it all in in: https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

---
Select Applications>Accessories>Terminal.

Become root

sudo -i

Now that you have root access, you need to mount the partition(s) containing your bootloader files.

You will need access to both your /sbin/ and /boot/ directories. If you have a /boot/ listing in your fstab, you will need to mount two partitions. In your case this is unlikely because you said you had three partitions, so everything is located on either /dev/hda2 or /dev/hda3. I am assuming that /dev/hda2 is your Ubuntu location, if it is not, just replace the '2' with it's correct location.

Create a mount point

mkdir /mnt/work

If you need to mount /boot/, too, run the following command. Again I think all of your data is located on a one partition based on the information you provided, so this step is not needed ... however just to keep Mr Murphy away...

mkdir /mnt/work/boot

Now it's time to actually load your filesystem data. Review your fstab and identify the location(s) of / and /boot/; these will likely look something like /dev/hda2 and /dev/hda3, though the letter 'a' and the numbers 2 and 3 may differ.

Enter the following commands to load your filesystem and some information GRUB may need.

mount /dev/hda2 /mnt/work
mount -o bind /dev /mnt/work/dev
mount -o bind /proc /mnt/work/proc
cp /proc/mounts /mnt/work/etc/mtab

Now, you have to enter your working environment. The following command will take care of that.

chroot /mnt/work/ /bin/bash

If all of the assumptions I made are correct about your system, and the grub menu.lst file has the correct root (hd0,1) entry, all you need to do is run the update command.

update-initramfs -c -k 2.6.22-14-generic

Now exit the chroot environment and reboot

exit << exit chroot
reboot

Hopefully this will fix your problem, if not, then post your device.map and menu.lst files and we can figure out what is going on.

Tuesday 15 December 2009

list sort with delegate

myList.Sort(new Comparison(
delegate(MyClass a, MyClass b)
{
if (a.number <>
else if (a.number > b.number) return 1;
else return 0;
}
));

Monday 23 March 2009

xorg.conf for Widescreen SD TV on TV-Out (s-video)

See DisplaySize setting http://www.mythtv.org/wiki/Display_Size

e.g.

Section "Monitor"
Identifier "TV"
HorizSync 30.0 - 50.0
VertRefresh 50.0
DisplaySize 320 180
EndSection

Monday 2 March 2009

openbox Desktop context menu

Need to disable Nautilus Desktop context menu

Disable it with the gconf-editor program. Run gconf-editor and browse to "/apps/nautilus/preferences" and turn off the show desktop option. Another simpler way to get that is to call nautilus with the --no-desktop switch.

http://icculus.org/openbox/index.php/Help:GNOME/Openbox

Switch Gnome Window Manager

Applications -> System Tools -> Configuration Editor

/desktop/gnome/session/required_components -> windowmanager

Saturday 14 February 2009

smb.conf for LAN access

Config below, also need to add samba users with:

smbpasswd –a username

# This is the main Samba configuration file. You should read the

# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command #"testparm" # to check that you have not made any basic syntactic #errors.
#
#======================= Global Settings =====================================
[global]

workgroup = home
netbios name = mistervole
server string = mistervole

# Logging Options:
# this tells Samba to use a separate log file for each machine
# that connects

log file = /var/log/samba/log.%m

# Put a capping on the size of the log files (in Kb).
max log size = 50

hosts allow = 192.168.1.100 192.168.1.101 192.168.1.102 192.168.1.103 127.

# Security mode. Most people will want user level security. See
# security_level.txt for details.

security = user

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.

password level = 8

# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
# Encrypted passwords are required for any use of samba in a Windows NT domain
# The smbpasswd file is only required by a server doing authentication,
# thus members of a domain do not need one.

encrypt passwords = true
smb passwd file = /etc/samba/smbpasswd

# Browser Control and Networking Options:
# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS
# names via DNS nslookups. The built-in default for versions 1.9.17 is
# yes, this has been changed in version 1.9.18 to no.

dns proxy = no

#============================ Share Definitions ==============================

[homes]
comment = Home Directories
browseable = no
writable = no

# This one is useful for people to share files
;[tmp]
; comment = Temporary file space
; path = /tmp
; read only = no
; public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
; comment = Public Stuff
; path = /home/samba/public
; public = yes
; writable = no
; write list = @staff
# Audited directory through experimental VFS audit.so module:
# Uncomment next line.
; vfs object = /usr/lib/samba/vfs/audit.so

[photos]
path = /usr/share/data/photos
valid users = v
public = no
writeable = yes
browseable = yes
available = yes
guest ok = no

[music]
path = /usr/share/data/music
valid users = v
public = no
writeable = yes
browseable = yes
available = yes
guest ok = no

[video]
path = /usr/share/data/video
valid users = v a
public = no
writeable = no
browseable = yes
available = yes
guest ok = no

-----------------------------------------------------------
# A private directory, usable only by Fred. Note that Fred requires
# write access to the directory.

;[fredsdir]

# [Agustin]
; comment = Fred's Service
# comment = Agustin Private Files
; path = /usr/somewhere/private
# path = /home/agustin/Documents
; valid users = fred
# valid users = agustin
; public = no
; writable = yes
# writable = yes
; printable = no