LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2020, 07:36 AM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
Question several questions regarding ".rules" rule files and etc


I am learning how to change removable storage device to /media instead of KDE default /run/media/$USER.
As i am reading this url, i came across something that i don't understand.
Appreciate if someone can explain to me. TQ

ref:
Code:
https://wiki.archlinux.org/index.php/Udisks#Mount_to_.2Fmedia_.28udisks2.29
Code:
Mount to /media (udisks2)

By default, udisks2 mounts removable drives under the ACL controlled directory /run/media/$USER/. If you wish to mount to /media instead, use this rule:

Code:
/etc/udev/rules.d/99-udisks2.rules

# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
Since /media, unlike /run, is not mounted by default as a tmpfs, you may also wish to create a tmpfiles.d snippet to clean stale mountpoints at every boot:
Code:
/etc/tmpfiles.d/media.conf

D /media 0755 root root 0 -
Q1.
Is it all rule files are located in the same folder location across all linux distro ? For example, i am using Arch based linux (endeavorous os to be exact).
Or it is has to do with KDE only ?
Let's say if i am using gnome of Endeavorous os.. will the rule files folder location still the same ?

Q2.
When i create such rule file as above, do i need to somehow "refresh" some module so that the system will make the "rule file" in effect ? Do i need to logout or reboot after the rule files is created, to take effect ?

Q3.
In above article, the rule file name is "/etc/udev/rules.d/99-disks2.rules", why "99-" ? I have came to understand that "99" is the priority over a rule file "98".. but since my folder has got no disks2.rules file, can i simply name it something like "09-disks2.rules" instead ? why "99-" was quoted as example ?

Q4.
What does snippet means ?

Q5.
Is this "etc/tmpfiles.d/media.conf" location and file is the place where snippet "settings" are store ? Can i put it that way; "settings"?
Likewise, just like the "/etc/udev/rules.d/99-disks2.rules" above, i can call this as "rules settings" of udev package ...

Q6.
Please explain what does this mean.
Code:
/etc/tmpfiles.d/media.conf

D /media 0755 root root 0 -

I asked such funny questions because i am so very confused with linux way of how things work!
Thanks

Last edited by andrewysk; 11-29-2020 at 07:38 AM.
 
Old 11-29-2020, 08:32 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I can answer some questions and point you to answers of others.

Quote:
Originally Posted by andrewysk View Post
Q1.
Is it all rule files are located in the same folder location across all linux distro ? For example, i am using Arch based linux (endeavorous os to be exact).
Or it is has to do with KDE only ?
Let's say if i am using gnome of Endeavorous os.. will the rule files folder location still the same ?
Yes, most likely the same locations across all or most Linux distros. It has nothing to do with KDE or Gnome.

Quote:
Q2.
When i create such rule file as above, do i need to somehow "refresh" some module so that the system will make the "rule file" in effect ? Do i need to logout or reboot after the rule files is created, to take effect ?
I think that you need to tell udevd to reload the rules. For example udevadm control -R perhaps followed by udevadm trigger, or systemctl reload udevd, or systemctl restart udevd.
Quote:
Q3.
In above article, the rule file name is "/etc/udev/rules.d/99-disks2.rules", why "99-" ? I have came to understand that "99" is the priority over a rule file "98".. but since my folder has got no disks2.rules file, can i simply name it something like "09-disks2.rules" instead ? why "99-" was quoted as example ?
The 99 ensures that it is the last rule that is processed. You may get into trouble if you change the number, either now or when other rules are added.
Quote:
Q4.
What does snippet means ?
You mean this?
Code:
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
It sets an environment variable named UDISKS_FILESYSTEM_SHARED. Its meaning is explained in the udisks manual page.
Quote:
Q5.
Is this "etc/tmpfiles.d/media.conf" location and file is the place where snippet "settings" are store ? Can i put it that way; "settings"?
Sorry, I don't understand your question. tmpfiles.d contains rules for handling temporary files when the system stops. Check the manual page for tmpfiles.d for details.
Quote:
Likewise, just like the "/etc/udev/rules.d/99-disks2.rules" above, i can call this as "rules settings" of udev package ...
tmpfiles.d is not directly related to udevd.
Quote:
Q6.
Please explain what does this mean.
Code:
/etc/tmpfiles.d/media.conf

D /media 0755 root root 0 -
Use the abovementioned manual page.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/udev/rules.d/40-libsane.rules and /etc/udev/rules.d/S99-2000S1.rules missing LABEL=libsane_rules_end mumahendras3 Slackware 6 03-09-2020 02:27 AM
RHEL: /etc/ssh/sshd_config "ClientAliveInterval" versus etc/profile "TIMEOUT" and "TMOUT" linuxuser0024 Linux - Security 1 12-04-2019 01:54 PM
[SOLVED] /etc/udev/rules.d/70-persistent-net.rules and 'ip link' rename rakeafake Linux - Networking 4 02-01-2016 08:34 PM
auditctl -l not showing any rules even though i have rules written in audit.rules alphaguy Linux - Security 1 02-07-2014 05:28 PM
How to edit "/etc/udev/rules.d/40-basic-permissions.rules" file cygan Linux - Newbie 11 03-09-2009 05:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration