Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #195870 > unrolled thread
| Started by | Bhasker C V <bhasker@unixindia.com> |
|---|---|
| First post | 2018-05-18 10:50 +0200 |
| Last post | 2018-05-18 14:00 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.debian.user
Help with udev trigger Bhasker C V <bhasker@unixindia.com> - 2018-05-18 10:50 +0200
Re: Help with udev trigger Reco <recoverym4n@gmail.com> - 2018-05-18 13:40 +0200
Re: Help with udev trigger Bhasker C V <bhasker@unixindia.com> - 2018-05-21 10:40 +0200
Re: Help with udev trigger songbird <songbird@anthive.com> - 2018-05-18 14:00 +0200
| From | Bhasker C V <bhasker@unixindia.com> |
|---|---|
| Date | 2018-05-18 10:50 +0200 |
| Subject | Help with udev trigger |
| Message-ID | <vQJfj-gT-3@gated-at.bofh.it> |
Hi, Version: buster I do a manual cryptsetup to create my home directory after system boots up I want to run fsck every time the device node is created from luks I added this udev rule ACTION="change",DEVTYPE="disk",ID_FS_UUID="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5" RUN+="/bin/btrfsck /dev/mapper/home" But this rule is not getting triggered. Could someone help please to point out what mistake I am doing ? The following is what I get when the device is added from which I deduced the above trigger line UDEV [3110.764972] change /devices/virtual/block/dm-12 (block) .ID_FS_TYPE_NEW=btrfs ACTION=change DEVLINKS=/dev/disk/by-id/dm-uuid-CRYPT-LUKS1-f064023b1b2d41639634f5bdf2430794-home /dev/disk/by-id/dm-name-home /dev/disk/by-uuid/cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5 /dev/mapper/home DEVNAME=/dev/dm-12 DEVPATH=/devices/virtual/block/dm-12 DEVTYPE=disk DM_ACTIVATION=1 DM_COOKIE=6306419 DM_NAME=home DM_STATE=ACTIVE DM_SUSPENDED=0 DM_TABLE_STATE=LIVE DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1 DM_UDEV_PRIMARY_SOURCE_FLAG=1 DM_UDEV_RULES=1 DM_UDEV_RULES_VSN=2 DM_UUID=CRYPT-LUKS1-f064023b1b2d41639634f5bdf2430794-home ID_BTRFS_READY=1 ID_FS_TYPE=btrfs ID_FS_USAGE=filesystem ID_FS_UUID=cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5 ID_FS_UUID_ENC=cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5 ID_FS_UUID_SUB=6e20311a-a369-4929-9e40-44b63e3eb563 ID_FS_UUID_SUB_ENC=6e20311a-a369-4929-9e40-44b63e3eb563 MAJOR=253 MINOR=12 SEQNUM=2242 SUBSYSTEM=block TAGS=:systemd: USEC_INITIALIZED=3110669103
[toc] | [next] | [standalone]
| From | Reco <recoverym4n@gmail.com> |
|---|---|
| Date | 2018-05-18 13:40 +0200 |
| Message-ID | <vQLTP-1W1-5@gated-at.bofh.it> |
| In reply to | #195870 |
Hi.
On Fri, May 18, 2018 at 09:26:47AM +0100, Bhasker C V wrote:
> Hi,
>
> Version: buster
> I do a manual cryptsetup to create my home directory after system boots up
> I want to run fsck every time the device node is created from luks
>
> I added this udev rule
>
> ACTION="change",DEVTYPE="disk",ID_FS_UUID="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5"
> RUN+="/bin/btrfsck /dev/mapper/home"
>
> But this rule is not getting triggered. Could someone help please to
> point out what mistake I am doing ?
You have five mistakes here, actually:
1) udev rules use C-like syntax for comparison (==) and assingment (=).
Your rule tests nothing, it just assigns some values.
2) All udev 'attributes' have type, and you must specify it.
For instance DEVTYPE and ID_FS_UUID are ENVIRONMENT.
3) 'change' applies to changing device state. It's 'add' for device
creation.
4) RUN should go after a coma.
5) You're not supposed to spawn long-running processes from udev rules
directly. Utilize systemd.
Taking all this into the account, your rule should look like this (one
like, coma separated values):
ACTION=="add", ENV{DEVTYPE}=="disk",ENV{ID_FS_UUID}=="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5",RUN+="/bin/systemctl start my_brtfs_home_checking.service"
Your custom service file - like this:
[Service]
Type=oneshot
ExecStart=/bin/btrfsck /dev/mapper/home
Reco
[toc] | [prev] | [next] | [standalone]
| From | Bhasker C V <bhasker@unixindia.com> |
|---|---|
| Date | 2018-05-21 10:40 +0200 |
| Message-ID | <vROwi-7qA-9@gated-at.bofh.it> |
| In reply to | #195873 |
Thanks. I will try this
On Fri, May 18, 2018 at 12:21 PM, Reco <recoverym4n@gmail.com> wrote:
> Hi.
>
> On Fri, May 18, 2018 at 09:26:47AM +0100, Bhasker C V wrote:
>> Hi,
>>
>> Version: buster
>> I do a manual cryptsetup to create my home directory after system boots up
>> I want to run fsck every time the device node is created from luks
>>
>> I added this udev rule
>>
>> ACTION="change",DEVTYPE="disk",ID_FS_UUID="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5"
>> RUN+="/bin/btrfsck /dev/mapper/home"
>>
>> But this rule is not getting triggered. Could someone help please to
>> point out what mistake I am doing ?
>
> You have five mistakes here, actually:
>
> 1) udev rules use C-like syntax for comparison (==) and assingment (=).
> Your rule tests nothing, it just assigns some values.
>
> 2) All udev 'attributes' have type, and you must specify it.
> For instance DEVTYPE and ID_FS_UUID are ENVIRONMENT.
>
> 3) 'change' applies to changing device state. It's 'add' for device
> creation.
>
> 4) RUN should go after a coma.
>
> 5) You're not supposed to spawn long-running processes from udev rules
> directly. Utilize systemd.
>
>
> Taking all this into the account, your rule should look like this (one
> like, coma separated values):
>
> ACTION=="add", ENV{DEVTYPE}=="disk",ENV{ID_FS_UUID}=="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5",RUN+="/bin/systemctl start my_brtfs_home_checking.service"
>
> Your custom service file - like this:
>
> [Service]
> Type=oneshot
> ExecStart=/bin/btrfsck /dev/mapper/home
>
> Reco
>
[toc] | [prev] | [next] | [standalone]
| From | songbird <songbird@anthive.com> |
|---|---|
| Date | 2018-05-18 14:00 +0200 |
| Message-ID | <vQMdc-23N-15@gated-at.bofh.it> |
| In reply to | #195870 |
Bhasker C V wrote: > Hi, > > Version: buster > I do a manual cryptsetup to create my home directory after system boots up > I want to run fsck every time the device node is created from luks > > I added this udev rule > > ACTION="change",DEVTYPE="disk",ID_FS_UUID="cf1b64cf-7a62-4a43-ad44-6c68f2bbdec5" > RUN+="/bin/btrfsck /dev/mapper/home" > > But this rule is not getting triggered. Could someone help please to > point out what mistake I am doing ? i'm guessing that after the boot that there is no change happening to trigger it... what happens if you make the rule "add|change" instead? songbird
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web