All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Modify some code about root=UUID or root=LABEL
@ 2022-04-09  3:39 Tiezhu Yang
  2022-04-09  3:39 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() Tiezhu Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tiezhu Yang @ 2022-04-09  3:39 UTC (permalink / raw)
  To: Jens Axboe, Jonathan Corbet; +Cc: linux-block, linux-doc, linux-kernel

Tiezhu Yang (3):
  init: print some info about UUID and LABEL in name_to_dev_t()
  docs: kernel-parameters: update description of root=
  block: print correct sectors in printk_all_partitions()

 Documentation/admin-guide/kernel-parameters.txt | 1 +
 block/genhd.c                                   | 2 +-
 init/do_mounts.c                                | 8 ++++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t()
  2022-04-09  3:39 [PATCH 0/3] Modify some code about root=UUID or root=LABEL Tiezhu Yang
@ 2022-04-09  3:39 ` Tiezhu Yang
  2022-04-11 15:55   ` Christoph Hellwig
  2022-04-09  3:39 ` [PATCH 2/3] docs: kernel-parameters: update description of root= Tiezhu Yang
  2022-04-09  3:39 ` [PATCH 3/3] block: print correct sectors in printk_all_partitions() Tiezhu Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2022-04-09  3:39 UTC (permalink / raw)
  To: Jens Axboe, Jonathan Corbet; +Cc: linux-block, linux-doc, linux-kernel

If there is no valid initrd, but root=UUID or root=LABEL is used
in the command line, boot hangs like this:

[    5.739815] VFS: Cannot open root device "UUID=19957230-2e15-494c-8dfa-84aab3591961" or unknown-block(0,0): error -6
[    5.750280] Please append a correct "root=" boot option; here are the available partitions:
[    5.856059] 0800       125034840 sda
[    5.856061]  driver: sd
[    5.862124]   0801          307200 sda1 d5077411-3d87-4f85-b312-8cc309ef9073
[    5.862128]
[    5.870603]   0802         1048576 sda2 aae0dd30-e5f5-44e1-994e-d47bf5ce2e52
[    5.870606]
[    5.879080]   0803        52428800 sda3 759079ee-85fa-4636-9de7-1ac0643ab87e
[    5.879083]
[    5.887558]   0804         8388608 sda4 439c4b0a-7b4f-4434-82f1-f9d380b55fb9
[    5.887560]
[    5.896035]   0805        62860288 sda5 ee52e951-1315-4fab-a3e5-45c6eeae6ce6
[    5.910575] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    5.918796] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

The above log is very useful, but some users still need time
to analysis the cause [1, 2]. It is better to print some info
to explicitly tell the users root=UUID or root=LABEL is not
supported without initrd.

[1] https://unix.stackexchange.com/questions/93767/why-cant-i-specify-my-root-fs-with-a-uuid
[2] https://unix.stackexchange.com/questions/302795/how-to-identify-root-partition-via-uuid-without-initramfs-initrd

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 init/do_mounts.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 7058e14..2c1c492 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -290,6 +290,14 @@ dev_t name_to_dev_t(const char *name)
 	if (strncmp(name, "/dev/", 5) == 0)
 		return devt_from_devname(name + 5);
 #endif
+	if (strncmp(name, "UUID=", 5) == 0) {
+		pr_info("root=UUID is not supported without initrd\n");
+		return 0;
+	}
+	if (strncmp(name, "LABEL=", 6) == 0) {
+		pr_info("root=LABEL is not supported without initrd\n");
+		return 0;
+	}
 	return devt_from_devnum(name);
 }
 EXPORT_SYMBOL_GPL(name_to_dev_t);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] docs: kernel-parameters: update description of root=
  2022-04-09  3:39 [PATCH 0/3] Modify some code about root=UUID or root=LABEL Tiezhu Yang
  2022-04-09  3:39 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() Tiezhu Yang
@ 2022-04-09  3:39 ` Tiezhu Yang
  2022-04-11 15:56   ` Christoph Hellwig
  2022-04-09  3:39 ` [PATCH 3/3] block: print correct sectors in printk_all_partitions() Tiezhu Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2022-04-09  3:39 UTC (permalink / raw)
  To: Jens Axboe, Jonathan Corbet; +Cc: linux-block, linux-doc, linux-kernel

root=UUID or root=LABEL is not supported without initrd.
It is better to update description of root= to explicitly
tell the users.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 Documentation/admin-guide/kernel-parameters.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 3f1cc5e..c3eb142 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5120,6 +5120,7 @@
 			port and the regular usb controller gets disabled.
 
 	root=		[KNL] Root filesystem
+			root=UUID or root=LABEL is not supported without initrd.
 			See name_to_dev_t comment in init/do_mounts.c.
 
 	rootdelay=	[KNL] Delay (in seconds) to pause before attempting to
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] block: print correct sectors in printk_all_partitions()
  2022-04-09  3:39 [PATCH 0/3] Modify some code about root=UUID or root=LABEL Tiezhu Yang
  2022-04-09  3:39 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() Tiezhu Yang
  2022-04-09  3:39 ` [PATCH 2/3] docs: kernel-parameters: update description of root= Tiezhu Yang
@ 2022-04-09  3:39 ` Tiezhu Yang
  2022-04-11 15:57   ` Christoph Hellwig
  2 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2022-04-09  3:39 UTC (permalink / raw)
  To: Jens Axboe, Jonathan Corbet; +Cc: linux-block, linux-doc, linux-kernel

If there is no valid initrd, but root=UUID or root=LABEL is used
in the command line, boot hangs like this:

[    5.739815] VFS: Cannot open root device "UUID=19957230-2e15-494c-8dfa-84aab3591961" or unknown-block(0,0): error -6
[    5.750280] Please append a correct "root=" boot option; here are the available partitions:
[    5.856059] 0800       125034840 sda
[    5.856061]  driver: sd
[    5.862124]   0801          307200 sda1 d5077411-3d87-4f85-b312-8cc309ef9073
[    5.862128]
[    5.870603]   0802         1048576 sda2 aae0dd30-e5f5-44e1-994e-d47bf5ce2e52
[    5.870606]
[    5.879080]   0803        52428800 sda3 759079ee-85fa-4636-9de7-1ac0643ab87e
[    5.879083]
[    5.887558]   0804         8388608 sda4 439c4b0a-7b4f-4434-82f1-f9d380b55fb9
[    5.887560]
[    5.896035]   0805        62860288 sda5 ee52e951-1315-4fab-a3e5-45c6eeae6ce6
[    5.910575] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    5.918796] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

In the above log, the sectors are not consistent with the output
of fdisk command, fix it.

[root@linux loongson]# fdisk -l /dev/sda

Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 01D1BA1C-232F-45CA-AC12-0AF2A5D8CE0D

Device         Start       End   Sectors  Size Type
/dev/sda1       2048    616447    614400  300M EFI System
/dev/sda2     616448   2713599   2097152    1G Linux filesystem
/dev/sda3    2713600 107571199 104857600   50G Linux filesystem
/dev/sda4  107571200 124348415  16777216    8G Linux swap
/dev/sda5  124348416 250068991 125720576   60G Linux filesystem

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 block/genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index b8b6759..453ce42 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -761,7 +761,7 @@ void __init printk_all_partitions(void)
 			printk("%s%s %10llu %pg %s",
 			       bdev_is_partition(part) ? "  " : "",
 			       bdevt_str(part->bd_dev, devt_buf),
-			       bdev_nr_sectors(part) >> 1, part,
+			       bdev_nr_sectors(part), part,
 			       part->bd_meta_info ?
 					part->bd_meta_info->uuid : "");
 			if (bdev_is_partition(part))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t()
  2022-04-09  3:39 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() Tiezhu Yang
@ 2022-04-11 15:55   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2022-04-11 15:55 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jens Axboe, Jonathan Corbet, linux-block, linux-doc, linux-kernel

On Sat, Apr 09, 2022 at 11:39:39AM +0800, Tiezhu Yang wrote:
> If there is no valid initrd, but root=UUID or root=LABEL is used
> in the command line, boot hangs like this:

There is no root=UUID or root=LABEL handling in the kernel at all, so
I don't see why we should print anything here.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] docs: kernel-parameters: update description of root=
  2022-04-09  3:39 ` [PATCH 2/3] docs: kernel-parameters: update description of root= Tiezhu Yang
@ 2022-04-11 15:56   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2022-04-11 15:56 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jens Axboe, Jonathan Corbet, linux-block, linux-doc, linux-kernel

On Sat, Apr 09, 2022 at 11:39:40AM +0800, Tiezhu Yang wrote:
> root=UUID or root=LABEL is not supported without initrd.
> It is better to update description of root= to explicitly
> tell the users.

These are not supported at all by the kernel.  Maybe some code running
in an initramfs might do some magic with these, but they have no meaning
for the kernel and shouldn't really be documented here.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] block: print correct sectors in printk_all_partitions()
  2022-04-09  3:39 ` [PATCH 3/3] block: print correct sectors in printk_all_partitions() Tiezhu Yang
@ 2022-04-11 15:57   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2022-04-11 15:57 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jens Axboe, Jonathan Corbet, linux-block, linux-doc, linux-kernel

On Sat, Apr 09, 2022 at 11:39:41AM +0800, Tiezhu Yang wrote:
> In the above log, the sectors are not consistent with the output
> of fdisk command, fix it.

It is however consistent with the output of /proc/partitions.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-11 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09  3:39 [PATCH 0/3] Modify some code about root=UUID or root=LABEL Tiezhu Yang
2022-04-09  3:39 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() Tiezhu Yang
2022-04-11 15:55   ` Christoph Hellwig
2022-04-09  3:39 ` [PATCH 2/3] docs: kernel-parameters: update description of root= Tiezhu Yang
2022-04-11 15:56   ` Christoph Hellwig
2022-04-09  3:39 ` [PATCH 3/3] block: print correct sectors in printk_all_partitions() Tiezhu Yang
2022-04-11 15:57   ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.