Tuesday, October 19, 2010

kernel panic - unable to mount root fs

I have a Ubuntu 10.04 desktop and one day it just refuses booting up. Here are my steps to get it going again. Please drop a comment if it helped you.

- press escape when grub is load. Choose "recovery mode" to see where in the boot process it failed. In this case it is trying to mount root and failed.
- rebooted the computer from the bootable CDrom. Chose "fix a harddisk"
- once the initial setup is completed, try to mount the harddisk as root. For me it worked.

At this point I have 3 suspects:
- grub is corrupt. I tried reinstalling grub from the CDrom and that didn't help. Moreover I have been able to change options, tried older kernels, so not likely.
- blkid or device id somehow changed. I double checked the blkid values and devices with both the grub menu and /etc/fstab and they haven't changed.
- it took a while for me but I finally did a ls -l on /boot. All the files except one was dated one day before the failure. It was also odd that there was no backup (.bak) of the file. The file was initrd-xxx. I couldn't find the documentation on how to roll back the file, so I grabbed the same file from another Ubuntu box, copied it over. Rebooted and it started working again.

I googled a lot during this process and there was nothing really helpful. My suspicion is that there was a kernel update and somewhere in the middle of the process it failed.

Thursday, October 14, 2010

Powershell set-ClusterParameter

Powershell is wonderful. That being said there are still dark corners you have to traverse through.

I need to create a Powershell script to create a MSMQ resource on a failover cluster. One of the things I need is to set the IP address using DHCP. Using the UI interface is simple, select the network, click DHCP enabled, click apply. You would think you can do the same thing in Powershell, but it has to work like this:

$clusterGroup = Add-ClusterGroup -InputObject $cluster -Name "MsmqCluster"

# create cluster IP address
$IPClusterResource = add-ClusterResource -InputObject $ClusterGroup -Name "${clusterGroup}-IP" -ResourceType "IP Address"

# find the network name
$ClusterParam = get-ClusterResource "Cluster IP Address"|get-ClusterParameter Network
$NetworkName = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,Network,$ClusterParam.Value
# have to fake an ipaddress and subnet mask
$address = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,address,""
$subnetmask = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,subnetmask,""

# have to bundle the parameters together and set the parameters in one shot
$setParams = $NetworkName,$address,$subnetmask

# now you have to enable NetBIOS before you can Enable Dhcp
set-ClusterParameter -inputObject $IPClusterResource -Name EnableNetBIOS -Value 1
set-ClusterParameter -inputObject $IPClusterResource -Name EnableDhcp -Value 1

Listed on BlogShares