Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #195873
| From | Reco <recoverym4n@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Help with udev trigger |
| Date | 2018-05-18 13:40 +0200 |
| Message-ID | <vQLTP-1W1-5@gated-at.bofh.it> (permalink) |
| References | <vQJfj-gT-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web