* [PATCH] root mount failure emit filesystems attempted
@ 2006-05-03 16:44 Andy Whitcroft
2006-05-03 19:14 ` Jan Engelhardt
0 siblings, 1 reply; 2+ messages in thread
From: Andy Whitcroft @ 2006-05-03 16:44 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
root mount failure emit filesystems attempted
When we fail to mount from a valid root device list out the filesystems
we have tried to mount it with. This gives the user vital diagnostics
as to what is missing from their kernel.
For example in the fragment below the kernel does not have CRAMFS
compiled into the kernel and yet appears to recognise it at the RAMDISK
detect stage. Later the mount fails as we don't have the filesystem.
RAMDISK: cramfs filesystem found at block 0
RAMDISK: Loading 1604KiB [1 disk] into ram disk... done.
XFS: bad magic number
XFS: SB validate failed
No filesystem could mount root, tried: reiserfs ext3 ext2 msdos vfat
iso9660 jfs xfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
do_mounts.c | 5 +++++
1 files changed, 5 insertions(+)
diff -upN reference/init/do_mounts.c current/init/do_mounts.c
--- reference/init/do_mounts.c
+++ current/init/do_mounts.c
@@ -310,6 +310,11 @@ retry:
panic("VFS: Unable to mount root fs on %s", b);
}
+
+ printk("No filesystem could mount root, tried: ");
+ for (p = fs_names; *p; p += strlen(p)+1)
+ printk(" %s", p);
+ printk("\n");
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
out:
putname(fs_names);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] root mount failure emit filesystems attempted
2006-05-03 16:44 [PATCH] root mount failure emit filesystems attempted Andy Whitcroft
@ 2006-05-03 19:14 ` Jan Engelhardt
0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2006-05-03 19:14 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: akpm, linux-kernel
>
>root mount failure emit filesystems attempted
Something better was already submitted earlier, but it did not get merged.
URL: http://tinyurl.com/pa4ap
Long URL: http://groups.google.com/group/linux.kernel/browse_thread/thread/81bfec7e96bd60cd/b3a7f8421fb7ca53?q=show+partitions+diff&rnum=1#b3a7f8421fb7ca53
What it does:
When we fail to mount from a valid root device list out the
block devices available.
>When we fail to mount from a valid root device list out the filesystems
>we have tried to mount it with. This gives the user vital diagnostics
>as to what is missing from their kernel.
I think both should be merged. An updated version of the print-partitions
patch that works with 2.6.17-rc3 is below.
> No filesystem could mount root, tried: reiserfs ext3 ext2 msdos vfat
> iso9660 jfs xfs
> Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
Your patch: Acked-by: Jan Engelhardt <jengelh@gmx.de>
Patch below: Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
diff --fast -Ndpru linux-2.6.17-rc3~/block/genhd.c linux-2.6.17-rc3+/block/genhd.c
--- linux-2.6.17-rc3~/block/genhd.c 2006-04-27 04:19:25.000000000 +0200
+++ linux-2.6.17-rc3+/block/genhd.c 2006-05-01 18:50:14.326821000 +0200
@@ -214,6 +214,52 @@ struct gendisk *get_gendisk(dev_t dev, i
return kobj ? to_disk(kobj) : NULL;
}
+/*
+ * printk a full list of all partitions - intended for
+ * places where the root filesystem can't be mounted and thus
+ * to give the victim some idea of what went wrong
+ */
+void printk_all_partitions(void)
+{
+ int n;
+ struct gendisk* sgp;
+ down(&block_subsys_sem);
+
+ /* For each block device... */
+ list_for_each_entry(sgp,&block_subsys.kset.list, kobj.entry) {
+ char buf[BDEVNAME_SIZE];
+ /* Don't show empty devices or things that have been surpressed */
+ if (get_capacity(sgp) && !(sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) {
+ /* Note, unlike /proc/partitions I'm showing the numbers in hex
+ in the same format as the root= option */
+ printk("%02x%02x %10llu %s",
+ sgp->major, sgp->first_minor,
+ (unsigned long long)get_capacity(sgp) >> 1,
+ disk_name(sgp, 0, buf));
+ if ((sgp->driverfs_dev) && (sgp->driverfs_dev->driver)) {
+ printk(" driver: %s\n", sgp->driverfs_dev->driver->name);
+ } else {
+ printk(" (driver?)\n");
+ }
+
+ /* now show the partitions */
+ for (n = 0; n < sgp->minors - 1; n++) {
+ if (!sgp->part[n])
+ continue;
+ if (sgp->part[n]->nr_sects == 0)
+ continue;
+ printk(" %02x%02x %10llu %s\n",
+ sgp->major, n + 1 + sgp->first_minor,
+ (unsigned long long)sgp->part[n]->nr_sects >> 1 ,
+ disk_name(sgp, n + 1, buf));
+ } /* partition subloop */
+ } /* Non 0 size, not surpressed */
+ } /* Block device loop */
+
+ up(&block_subsys_sem);
+
+}
+
#ifdef CONFIG_PROC_FS
/* iterator */
static void *part_start(struct seq_file *part, loff_t *pos)
diff --fast -Ndpru linux-2.6.17-rc3~/include/linux/genhd.h linux-2.6.17-rc3+/include/linux/genhd.h
--- linux-2.6.17-rc3~/include/linux/genhd.h 2006-04-27 04:19:25.000000000 +0200
+++ linux-2.6.17-rc3+/include/linux/genhd.h 2006-05-01 18:50:14.326821000 +0200
@@ -401,6 +401,7 @@ char *disk_name (struct gendisk *hd, int
extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
extern void add_partition(struct gendisk *, int, sector_t, sector_t);
extern void delete_partition(struct gendisk *, int);
+extern void printk_all_partitions(void);
extern struct gendisk *alloc_disk_node(int minors, int node_id);
extern struct gendisk *alloc_disk(int minors);
diff --fast -Ndpru linux-2.6.17-rc3~/init/do_mounts.c linux-2.6.17-rc3+/init/do_mounts.c
--- linux-2.6.17-rc3~/init/do_mounts.c 2006-04-27 04:19:25.000000000 +0200
+++ linux-2.6.17-rc3+/init/do_mounts.c 2006-05-01 18:50:14.326821000 +0200
@@ -7,6 +7,7 @@
#include <linux/root_dev.h>
#include <linux/security.h>
#include <linux/delay.h>
+#include <linux/genhd.h>
#include <linux/mount.h>
#include <linux/nfs_fs.h>
@@ -302,14 +303,18 @@ retry:
/*
* Allow the user to distinguish between failed sys_open
* and bad superblock on root device
+ * and give them a list of the available devices
*/
__bdevname(ROOT_DEV, b);
printk("VFS: Cannot open root device \"%s\" or %s\n",
root_device_name, b);
- printk("Please append a correct \"root=\" boot option\n");
+ printk("Please append a correct \"root=\" boot option; here are the partitions available:\n");
+ printk_all_partitions();
panic("VFS: Unable to mount root fs on %s", b);
}
+ printk("List of all partitions:\n");
+ printk_all_partitions();
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
out:
putname(fs_names);
#<<eof>>
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-03 19:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-03 16:44 [PATCH] root mount failure emit filesystems attempted Andy Whitcroft
2006-05-03 19:14 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox