Symlinks to Removable Media

If it doesn't relate to Debian, but you still want to share it, please do it here

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-27 19:00

Head_on_a_Stick, Please PM me if you have further comments on my post.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-05-28 06:27

KitchM wrote:It would have been nice if the individual had stated what it is, what it does, how to use it and what to expect as output. So the suggestion remains incomplete.


does this help?

the man page wrote:udevadm monitor [options]
Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It can be
used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event.

-k, --kernel
Print the kernel uevents.

-u, --udev
Print the udev event after the rule processing.

-p, --property
Also print the properties of the event.

-s, --subsystem-match=string[/string]
Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass. When
this option is specified more than once, then each matching result is ORed, that is, all devices in the specified subsystems
are monitored.

-t, --tag-match=string
Filter udev events by tag. Only udev events with a given tag attached will pass. When this option is specified more than
once, then each matching result is ORed, that is, devices which have one of the specified tags are monitored.

-h, --help
Print a short help text and exit.


Hint:
Code: Select all
 man udevadm
Dai_trying
 
Posts: 924
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-29 17:33

As you should know, man pages are almost useless to the newbie. As such, they leave a lot of questions unanswered. In this case, here are some:
What is a uevent?
What sort of format should I expect to see?
How do I know if it is working correctly?
How do I get out of it, since this one, unlike most commands, does not return to the prompt on its own.
How does this help a person wishing to create a symlink?

Do not think that your efforts are not appreciated, because they are (regardless of any indication to the contrary by anyone). I raised no criticism of your efforts.

Thank you for your help and contributions.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-05-29 17:54

Your questions have mostly been answered in the previous posts by HOAS and cuckooflew, but one reason I have used udev rules is to get particular devices (either USB or SD Card) recognised and then back up the contents to a preferred location automatically, but you could also do what you want which in your case would be to create a symlink (and remove it on release I presume?) you can find more information in the Debian Wiki for writing them, HTH.
https://wiki.debian.org/udev
Dai_trying
 
Posts: 924
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby cuckooflew » 2020-05-29 20:23

As you should know, man pages are almost useless to the newbie

Offtopic, but I strongly disagree, first off, they show all the options, and what the options do, a newbie probably does not know , and it can save you a lot of grief to check the manual pages when some one shows some code, make sure the options they have in the code are really what you want to do. It is very foolish to blindly copy/paste code into a terminal if you do not fully understand what the options/switches mean and do. Please try to find the answers, after you have tried and if you don't find a answer, then ask,
EG: What is a uevent?
Also: 'man uevent' =
DESCRIPTION top

udev supplies the system software with device events, manages
permissions of device nodes and may create additional symlinks in the
/dev directory, or renames network interfaces. The kernel usually
just assigns unpredictable device names based on the order of
discovery. Meaningful symlinks or network device names provide a way
to reliably identify devices based on their properties or current
configuration.

The udev daemon, systemd-udevd.service(8), receives device uevents
directly from the kernel whenever a device is added or removed from
the system, or it changes its state. When udev receives a device
event, it matches its configured set of rules against various device
attributes to identify the device. Rules that match may provide
additional device information to be stored in the udev database or to
be used to create meaningful symlink names.

All device information udev processes is stored in the udev database
and sent out to possible event subscribers. Access to all stored data
and the event sources is provided by the library libudev

And if you do not have the manual in your system: https://www.man7.org/linux/man-pages/man7/udev.7.html=====edited=======
Apology for the confusion, I posted the wrong link, but both are related, this is what I meant to post:
https://www.man7.org/linux/man-pages/man8/udevadm.8.html
===============end edit=====
The next question :
What sort of format should I expect to see?

Is not clear, do you mean for uevent or udev ? or what, ?
Be specific with your questions, I took a guess, that you mean for uevent:
Logic for the key words:
Code: Select all
uevent examples and format

https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/dm-uevent.html
An example of the uevents generated as captured by udevmonitor is shown below

1.) Path failure:
Code: Select all
UEVENT[1192521009.711215] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_FAILED
DM_SEQNUM=1
DM_PATH=8:32
DM_NR_VALID_PATHS=0
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1130
----snip--
No, I am not going to copy/paste all of the examples here.
Last edited by cuckooflew on 2020-05-30 16:03, edited 2 times in total.
Please Read.. What we expect you have already Done.
Does any one know about this ?
Users browsing this forum: Google Knows, and
My grand father knows all about everything:
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 388
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-29 21:20

One of the issues with most forums is that, although there are many well-meaning respondents like yourselves, it is extremely difficult for most people to get their minds around the needs of the poster. This is mostly because of the inability to read minds, and not really because something is not clear.

There is only one way around that. We must remember that the poster is absolutely not wanting to take a college course on a subject and is just trying to find a quick and concise answer or solution to a given problem. RTFM is rarely the solution. Therefore the solution is to show a simple way to do the job.

In my case, I have not seen any concrete answers as yet. However, there have been many ideas that force me into reading yet more information on my way to a college degree on the subject. I don't want that and I do not see forums as the place for that.

@ Dai_trying,
Interesting. I would think that the link must automatically work on every insertion of the USB device. Wouldn't that mean it must always be there? So why would I want the symlink removed? I don't understand that.

@cuckooflew,
I appreciate your view point and you most certainly have a right to it. If only it helped me. I believe you do not understand that everyone is different. Some minds do not understand auto mechanics or cooking or physics, and some minds do not well comprehend the poorly written (as I see it from an editor's viewpoint) text in man pages. For the most part it is geek-speak. And I have used computers and taught their use for thirty years. Believe me when I say that I would not expect many of my customers to ever understand man pages, nor would I ask them to.

Also, I believe that you may have failed to keep your thoughts on the subject when addressing my points. The subject was "udevadm monitor". When one types that command into a terminal, something is expected to happen and in this case to show a display of some sort. Correct? I got nothing.

Hence the points needing to be answered.

Thank you both for your interesting responses.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-05-30 05:21

KitchM wrote:@ Dai_trying,
Interesting. I would think that the link must automatically work on every insertion of the USB device. Wouldn't that mean it must always be there? So why would I want the symlink removed? I don't understand that.


If you are using a udev rule to mount a specific usb device (to a specific location) then I would think that when you physically remove this device from the system you want to remove the symlink to that device, otherwise you will always have the symlink but it will be broken unless you have that device inserted.
Dai_trying
 
Posts: 924
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby Head_on_a_Stick » 2020-05-30 09:26

KitchM wrote:The subject was "udevadm monitor". When one types that command into a terminal, something is expected to happen and in this case to show a display of some sort. Correct? I got nothing.

You do understand what the word "monitor" means, yes?

From the "useless" man page (emphasis added):
udevadm monitor [options]
Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console.

And once more:
I wrote:plug a device in
User avatar
Head_on_a_Stick
 
Posts: 12129
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Symlinks to Removable Media

Postby cuckooflew » 2020-05-30 13:40

H_O_A_S has told you twice now, and I will make a 3rd attempt , you need to plug in a device, then it will start producing out put, this will be the "uevent " out put. It is demonstrated here:
https://www.tecmint.com/udev-for-device-detection-management-in-linux/
The following screenshot shows an excerpt of an ADD event after connecting a USB flash disk to the test system:
Code: Select all
$ udevadm monitor

Image

I did post the link in a previous post: http://forums.debian.net/viewtopic.php?f=10&t=146292#p721362 But apparently you do not have enough interest to read any of the links we post, we must copy/paste it to here for you,...this is getting old.

by KitchM »
Also, I believe that you may have failed to keep your thoughts on the subject when addressing my points. The subject was "udevadm monitor"

Yes, your right it was, about udevadm monitor, but did you forget so fast, you are the one that also asked,What is a uevent?
KitchM wrote:As you should know, man pages are almost useless to the newbie. As such, they leave a lot of questions unanswered. In this case, here are some:
What is a uevent?
What sort of format should I expect to see?
How do I know if it is working correctly?
How do I get out of it, since this one, unlike most commands, does not return to the prompt on its own.
How does this help a person wishing to create a symlink?

Do not think that your efforts are not appreciated, because they are (regardless of any indication to the contrary by anyone). I raised no criticism of your efforts.

Thank you for your help and contributions.

So perhaps, if you do not want our thoughts to drift into other subjects, don't ask about other subjects, however, since uevent is related, but ok, I see what happened now, and I am sorry, I posted the wrong manual page, silly me . Here is the correct one,:
https://www.man7.org/linux/man-pages/man8/udevadm.8.html
udevadm monitor [options]
Listens to the kernel uevents and events sent out by a udev rule and
prints the devpath of the event to the console. It can be used to
analyze the event timing, by comparing the timestamps of the kernel
uevent and the udev event.

-k, --kernel
Print the kernel uevents.

-u, --udev
Print the udev event after the rule processing.

-p, --property
Also print the properties of the event.

-s, --subsystem-match=string[/string]
Filter kernel uevents and udev events by subsystem[/devtype].
Only events with a matching subsystem value will pass. When this
option is specified more than once, then each matching result is
ORed, that is, all devices in the specified subsystems are
monitored.

-t, --tag-match=string
Filter udev events by tag. Only udev events with a given tag
attached will pass. When this option is specified more than once,
then each matching result is ORed, that is, devices which have
one of the specified tags are monitored.

-h, --help
Print a short help text and exit.

But even the one I did post, is related, to some extent, down at the bottom it shows you what more needs to be read:
SEE ALSO top

systemd-udevd.service(8), udevadm(8), systemd.link(5)

Any way, if you want us to keep our thoughts on the subject, it would help if you do the same. Don't worry, I enjoy this, and I am starting to figure out the game your playing, not sure if I like it though, I suspect I am going to stop seeing your posts pretty soon, so there fore will not be replying any more either, all though I might respond to comments made by others,...have a good day
Please Read.. What we expect you have already Done.
Does any one know about this ?
Users browsing this forum: Google Knows, and
My grand father knows all about everything:
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 388
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Symlinks to Removable Media

Postby KitchM » 2020-06-05 14:23

@ Dai_trying,
If you are using a udev rule to mount a specific usb device (to a specific location) then I would think that when you physically remove this device from the system you want to remove the symlink to that device, otherwise you will always have the symlink but it will be broken unless you have that device inserted.


What would happen if it was not removed? In the case of a USB stick, the data on it would no longer be available and simply nothing would happen with the program that needed it to exist. In other words, the program would throw an access error and that would be that. No harm done.

However, once plugged back in, it immediately becomes available to the running program. Therefore the program can keep running if desired.

Have I missed something there?
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-06-05 15:33

It is possible something could get written to the mount-point and it might cause the mount to fail later on and this is likely to show as a mount error in system logs, but it would be futile to have the udev rule attempt to unmount the device as it will not be triggered until the device is removed, and by that time there is nothing to unmount, which in itself can be an issue.

When in desktop mode I use file manager to mount/unmount any inserted device that I need and never have an issue, I kinda get the feeling that you might be trying to re-invent the wheel here as you already have a file manager which can do this and most DE's have an option to automount devices upon insertion, but looking back I remember now that you aren't actually using Debian so maybe the tails forum would be a better place to ask on this as there is likely to be much better advise, and I don't want to download another OS just to test this.
Dai_trying
 
Posts: 924
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby KitchM » 2020-06-05 17:20

Yes, I got it, but I think you misunderstand.

I would like to mount my drive which contains my Wasabi Wallet data under TailsOS. I don't really care I guess how it is done, except that I want it to be immediately recognized by the OS upon insertion (I think we're good on that part as is), and I want Wasabi to see it as its data location (.walletwasabi) without any further work.

I don't think anyone wants to bring up a file manager just to do that. I failed to check, however, if Tails mounts it automatically or not. I'll let you know.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-06-05 20:29

KitchM wrote:Yes, I got it, but I think you misunderstand.

I would like to mount my drive which contains my Wasabi Wallet data under TailsOS. I don't really care I guess how it is done, except that I want it to be immediately recognized by the OS upon insertion (I think we're good on that part as is), and I want Wasabi to see it as its data location (.walletwasabi) without any further work.


I think you're right, wouldn't an fstab entry do that easier? or would it need to be on any machine/installation/VM?

KitchM wrote:I don't think anyone wants to bring up a file manager just to do that.


I was just making a point about the device being recognised and can be mounted in several ways not really suggesting you do that unless it was an easy option of course.

KitchM wrote:I failed to check, however, if Tails mounts it automatically or not. I'll let you know.


[do I score a point for this]Maybe a tails forum post might have told you already[please] :lol:
Dai_trying
 
Posts: 924
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby KitchM » 2020-06-10 18:36

Yeah, yeah, very funny. :lol: But not exactly what I meant.

So, yes, I started Tails, opened the file manager and plugged a USB drive in, saw it appear in the listings and was immediately able to browse the files on it. Works fine. So that part is verified.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Previous

Return to Offtopic

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable