From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Jens Axboe <axboe@kernel.dk>, Jonathan Corbet <corbet@lwn.net>
Cc: linux-block@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t()
Date: Sat, 9 Apr 2022 11:39:39 +0800 [thread overview]
Message-ID: <1649475581-12139-2-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1649475581-12139-1-git-send-email-yangtiezhu@loongson.cn>
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
next prev parent reply other threads:[~2022-04-09 3:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2022-04-11 15:55 ` [PATCH 1/3] init: print some info about UUID and LABEL in name_to_dev_t() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1649475581-12139-2-git-send-email-yangtiezhu@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=axboe@kernel.dk \
--cc=corbet@lwn.net \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).