How is modprobe run before mounting root? (no initrd)
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am booting linux mint(version 4.14.13+) without using initrd
/initramfs
, and I see that /sbin/modprobe
is run before mounting the root file system. I was wondering how that is possible. I instrumented the kernel to printk
whenever file system is used and that's how I know that /sbin/modprobe
was used.
The following link contains the full dmesg
output of my boot: dmesg output
[ 3.175001] Used file system /sbin/modprobe!
[ 3.179080] Used file system /dev/console!
[ 3.844276] Used file system /dev/md0!
[ 3.899302] VFS: Mounted root (ext4 filesystem) on device 8:17.
[ 3.951578] devtmpfs: mounted
[ 3.987527] Used file system /bin/sh!
linux mount boot modprobe
add a comment |Â
up vote
1
down vote
favorite
I am booting linux mint(version 4.14.13+) without using initrd
/initramfs
, and I see that /sbin/modprobe
is run before mounting the root file system. I was wondering how that is possible. I instrumented the kernel to printk
whenever file system is used and that's how I know that /sbin/modprobe
was used.
The following link contains the full dmesg
output of my boot: dmesg output
[ 3.175001] Used file system /sbin/modprobe!
[ 3.179080] Used file system /dev/console!
[ 3.844276] Used file system /dev/md0!
[ 3.899302] VFS: Mounted root (ext4 filesystem) on device 8:17.
[ 3.951578] devtmpfs: mounted
[ 3.987527] Used file system /bin/sh!
linux mount boot modprobe
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am booting linux mint(version 4.14.13+) without using initrd
/initramfs
, and I see that /sbin/modprobe
is run before mounting the root file system. I was wondering how that is possible. I instrumented the kernel to printk
whenever file system is used and that's how I know that /sbin/modprobe
was used.
The following link contains the full dmesg
output of my boot: dmesg output
[ 3.175001] Used file system /sbin/modprobe!
[ 3.179080] Used file system /dev/console!
[ 3.844276] Used file system /dev/md0!
[ 3.899302] VFS: Mounted root (ext4 filesystem) on device 8:17.
[ 3.951578] devtmpfs: mounted
[ 3.987527] Used file system /bin/sh!
linux mount boot modprobe
I am booting linux mint(version 4.14.13+) without using initrd
/initramfs
, and I see that /sbin/modprobe
is run before mounting the root file system. I was wondering how that is possible. I instrumented the kernel to printk
whenever file system is used and that's how I know that /sbin/modprobe
was used.
The following link contains the full dmesg
output of my boot: dmesg output
[ 3.175001] Used file system /sbin/modprobe!
[ 3.179080] Used file system /dev/console!
[ 3.844276] Used file system /dev/md0!
[ 3.899302] VFS: Mounted root (ext4 filesystem) on device 8:17.
[ 3.951578] devtmpfs: mounted
[ 3.987527] Used file system /bin/sh!
linux mount boot modprobe
edited Jul 13 at 22:56
sourcejedi
18k22375
18k22375
asked Jul 10 at 15:06
systolicDrake
505
505
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I don't think it is successfully running /sbin/modprobe
. But there is something that interested me here. It looks like it tries to open /dev/console
before "devtmpfs: mounted" or "Mounted root (ext4 filesystem)", and there is no other attempt to open /dev/console
. But I thought the kernel had to open /dev/console
from some filesystem for init (/bin/sh in your case)...
It looks like if you do not have an initramfs, the kernel creates a very simple fake one. If I'm following correctly, this is why it can open /dev/console
before it has mounted a real root filesystem.
https://github.com/torvalds/linux/blob/v4.14/init/noinitramfs.c
/*
* Create a simple rootfs that is similar to the default initramfs
*/
static int __init default_rootfs(void)
{
int err;
err = sys_mkdir((const char __user __force *) "/dev", 0755);
if (err < 0)
goto out;
err = sys_mknod((const char __user __force *) "/dev/console",
S_IFCHR | S_IRUSR | S_IWUSR,
new_encode_dev(MKDEV(5, 1)));
if (err < 0)
goto out;
err = sys_mkdir((const char __user __force *) "/root", 0700);
if (err < 0)
goto out;
return 0;
The /root
directory is relied on elsewhere in the kernel code, to mount and transition into the real root=
filesystem.
The commit that introduces this function clarifies that this specific function is only used when both initrd and initramfs support are compiled out. So otherwise, the "default initramfs" would provide the /dev/console
and /root
, if you did not pass a specific initramfs when booting the kernel, and you did not specify an initramfs to be built-in to the kernel.
https://github.com/torvalds/linux/commit/c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I don't think it is successfully running /sbin/modprobe
. But there is something that interested me here. It looks like it tries to open /dev/console
before "devtmpfs: mounted" or "Mounted root (ext4 filesystem)", and there is no other attempt to open /dev/console
. But I thought the kernel had to open /dev/console
from some filesystem for init (/bin/sh in your case)...
It looks like if you do not have an initramfs, the kernel creates a very simple fake one. If I'm following correctly, this is why it can open /dev/console
before it has mounted a real root filesystem.
https://github.com/torvalds/linux/blob/v4.14/init/noinitramfs.c
/*
* Create a simple rootfs that is similar to the default initramfs
*/
static int __init default_rootfs(void)
{
int err;
err = sys_mkdir((const char __user __force *) "/dev", 0755);
if (err < 0)
goto out;
err = sys_mknod((const char __user __force *) "/dev/console",
S_IFCHR | S_IRUSR | S_IWUSR,
new_encode_dev(MKDEV(5, 1)));
if (err < 0)
goto out;
err = sys_mkdir((const char __user __force *) "/root", 0700);
if (err < 0)
goto out;
return 0;
The /root
directory is relied on elsewhere in the kernel code, to mount and transition into the real root=
filesystem.
The commit that introduces this function clarifies that this specific function is only used when both initrd and initramfs support are compiled out. So otherwise, the "default initramfs" would provide the /dev/console
and /root
, if you did not pass a specific initramfs when booting the kernel, and you did not specify an initramfs to be built-in to the kernel.
https://github.com/torvalds/linux/commit/c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f
add a comment |Â
up vote
0
down vote
I don't think it is successfully running /sbin/modprobe
. But there is something that interested me here. It looks like it tries to open /dev/console
before "devtmpfs: mounted" or "Mounted root (ext4 filesystem)", and there is no other attempt to open /dev/console
. But I thought the kernel had to open /dev/console
from some filesystem for init (/bin/sh in your case)...
It looks like if you do not have an initramfs, the kernel creates a very simple fake one. If I'm following correctly, this is why it can open /dev/console
before it has mounted a real root filesystem.
https://github.com/torvalds/linux/blob/v4.14/init/noinitramfs.c
/*
* Create a simple rootfs that is similar to the default initramfs
*/
static int __init default_rootfs(void)
{
int err;
err = sys_mkdir((const char __user __force *) "/dev", 0755);
if (err < 0)
goto out;
err = sys_mknod((const char __user __force *) "/dev/console",
S_IFCHR | S_IRUSR | S_IWUSR,
new_encode_dev(MKDEV(5, 1)));
if (err < 0)
goto out;
err = sys_mkdir((const char __user __force *) "/root", 0700);
if (err < 0)
goto out;
return 0;
The /root
directory is relied on elsewhere in the kernel code, to mount and transition into the real root=
filesystem.
The commit that introduces this function clarifies that this specific function is only used when both initrd and initramfs support are compiled out. So otherwise, the "default initramfs" would provide the /dev/console
and /root
, if you did not pass a specific initramfs when booting the kernel, and you did not specify an initramfs to be built-in to the kernel.
https://github.com/torvalds/linux/commit/c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I don't think it is successfully running /sbin/modprobe
. But there is something that interested me here. It looks like it tries to open /dev/console
before "devtmpfs: mounted" or "Mounted root (ext4 filesystem)", and there is no other attempt to open /dev/console
. But I thought the kernel had to open /dev/console
from some filesystem for init (/bin/sh in your case)...
It looks like if you do not have an initramfs, the kernel creates a very simple fake one. If I'm following correctly, this is why it can open /dev/console
before it has mounted a real root filesystem.
https://github.com/torvalds/linux/blob/v4.14/init/noinitramfs.c
/*
* Create a simple rootfs that is similar to the default initramfs
*/
static int __init default_rootfs(void)
{
int err;
err = sys_mkdir((const char __user __force *) "/dev", 0755);
if (err < 0)
goto out;
err = sys_mknod((const char __user __force *) "/dev/console",
S_IFCHR | S_IRUSR | S_IWUSR,
new_encode_dev(MKDEV(5, 1)));
if (err < 0)
goto out;
err = sys_mkdir((const char __user __force *) "/root", 0700);
if (err < 0)
goto out;
return 0;
The /root
directory is relied on elsewhere in the kernel code, to mount and transition into the real root=
filesystem.
The commit that introduces this function clarifies that this specific function is only used when both initrd and initramfs support are compiled out. So otherwise, the "default initramfs" would provide the /dev/console
and /root
, if you did not pass a specific initramfs when booting the kernel, and you did not specify an initramfs to be built-in to the kernel.
https://github.com/torvalds/linux/commit/c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f
I don't think it is successfully running /sbin/modprobe
. But there is something that interested me here. It looks like it tries to open /dev/console
before "devtmpfs: mounted" or "Mounted root (ext4 filesystem)", and there is no other attempt to open /dev/console
. But I thought the kernel had to open /dev/console
from some filesystem for init (/bin/sh in your case)...
It looks like if you do not have an initramfs, the kernel creates a very simple fake one. If I'm following correctly, this is why it can open /dev/console
before it has mounted a real root filesystem.
https://github.com/torvalds/linux/blob/v4.14/init/noinitramfs.c
/*
* Create a simple rootfs that is similar to the default initramfs
*/
static int __init default_rootfs(void)
{
int err;
err = sys_mkdir((const char __user __force *) "/dev", 0755);
if (err < 0)
goto out;
err = sys_mknod((const char __user __force *) "/dev/console",
S_IFCHR | S_IRUSR | S_IWUSR,
new_encode_dev(MKDEV(5, 1)));
if (err < 0)
goto out;
err = sys_mkdir((const char __user __force *) "/root", 0700);
if (err < 0)
goto out;
return 0;
The /root
directory is relied on elsewhere in the kernel code, to mount and transition into the real root=
filesystem.
The commit that introduces this function clarifies that this specific function is only used when both initrd and initramfs support are compiled out. So otherwise, the "default initramfs" would provide the /dev/console
and /root
, if you did not pass a specific initramfs when booting the kernel, and you did not specify an initramfs to be built-in to the kernel.
https://github.com/torvalds/linux/commit/c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f
edited Jul 13 at 22:58
answered Jul 12 at 14:49
sourcejedi
18k22375
18k22375
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454511%2fhow-is-modprobe-run-before-mounting-root-no-initrd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password