Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#18355 - [mkinitcpio.git] Trying to use mount hook with archiso

Attached to Project: Arch Linux
Opened by Gerardo Exequiel Pozzi (djgera) - Tuesday, 16 February 2010, 02:20 GMT
Last edited by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 21:02 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I wrote a patch to archiso to work with recent changes to mkinitcpio to support mount hooks.

archiso hook works, all is mounted fine, but the only issue is at init script when testing with stat, from the shell I can kill udevd, umount proc and sys, and continue manually executing switch_root.

Here is the problem, stat return the same number.
/ # stat -f -c %i /
0
/ # stat -f -c %i /new_root
0

can be this test replaced (or maybe OR'ed) by %t/%T? this returns differents numbers.

/ # cat /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sys /sys sysfs rw,relatime 0 0
tmpfs /tmpfs tmpfs rw,relatime,size=93040k 0 0
/dev/archiso /bootmnt udf ro,relatime,utf8 0 0
none /new_root aufs rw,relatime,si=7466434 0 0
/dev/loop0 /tmpfs/mnt/loop0 squashfs ro,relatime 0 0
/dev/loop1 /tmpfs/mnt/loop1 squashfs ro,relatime 0 0
/dev/archiso /new_root/bootmnt udf ro,relatime,utf8 0 0

Thanks in advance.
This task depends upon

Closed by  Thomas Bächler (brain0)
Tuesday, 16 February 2010, 21:02 GMT
Reason for closing:  Fixed
Additional comments about closing:  Thanks, further patches for archiso to the mailing list please.
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 16 February 2010, 03:03 GMT
This is my idea, just AND other two test one with %t and %T, maybe having three test are a bit redundant...
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 08:20 GMT
I was afraid of that: The file system ID should be different, but in fact isn't. It's probably the filesystem ID of the upper layer, which is tmpfs, which always has id 0. Any other idea how we can determine whether something is a mount point?
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 08:23 GMT
One more comment on a quick glance: a mount handler accepts the path to the new root as its first argument, you should use that instead of hardcoding /new_root.
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 08:32 GMT
Gerardo, try stat -c %D (without -f) - this returns st_dev from the stat()/lstat() system call instead of statfs() - and it is exactly what busybox/swich_root uses to determine whether it is descending into a different file systems. Even two tmpfs systems have different IDs here.
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 19:18 GMT Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 16 February 2010, 19:37 GMT
Yes, thanks I aware of that parameter, like my previuos patch (usage of blkid) the intention was just for work! :), I am now going to details.

Just tested now, yes, works fine in a more trivial way. Thanks!

/ # stat -c %D /
1
/ # stat -c %D /new_root/
d

PS1: You have bested me in the reply, I was just picking up the chroot and creating the iso: P
PS2: Unrelated note: $PS1 does not take effect, need an export ;)
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 16 February 2010, 20:12 GMT
OK I considere this as closed. Thanks again.

This patch with usage of $1 parameter is implemented now in this commit [#1], boot really nice :)

[#1] http://github.com/djgera/archiso/commit/b880be1ae9d5fc2190d4e2178626776aecfa5243
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 20:13 GMT
Hmm, $PS1 takes effect in all tests here, but maybe I am wrong. export doesn't hurt though.

Still, the mount handler needs to use $1 as the mount point, not a hard coded value. Thus the _mnt_* functions also need to take the mount path as their first argument. Can you send a fixed patch with that?
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 16 February 2010, 20:17 GMT
mmm I don't see "ramfs" in prompt.

As you can see I implemented the parameter via new variable, or you prefer to pass the argument? I can do that, no problem., so current _mnt_ functions will have three params.
Comment by Thomas Bächler (brain0) - Tuesday, 16 February 2010, 20:39 GMT
I added the "export" already.

I'd like an extra parameter better, it's more consistent this way.

Loading...