You are not logged in.

#1 2014-04-04 04:48:43

jpgg
Member
Registered: 2014-01-15
Posts: 43

[Solved] Is mkinitcpio mounting more than root?

I am trying a new init which does not more than run my script. My script contains these lines :

...
mount -t proc proc /proc -o nosuid,noexec,nodev
mount -t sysfs sysfs /sys -o nosuid,noexec,nodev
mount -t devtmpfs dev /dev -o mode=0755,nosuid
...

On boot they output these messages :

mount: proc is already mounted or /proc busy
       proc is already mounted on /proc
mount: sysfs is already mounted or /sys busy
mount: dev is already mounted or /dev busy
       dev is already mounted on /dev

What mounted them? Is it mkinitcpio?

Reading mkinitcpio's code, I found this :

mount ${fstype:+-t $fstype} -o ${rwopt:-ro}${rootflags:+,$rootflags} "$root" "$1"

which I think translates to

mount -o rw /dev/sda2 /new_root

Last edited by jpgg (2014-04-04 19:08:47)

Offline

#2 2014-04-04 08:43:25

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: [Solved] Is mkinitcpio mounting more than root?

Maybe you missed the first few lines in /usr/lib/initcpio/init ?

Offline

#3 2014-04-04 08:46:23

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: [Solved] Is mkinitcpio mounting more than root?

mkinitcpio sets up /proc, /sys, /dev and /run.

Offline

#4 2014-04-04 19:08:29

jpgg
Member
Registered: 2014-01-15
Posts: 43

Re: [Solved] Is mkinitcpio mounting more than root?

I saw them. But this is not the real root.

The real root is mounted at the end of init on /new_root and and it switches to it with the last command switch_root.

I couldn't not find /proc, /dev and /sys mounted on /new_root before the call to switch_root.

However, I just read the manpage for switch_root and I found this :

switch_root  moves  already mounted /proc, /dev and /sys to newroot and makes newroot the new root filesystem and starts init process.

So, it was switch_root that was moving them on /new_root. Marked as [Solved] !

Offline

Board footer

Powered by FluxBB