Udev rule to mount disk does not work2019 Community Moderator ElectionUdev inhibits auto mountmount is not executed when called by udevLinux - mount command returns zero/0 but not workingMount fuse.mergerfs in udev scriptUDEV Rule Not TriggeringUdev rule not setting groupUdev hwdb rule does not workudev rule doesn't workUdev rule doesn't work, why?udev rule not calledrun mount as root inside udev ruleudev rule with KERNELS argument does not workDynamic Drive HotSwappingUdev Rules Not Running
How to preserve electronics (computers, ipads, phones) for hundreds of years?
Exposing a company lying about themselves in a tightly knit industry (videogames) : Is my career at risk on the long run?
Connection Between Knot Theory and Number Theory
Calculate Pi using Monte Carlo
Why doesn't Gödel's incompleteness theorem apply to false statements?
Why does the frost depth increase when the surface temperature warms up?
Relations between homogeneous polynomials
Why is implicit conversion not ambiguous for non-primitive types?
Would this string work as string?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
How to test the sharpness of a knife?
Error in master's thesis, I do not know what to do
"Marked down as someone wanting to sell shares." What does that mean?
Why is indicated airspeed rather than ground speed used during the takeoff roll?
What is the period/term used describe Giuseppe Arcimboldo's style of painting?
Should a narrator ever describe things based on a character's view instead of facts?
"Oh no!" in Latin
What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?
When is the exact date for EOL of Ubuntu 14.04 LTS?
What is the meaning of "You've never met a graph you didn't like?"
Can you take a "free object interaction" while incapacitated?
Make a Bowl of Alphabet Soup
Sort with assumptions
Weird lines in Microsoft Word
Udev rule to mount disk does not work
2019 Community Moderator ElectionUdev inhibits auto mountmount is not executed when called by udevLinux - mount command returns zero/0 but not workingMount fuse.mergerfs in udev scriptUDEV Rule Not TriggeringUdev rule not setting groupUdev hwdb rule does not workudev rule doesn't workUdev rule doesn't work, why?udev rule not calledrun mount as root inside udev ruleudev rule with KERNELS argument does not workDynamic Drive HotSwappingUdev Rules Not Running
I have the following content in in /etc/udev/rules.d/81-external-disk.rules:
ENVID_FS_UUID=="6826692e-79f4-4423-8467-cef4d5e840c5", RUNprogram+="/bin/mount -o nofail,x-systemd.device-timeout=1 -t ext4 -U 6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external"
After running:
udevadm control --reload ; udevadm trigger /dev/sdb1
It does nothing at all. However if II change the mount command for something such as /bin/touch /tmp/xyz it works.
Versions:
[root@helsinki rules.d]# rpm -qa | grep udev
libgudev1-219-19.el7_2.12.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
[root@helsinki rules.d]# rpm -qa | grep systemd
systemd-libs-219-19.el7_2.12.x86_64
systemd-219-19.el7_2.12.x86_64
systemd-sysv-219-19.el7_2.12.x86_64
[root@helsinki rules.d]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
mount udev
add a comment |
I have the following content in in /etc/udev/rules.d/81-external-disk.rules:
ENVID_FS_UUID=="6826692e-79f4-4423-8467-cef4d5e840c5", RUNprogram+="/bin/mount -o nofail,x-systemd.device-timeout=1 -t ext4 -U 6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external"
After running:
udevadm control --reload ; udevadm trigger /dev/sdb1
It does nothing at all. However if II change the mount command for something such as /bin/touch /tmp/xyz it works.
Versions:
[root@helsinki rules.d]# rpm -qa | grep udev
libgudev1-219-19.el7_2.12.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
[root@helsinki rules.d]# rpm -qa | grep systemd
systemd-libs-219-19.el7_2.12.x86_64
systemd-219-19.el7_2.12.x86_64
systemd-sysv-219-19.el7_2.12.x86_64
[root@helsinki rules.d]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
mount udev
add a comment |
I have the following content in in /etc/udev/rules.d/81-external-disk.rules:
ENVID_FS_UUID=="6826692e-79f4-4423-8467-cef4d5e840c5", RUNprogram+="/bin/mount -o nofail,x-systemd.device-timeout=1 -t ext4 -U 6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external"
After running:
udevadm control --reload ; udevadm trigger /dev/sdb1
It does nothing at all. However if II change the mount command for something such as /bin/touch /tmp/xyz it works.
Versions:
[root@helsinki rules.d]# rpm -qa | grep udev
libgudev1-219-19.el7_2.12.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
[root@helsinki rules.d]# rpm -qa | grep systemd
systemd-libs-219-19.el7_2.12.x86_64
systemd-219-19.el7_2.12.x86_64
systemd-sysv-219-19.el7_2.12.x86_64
[root@helsinki rules.d]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
mount udev
I have the following content in in /etc/udev/rules.d/81-external-disk.rules:
ENVID_FS_UUID=="6826692e-79f4-4423-8467-cef4d5e840c5", RUNprogram+="/bin/mount -o nofail,x-systemd.device-timeout=1 -t ext4 -U 6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external"
After running:
udevadm control --reload ; udevadm trigger /dev/sdb1
It does nothing at all. However if II change the mount command for something such as /bin/touch /tmp/xyz it works.
Versions:
[root@helsinki rules.d]# rpm -qa | grep udev
libgudev1-219-19.el7_2.12.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
[root@helsinki rules.d]# rpm -qa | grep systemd
systemd-libs-219-19.el7_2.12.x86_64
systemd-219-19.el7_2.12.x86_64
systemd-sysv-219-19.el7_2.12.x86_64
[root@helsinki rules.d]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
mount udev
mount udev
edited Dec 13 '16 at 19:47
sebelk
asked Dec 13 '16 at 14:43
sebelksebelk
1,85121935
1,85121935
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
This is a systemd feature. The original udev
command has been replaced by systemd-udevd
(see its man page). One of the differences is that it creates its own filesystem namespace, so your mount is done, but it is not visible in the principal namespace. (You can check this by doing systemctl status systemd-udevd
to get the Main PID of the service, then looking through the contents of /proc/<pid>/mountinfo
for your filesystem).
If you want to go back to having a shared instead of private filesystem namespace, then create a file /etc/systemd/system/systemd-udevd.service
with contents
.include /usr/lib/systemd/system/systemd-udevd.service
[Service]
MountFlags=shared
or a new directory and file /etc/systemd/system/systemd-udevd.service.d/myoverride.conf
with just the last 2 lines, i.e.
[Service]
MountFlags=shared
and restart the systemd-udevd service. I haven't found the implications of doing this.
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
Pretty sure this did not work until I added[Service]
between those two lines.
– goldilocks
Oct 15 '17 at 23:10
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the*.d/*.conf
way of making changes, as.include
doesnt seem to be documented.
– meuh
Oct 16 '17 at 7:54
add a comment |
This same problem occurs in Ubuntu 18.04 with the same underlying cause. To fix it we create an override file for systemd-udevd
:
sudo systemctl edit systemd-udevd
And insert into it:
[Service]
MountFlags=shared
Save the file and then execute:
sudo systemctl daemon-reload
sudo service systemd-udevd --full-restart
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
add a comment |
ENVID_FS_UUID is not known before mounting.
You should use an attribute closer to the hardware like ATTRSerialNumber or ATTRVendor and ATTRProdID.
usb-devices
can help you to find the better way to identify your device.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f330094%2fudev-rule-to-mount-disk-does-not-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is a systemd feature. The original udev
command has been replaced by systemd-udevd
(see its man page). One of the differences is that it creates its own filesystem namespace, so your mount is done, but it is not visible in the principal namespace. (You can check this by doing systemctl status systemd-udevd
to get the Main PID of the service, then looking through the contents of /proc/<pid>/mountinfo
for your filesystem).
If you want to go back to having a shared instead of private filesystem namespace, then create a file /etc/systemd/system/systemd-udevd.service
with contents
.include /usr/lib/systemd/system/systemd-udevd.service
[Service]
MountFlags=shared
or a new directory and file /etc/systemd/system/systemd-udevd.service.d/myoverride.conf
with just the last 2 lines, i.e.
[Service]
MountFlags=shared
and restart the systemd-udevd service. I haven't found the implications of doing this.
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
Pretty sure this did not work until I added[Service]
between those two lines.
– goldilocks
Oct 15 '17 at 23:10
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the*.d/*.conf
way of making changes, as.include
doesnt seem to be documented.
– meuh
Oct 16 '17 at 7:54
add a comment |
This is a systemd feature. The original udev
command has been replaced by systemd-udevd
(see its man page). One of the differences is that it creates its own filesystem namespace, so your mount is done, but it is not visible in the principal namespace. (You can check this by doing systemctl status systemd-udevd
to get the Main PID of the service, then looking through the contents of /proc/<pid>/mountinfo
for your filesystem).
If you want to go back to having a shared instead of private filesystem namespace, then create a file /etc/systemd/system/systemd-udevd.service
with contents
.include /usr/lib/systemd/system/systemd-udevd.service
[Service]
MountFlags=shared
or a new directory and file /etc/systemd/system/systemd-udevd.service.d/myoverride.conf
with just the last 2 lines, i.e.
[Service]
MountFlags=shared
and restart the systemd-udevd service. I haven't found the implications of doing this.
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
Pretty sure this did not work until I added[Service]
between those two lines.
– goldilocks
Oct 15 '17 at 23:10
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the*.d/*.conf
way of making changes, as.include
doesnt seem to be documented.
– meuh
Oct 16 '17 at 7:54
add a comment |
This is a systemd feature. The original udev
command has been replaced by systemd-udevd
(see its man page). One of the differences is that it creates its own filesystem namespace, so your mount is done, but it is not visible in the principal namespace. (You can check this by doing systemctl status systemd-udevd
to get the Main PID of the service, then looking through the contents of /proc/<pid>/mountinfo
for your filesystem).
If you want to go back to having a shared instead of private filesystem namespace, then create a file /etc/systemd/system/systemd-udevd.service
with contents
.include /usr/lib/systemd/system/systemd-udevd.service
[Service]
MountFlags=shared
or a new directory and file /etc/systemd/system/systemd-udevd.service.d/myoverride.conf
with just the last 2 lines, i.e.
[Service]
MountFlags=shared
and restart the systemd-udevd service. I haven't found the implications of doing this.
This is a systemd feature. The original udev
command has been replaced by systemd-udevd
(see its man page). One of the differences is that it creates its own filesystem namespace, so your mount is done, but it is not visible in the principal namespace. (You can check this by doing systemctl status systemd-udevd
to get the Main PID of the service, then looking through the contents of /proc/<pid>/mountinfo
for your filesystem).
If you want to go back to having a shared instead of private filesystem namespace, then create a file /etc/systemd/system/systemd-udevd.service
with contents
.include /usr/lib/systemd/system/systemd-udevd.service
[Service]
MountFlags=shared
or a new directory and file /etc/systemd/system/systemd-udevd.service.d/myoverride.conf
with just the last 2 lines, i.e.
[Service]
MountFlags=shared
and restart the systemd-udevd service. I haven't found the implications of doing this.
edited 14 hours ago
Toby Speight
5,37611132
5,37611132
answered Dec 13 '16 at 19:48
meuhmeuh
32.4k12054
32.4k12054
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
Pretty sure this did not work until I added[Service]
between those two lines.
– goldilocks
Oct 15 '17 at 23:10
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the*.d/*.conf
way of making changes, as.include
doesnt seem to be documented.
– meuh
Oct 16 '17 at 7:54
add a comment |
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
Pretty sure this did not work until I added[Service]
between those two lines.
– goldilocks
Oct 15 '17 at 23:10
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the*.d/*.conf
way of making changes, as.include
doesnt seem to be documented.
– meuh
Oct 16 '17 at 7:54
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
Yes I've applied such a workaround, I wonder if has security implications too.
– sebelk
Dec 13 '16 at 19:52
1
1
Pretty sure this did not work until I added
[Service]
between those two lines.– goldilocks
Oct 15 '17 at 23:10
Pretty sure this did not work until I added
[Service]
between those two lines.– goldilocks
Oct 15 '17 at 23:10
1
1
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the
*.d/*.conf
way of making changes, as .include
doesnt seem to be documented.– meuh
Oct 16 '17 at 7:54
@goldilocks You are probably right. I added this to the answer, thanks. It might depend on what the last section was in the included file, but it seems systemd now prefers you to use the
*.d/*.conf
way of making changes, as .include
doesnt seem to be documented.– meuh
Oct 16 '17 at 7:54
add a comment |
This same problem occurs in Ubuntu 18.04 with the same underlying cause. To fix it we create an override file for systemd-udevd
:
sudo systemctl edit systemd-udevd
And insert into it:
[Service]
MountFlags=shared
Save the file and then execute:
sudo systemctl daemon-reload
sudo service systemd-udevd --full-restart
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
add a comment |
This same problem occurs in Ubuntu 18.04 with the same underlying cause. To fix it we create an override file for systemd-udevd
:
sudo systemctl edit systemd-udevd
And insert into it:
[Service]
MountFlags=shared
Save the file and then execute:
sudo systemctl daemon-reload
sudo service systemd-udevd --full-restart
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
add a comment |
This same problem occurs in Ubuntu 18.04 with the same underlying cause. To fix it we create an override file for systemd-udevd
:
sudo systemctl edit systemd-udevd
And insert into it:
[Service]
MountFlags=shared
Save the file and then execute:
sudo systemctl daemon-reload
sudo service systemd-udevd --full-restart
This same problem occurs in Ubuntu 18.04 with the same underlying cause. To fix it we create an override file for systemd-udevd
:
sudo systemctl edit systemd-udevd
And insert into it:
[Service]
MountFlags=shared
Save the file and then execute:
sudo systemctl daemon-reload
sudo service systemd-udevd --full-restart
answered May 3 '18 at 15:58
freespacefreespace
16114
16114
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
add a comment |
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
It worked like a charm on Raspberry (Raspbian 9 "stretch"). Thanks!
– Maxwel Leite
Oct 24 '18 at 19:07
1
1
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
It did not work for my Ubuntu 18.04 to solve the problem of no automount for USB drive.
– Yu Shen
Jan 12 at 15:41
add a comment |
ENVID_FS_UUID is not known before mounting.
You should use an attribute closer to the hardware like ATTRSerialNumber or ATTRVendor and ATTRProdID.
usb-devices
can help you to find the better way to identify your device.
add a comment |
ENVID_FS_UUID is not known before mounting.
You should use an attribute closer to the hardware like ATTRSerialNumber or ATTRVendor and ATTRProdID.
usb-devices
can help you to find the better way to identify your device.
add a comment |
ENVID_FS_UUID is not known before mounting.
You should use an attribute closer to the hardware like ATTRSerialNumber or ATTRVendor and ATTRProdID.
usb-devices
can help you to find the better way to identify your device.
ENVID_FS_UUID is not known before mounting.
You should use an attribute closer to the hardware like ATTRSerialNumber or ATTRVendor and ATTRProdID.
usb-devices
can help you to find the better way to identify your device.
answered Dec 13 '16 at 16:28
SetopSetop
1193
1193
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f330094%2fudev-rule-to-mount-disk-does-not-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown