Andrew Benton wrote:
> The problem is that nilfs-cleanerd looks in /proc/mounts to see which
> device node in /dev it should be working on. If you cat /proc/mounts
> you'll see that / is listed as /dev/root which doesn't exist on an
> LFS system so nilfs-cleanerd quits,

That's broken.  I'd file a bug with whoever wrote that code...  :-)

> The solution I devised is to create a symlink /dev/root pointing at
> the root partition. This has to be done before the filesystem is
> mounted.

Before the nilfs2 FS is mounted, I assume you mean.  Because it doesn't
make much difference whether the symlink exists before the rootfs is
mounted -- the kernel (or initramfs...) does that before any bootscripts
run, anyway.

> The kernel knows where the root is because it was passed it as an
> argument by grub, it's available in /proc/cmdline

Yes, but the value is not necessarily symlinkable: an NFS mount target
is not, for instance. I wouldn't be surprised if nilfs-cleanerd choked
on that as well; the best fix here (IMO) is to change nilfs-cleanerd to
special-case the rootfs, or (if that's impossible because your rootfs is
nilfs2) use an initramfs, since you'll need that anyway.

> Is there a simpler way to get awk to print all the fields at one go?
> Or would some other tool (perl?) be more appropriate? That's the main
> reason I wrote this email, for a bit of scripting advice.

Shouldn't be needed.  Relying on the presence of /dev/root on the actual
filesystem seems broken to me; it *only* exists in the case where the
kernel has its own internal "initramfs" type setup, which does have this
"file".  :-)

> Ideally I'd like udev to create the symlink, but I don't know how to
> do that. It'd have to grep /proc/cmdline for every disk partition.

See:

http://marc.info/?l=linux-hotplug&m=117715210620479&w=2

and:

http://marc.info/?l=linux-hotplug&m=117725092825439&w=2

for the udev side of things (unsurprisingly, this has come up before...
:-) ).  And indeed, on a system using an initramfs:

$ head -n 2 /proc/mounts
rootfs / rootfs rw 0 0
/dev/dm-6 / ext3 rw,relatime,errors=continue,data=journal 0 0

it looks fine.  (Well, "fine" inasmuch as /dev/dm-6 is the final device
node that the initramfs used.  It actually mounted one of the persistent
symlinks under /dev/disk/by-label/, but it looks like mount(8) resolved
that link itself, before calling into the kernel.)  I have no idea
whether nilfs-cleanerd will work here or not (given the "rootfs" entry).

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to