:: Re: [Dng] Fwd: [dng] vdev status up…
Página Principal
Delete this message
Reply to this message
Autor: Jude Nelson
Data:  
Para: Anto, dng@lists.dyne.org
Assunto: Re: [Dng] Fwd: [dng] vdev status update
Hi Anto,

I just committed preliminary support for using vdevd with devtmpfs. vdevd
should automatically detect whether or not devtmpfs is mounted on /dev, and
nevertheless run device setup scripts (by using its own device metadata
tree in /dev/vdev/ to see whether or not the device was actually
processed).

NB for developers: this problem isn't specific to Linux--I expect to
encounter it with FreeBSD as well, since it has a full-blown in-kernel
devfs. vdevd will keep track of "OS quirks" in the future--one of which is
the "Device Already Exists" quirk, whereby vdevd simply expects the OS to
provide the device file (regardless of the mechanism). The Linux-specific
vdevd back-end now checks to see if vdevd will create files on a devtmpfs
filesystem, and enables that quirk if so.

Funny, undocumented (!!) discovery: the devtmpfs filesystem type (see
statfs(2)) is the same (!!) as the tmpfs filesystem type, despite being a
fundamentally different filesystem. I'm surprised that this wasn't caught
during the devtmpfs code review--guess I'll have to file a bug report.
Anyway, if you find yourself wondering why vdev has to detect devtmpfs by
parsing /proc/mounts and verifying that the realpath of the mountpoint is
the same as or is a subdirectory of a devtmpfs mountpoint, that's why--we
(currently) can't rely on the f_fsid in statfs(2) or statvfs(2).

Thanks,
Jude

On Thu, Apr 16, 2015 at 8:28 PM, Jude Nelson <judecn@???> wrote:

> Hi Anto,
>
> [snip]
>
>> I am not really sure if I understood what you explained. I don't think I
>> have devtmpfs on my PC when I use the working initrd. The one mounted on
>> /dev with the type of devtmpfs is udev. Here are the output of mount and
>> the content of my fstab.
>>
>> root@hp8530w:~# uname -a
>> Linux hp8530w 3.18.11-1v1-hp8530w #1 SMP Wed Apr 15 00:49:22 CEST 2015
>> x86_64 GNU/Linux
>> root@hp8530w:~#
>> root@hp8530w:~# mount
>> sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
>> proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
>> udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_
>> inodes=492536,mode=755)
>> devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,
>> gid=5,mode=620,ptmxmode=000)
>> tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,
>> size=401084k,mode=755)
>> /dev/disk/by-uuid/c0e1e620-5636-48f2-90dd-4d246d58b815 on / type ext4
>> (rw,relatime,errors=remount-ro,data=ordered)
>> tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,
>> relatime,size=5120k)
>> tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,
>> relatime,size=1641020k)
>> fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
>> /dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
>> root@hp8530w:~#
>>
>
> You have devtmpfs mounted. It's this line here:
>
> > udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_
> inodes=492536,mode=755)
>
> If you run "mount" while in the initramfs, you might see devtmpfs as
> well. If so, then please make sure that you're using vdev's initramfs
> "init" script in example/initramfs/init, instead of the one in
> /usr/share/initramfs-tools/init. Vdev's init does not mount devtmpfs, but
> initramfs-tool's init does. Devtmpfs cannot be mounted on /dev while vdev
> is running (but I'll fix this soon).
>
>
>> root@hp8530w:~# cat /etc/fstab
>> # /etc/fstab: static file system information.
>> #
>> # Use 'blkid' to print the universally unique identifier for a
>> # device; this may be used with UUID= as a more robust way to name devices
>> # that works even if disks are added and removed. See fstab(5).
>> #
>> # <file system> <mount point>   <type> <options>       <dump>  <pass>
>> # / was on /dev/sda1 during installation
>> UUID=c0e1e620-5636-48f2-90dd-4d246d58b815 /               ext4
>> errors=remount-ro 0       1
>> # /home was on /dev/sda2 during installation
>> UUID=5be7af77-0d10-4685-989f-1004b1eabec8 /home           ext4 defaults
>>       0       2
>> # swap was on /dev/sda3 during installation
>> UUID=3a37a27d-84cc-4d06-9920-5419bb4ccbae none            swap sw
>>       0       0
>> # /dev/sr0        /media/cdrom0   udf,iso9660 user,noauto 0       0
>> /dev/cdrom1        /media/cdrom0   udf,iso9660 user,noauto 0       0
>> # /dev/cdrom        /media/cdrom0   udf,iso9660 user,noauto 0       0
>> root@hp8530w:~#

>
>
> This is more evidence to me that the reason you got dropped into a shell
> in the initramfs was because vdev saw the /dev/sd* device files from
> devtmpfs, and (incorrectly) thought that they had already been processed
> and thus didn't go on to generate /dev/disk/by-uuid/c0e1e620-5636-48f2-90dd-4d246d58b815,
> /dev/disk/by-uuid/5be7af77-0d10-4685-989f-1004b1eabec8, and
> /dev/disk/by-uuid/3a37a27d-84cc-4d06-9920-5419bb4ccbae. Again, the fix
> for now is to ensure that devtmpfs isn't mounted :)
>
>
>>
>>
>> For those who don't know, devtmpfs is basically a no-frills devfs that
>>> modern udev now requires to be mounted to work correctly (i.e. devtmpfs
>>> makes the device files these days, not udev). vdevd is currently not
>>> compatible with devtmpfs, since it expects to create all the device files
>>> itself. I'll update the Linux port to check of devtmpfs is mounted before
>>> running, so vdevd will still run the helper scripts even if devtmpfs
>>> created the device files already.
>>>
>>>     I am not sure if this would be relevant. I am using file-rc
>>>     instead of sysv-rc, so I didn't actually have any /etc/rc?.d
>>>     directories. After the installation of the "example", /etc/rcS.d
>>>     directory and S02vdev link under it got created. It could possibly
>>>     be a problem later on, but I think I will worry about that (add it
>>>     into /etc/runlevel.conf) after the boot process can reach it.

>>>
>>>
>>> That is relevant! I had assumed in the Makefile that the user is using
>>> sysv-rc, with the /etc/rc*.d/ directories.
>>>
>>> I'm not familiar with using file-rc, but I don't think it's involved in
>>> the initramfs boot process (at least, not directly). That's all controlled
>>> by the files in /usr/share/initramfs-tools/. However, I'd be happy to
>>> patch the Makefile in example/ to install the vdev init script correctly
>>> for file-rc users :) I just need to know what to do--could you maybe send
>>> me a small script that would achieve this?
>>>
>>> Thanks again,
>>> Jude
>>>
>>>
>> A small script? I am just a user so I didn't create any scripts for
>> file-rc. :) Perhaps you can find the scripts that you are after on
>> http://ftp.debian.org/debian/pool/main/f/file-rc/file-rc_0.8.15_all.deb,
>> as that is the one I use and I don't modify anything.
>>
>> root@hp8530w:~# apt-cache policy file-rc
>> file-rc:
>>   Installed: 0.8.15
>>   Candidate: 0.8.15
>>   Version table:
>>  *** 0.8.15 0
>>         870 http://ftp.debian.org/debian/ wheezy/main amd64 Packages
>>         100 /var/lib/dpkg/status
>> root@hp8530w:~#

>>
>> Let's just worry about file-rc and sysv-rc later on after we can pass
>> initramfs. How about that?
>>
>
> Sounds good :) I'll take a look at file-rc.
>
>
>>
>> I have a plan this week end to dust off my Mini-ITX PC to be used for
>> properly testing your vdev (or any Devuan packages), instead of using my
>> notebook. So I can use sysv-rc and any packages that will make you easier
>> to develop your vdev. I will post that on different topic later on.
>>
>
> I look forward to it! Thanks again for your help!
>
> -Jude
>