public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
* bcache-tools: changes to make the udev rules work
@ 2013-08-26  9:23 Rolf Fokkens
  2013-08-26 15:27 ` Gabriel de Perthuis
  0 siblings, 1 reply; 8+ messages in thread
From: Rolf Fokkens @ 2013-08-26  9:23 UTC (permalink / raw)
  To: linux-bcache-u79uwXL29TY76Z2rM5mHXA

Hi!

When making bcache tools run on Fedora I had to make some small tweaks 
on the udev rules file:

- first trying with blkid doesn't work, because it doesn't know about bcache
- full pathnames are needed, also for bcache-register because udev 
doesn't include /sbin and /usr/sbin in PATH.

This is the diff:

--- bcache-tools-20130820/61-bcache.rules.rules    2013-08-20 
22:03:46.000000000 +0200
+++ bcache-tools-20130820/61-bcache.rules    2013-08-25 
15:53:32.690312711 +0200
@@ -5,14 +5,14 @@
  ACTION=="remove", GOTO="bcache_end"

  # Backing devices: scan, symlink, register
-IMPORT{program}="/sbin/blkid -o udev $tempnode"
+#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode"
  # blkid and probe-bcache can disagree, in which case don't register
-ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
+#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", 
GOTO="bcache_backing_end"

-IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
+IMPORT{program}="/usr/sbin/probe-bcache -o udev $tempnode"
  ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
  SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \
-        RUN+="bcache-register $tempnode"
+        RUN+="/usr/lib/udev/bcache-register $tempnode"
  LABEL="bcache_backing_end"

  # Cached devices: symlink

Any feedback is welcome,

Rolf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
  2013-08-26  9:23 bcache-tools: changes to make the udev rules work Rolf Fokkens
@ 2013-08-26 15:27 ` Gabriel de Perthuis
  2013-08-26 21:01   ` Rolf Fokkens
  0 siblings, 1 reply; 8+ messages in thread
From: Gabriel de Perthuis @ 2013-08-26 15:27 UTC (permalink / raw)
  To: linux-bcache-u79uwXL29TY76Z2rM5mHXA

On Mon, 26 Aug 2013 11:23:32 +0200, Rolf Fokkens wrote:
> Hi!

Hello!

> When making bcache tools run on Fedora I had to make some small tweaks 
> on the udev rules file:
> 
> - first trying with blkid doesn't work, because it doesn't know about bcache
> - full pathnames are needed, also for bcache-register because udev 
> doesn't include /sbin and /usr/sbin in PATH.

The blkid check is to make sure that there isn't a non-bcache superblock.
blkid doesn't need to understand bcache for this.

Make path changes if you really need, but udev is supposed to find unqualified
paths like bcache-register in $udevlibdir ( /lib/udev on debian, possibly
/usr/lib/udev in fedora).

> This is the diff:
> 
> --- bcache-tools-20130820/61-bcache.rules.rules    2013-08-20 
> 22:03:46.000000000 +0200
> +++ bcache-tools-20130820/61-bcache.rules    2013-08-25 
> 15:53:32.690312711 +0200
> @@ -5,14 +5,14 @@
>   ACTION=="remove", GOTO="bcache_end"
> 
>   # Backing devices: scan, symlink, register
> -IMPORT{program}="/sbin/blkid -o udev $tempnode"
> +#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode"
>   # blkid and probe-bcache can disagree, in which case don't register
> -ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
> +#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", 
> GOTO="bcache_backing_end"

Those first two changes should be reverted.

> -IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
> +IMPORT{program}="/usr/sbin/probe-bcache -o udev $tempnode"

This change isn't broken, though you could make use of any /sbin
compat symlinks and not carry an upstream delta.

>   ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
>   SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \
> -        RUN+="bcache-register $tempnode"
> +        RUN+="/usr/lib/udev/bcache-register $tempnode"
>   LABEL="bcache_backing_end"

Unless there's been a change in udev, this change is unnecessary and
introduces a distro-specific path.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
  2013-08-26 15:27 ` Gabriel de Perthuis
@ 2013-08-26 21:01   ` Rolf Fokkens
       [not found]     ` <521BC237.9000802-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Rolf Fokkens @ 2013-08-26 21:01 UTC (permalink / raw)
  To: Gabriel de Perthuis; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

On 08/26/2013 05:27 PM, Gabriel de Perthuis wrote:
> Make path changes if you really need, but udev is supposed to find unqualified
> paths like bcache-register in $udevlibdir ( /lib/udev on debian, possibly
> /usr/lib/udev in fedora).
You're right; works fine without the full path.
>
>> This is the diff:
>>
>> --- bcache-tools-20130820/61-bcache.rules.rules    2013-08-20
>> 22:03:46.000000000 +0200
>> +++ bcache-tools-20130820/61-bcache.rules    2013-08-25
>> 15:53:32.690312711 +0200
>> @@ -5,14 +5,14 @@
>>    ACTION=="remove", GOTO="bcache_end"
>>
>>    # Backing devices: scan, symlink, register
>> -IMPORT{program}="/sbin/blkid -o udev $tempnode"
>> +#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode"
>>    # blkid and probe-bcache can disagree, in which case don't register
>> -ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
>> +#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache",
>> GOTO="bcache_backing_end"
> Those first two changes should be reverted.
I tried, but with the blkid check first my /dev/bcache* devices are not 
reliably created. I have 2 in total (/dev/bcache0 and /dev/bcach1) and 
with the blkid there's only one after any reboot. Although the name 
varies (bcache0 or bcache1) it actually is always the /dev/bcache* 
device for the 'second' bcache device that is created. second one means: 
the first one is the combi of /dev/sda3 & /dev/sdb1, the second one is 
the combi of /dev/sdc1 and /dev/sdd1. I'm not sure how I can figure out 
what's actually happening during boot.
>
>> -IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
>> +IMPORT{program}="/usr/sbin/probe-bcache -o udev $tempnode"
> This change isn't broken, though you could make use of any /sbin
> compat symlinks and not carry an upstream delta.
Moved back to using the symlinks, though later on ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
       [not found]     ` <521BC237.9000802-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
@ 2013-08-26 21:27       ` Gabriel de Perthuis
       [not found]         ` <521BC829.9080303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Gabriel de Perthuis @ 2013-08-26 21:27 UTC (permalink / raw)
  To: Rolf Fokkens; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

> I tried, but with the blkid check first my /dev/bcache* devices are
> not reliably created. I have 2 in total (/dev/bcache0 and
> /dev/bcach1) and with the blkid there's only one after any reboot.
> Although the name varies (bcache0 or bcache1) it actually is always
> the /dev/bcache* device for the 'second' bcache device that is
> created. second one means: the first one is the combi of /dev/sda3 &
> /dev/sdb1, the second one is the combi of /dev/sdc1 and /dev/sdd1.
> I'm not sure how I can figure out what's actually happening during
> boot.

Possibly /dev/sdc1 or /dev/sdd1 has a stray non-bcache superblock.

You can check with wipefs, and remove it with wipefs -a.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
       [not found]         ` <521BC829.9080303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-08-26 21:28           ` Gabriel de Perthuis
  2013-08-26 22:20           ` Rolf Fokkens
  1 sibling, 0 replies; 8+ messages in thread
From: Gabriel de Perthuis @ 2013-08-26 21:28 UTC (permalink / raw)
  To: Rolf Fokkens; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

>> I tried, but with the blkid check first my /dev/bcache* devices are
>> not reliably created. I have 2 in total (/dev/bcache0 and
>> /dev/bcach1) and with the blkid there's only one after any reboot.
>> Although the name varies (bcache0 or bcache1) it actually is always
>> the /dev/bcache* device for the 'second' bcache device that is
>> created. second one means: the first one is the combi of /dev/sda3 &
>> /dev/sdb1, the second one is the combi of /dev/sdc1 and /dev/sdd1.
>> I'm not sure how I can figure out what's actually happening during
>> boot.
>
> Possibly /dev/sdc1 or /dev/sdd1 has a stray non-bcache superblock.

(I mean the other two, your "first" pair)

> You can check with wipefs, and remove it with wipefs -a.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
       [not found]         ` <521BC829.9080303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2013-08-26 21:28           ` Gabriel de Perthuis
@ 2013-08-26 22:20           ` Rolf Fokkens
       [not found]             ` <521BD496.5060207-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Rolf Fokkens @ 2013-08-26 22:20 UTC (permalink / raw)
  To: Gabriel de Perthuis; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

On 08/26/2013 11:27 PM, Gabriel de Perthuis wrote:
> Possibly /dev/sdc1 or /dev/sdd1 has a stray non-bcache superblock.
You're right, see below. That was an ugly one.

Do you think having blkid identify bcache itself would have helped, or 
is there always a chance of contradictive signatures which may confuse  
blkid?
>
> You can check with wipefs, and remove it with wipefs -a.
The evidence:

[root@localhost ~]# wipefs /dev/sda3
[root@localhost ~]# wipefs /dev/sdb1
offset               type
----------------------------------------------------------------
0x218                LVM2_member   [raid]
                      UUID:  ZSSjZv-FU0H-Zeaa-92GU-37Zs-KyLS-JMF03Y

[root@localhost ~]# wipefs /dev/sdc1
[root@localhost ~]# wipefs /dev/sdd1
[root@localhost ~]# blkid /dev/sdb1
/dev/sdb1: UUID="ZSSjZv-FU0H-Zeaa-92GU-37Zs-KyLS-JMF03Y" TYPE="LVM2_member"
[root@localhost ~]#

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
       [not found]             ` <521BD496.5060207-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
@ 2013-08-26 22:46               ` Gabriel de Perthuis
  0 siblings, 0 replies; 8+ messages in thread
From: Gabriel de Perthuis @ 2013-08-26 22:46 UTC (permalink / raw)
  To: Rolf Fokkens; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

> You're right, see below. That was an ugly one.
> 
> Do you think having blkid identify bcache itself would have helped, 
> or is there always a chance of contradictive signatures which may 
> confuse  blkid?

make-bcache should use libblkid to detect existing superblocks,
and bail and recommend wipefs.

Support in the other direction (having libblkid support bcache) is just a
nice-to-have, and will maybe allow simplifying a few things in bcache-progs.
The udev rule is written not to break if libblkid gets bcache support, but
it can't really be simplified, we still want to detect stray superblocks
even if the latest tools can't create them.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bcache-tools: changes to make the udev rules work
       [not found]   ` <95A9778F-C617-4455-BBEC-23F0DB06072C-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
@ 2013-08-27  0:17     ` matthew patton
  0 siblings, 0 replies; 8+ messages in thread
From: matthew patton @ 2013-08-27  0:17 UTC (permalink / raw)
  To: Rolf Fokkens,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org


>The rationale is here:
>
>
>http://fedoraproject.org/wiki/Features/UsrMove


<quote>But, advanced features in today's systems can not really bootup with an empty /usr anymore. More and more fails in subtle ways in such setups.</quote>


What a crock of (#$@. "We broke the rules and now we're going to perpetuate the mistake because we can't be bothered to go fix our past screwups." Damn kids!! No one says it has to boot to network-aware multi user (init=3 or higher) without /usr but it damn well better post to single-user and be able to mount all "local" (ie non-network dependent) block devices without /usr. I swear, the work product out of RedHat gets worse every year.

>Might be very Fedora specific, so I can make a non-Fedora diff. And even on Fedora /sbin is a symlink to /usr/sbin so I might not have to assume the tools are  in /usr



Definitely do NOT assume they put stuff in /usr/sbin. Always use /sbin and if RedHat forgot something, make them fix their symlink abomination (what is this, Fedora aspires to be fscking Slowaris with /etc/init -> /sbin/init and holy hell breaks if you don't have the /etc/init link?).

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-27  0:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26  9:23 bcache-tools: changes to make the udev rules work Rolf Fokkens
2013-08-26 15:27 ` Gabriel de Perthuis
2013-08-26 21:01   ` Rolf Fokkens
     [not found]     ` <521BC237.9000802-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-26 21:27       ` Gabriel de Perthuis
     [not found]         ` <521BC829.9080303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-26 21:28           ` Gabriel de Perthuis
2013-08-26 22:20           ` Rolf Fokkens
     [not found]             ` <521BD496.5060207-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-26 22:46               ` Gabriel de Perthuis
     [not found] <1377516018.51534.YahooMailAndroidMobile@web181503.mail.ne1.yahoo.com>
     [not found] ` <95A9778F-C617-4455-BBEC-23F0DB06072C@rolffokkens.nl>
     [not found]   ` <95A9778F-C617-4455-BBEC-23F0DB06072C-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-27  0:17     ` matthew patton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox