Git Product home page Git Product logo

Comments (13)

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

Unless you have devmon running, this is normal. udevil is not a daemon (doesn't run continuously to monitor and react to events). devmon will take care of this if its running, as will spacefm (they use udevil to unmount removed devices, unless something else on the system unmounts them first, potentially leaving behind a mount point directory), or I think some distros use a udev rule for this.

For udevil to remove a directory, you must use udevil to unmount the device (or udevil via devmon or spacefm), and the directory must have been created by udevil (the device was mounted by udevil). Or you can use 'udevil clean'.

You can also make an fstab entry for /dev/sr0 and create /media/dvd as root so it will be permanent. For example in fstab:
/dev/sr0 /media/dvd auto ro,user,noauto,unhide 0 0

from udevil.

arclance avatar arclance commented on July 17, 2024
Unless you have devmon running, this is normal. udevil is not a daemon (doesn't run continuously
to monitor and react to events). devmon will take care of this if its running, as will spacefm

This was with udevil running via spacefm (running as a daemon) and the disk was mounted by udevil through spacefm.
If I am interpreting you correctly spacefm should have removed the directory?
It did not, would that make this a spacefm bug instead?

You can also make an fstab entry for /dev/sr0 and create /media/dvd as root so it will be permanent. For example in fstab:
/dev/sr0 /media/dvd auto ro,user,noauto,unhide 0 0

No, I don't like doing that for removable devices.

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

If I am interpreting you correctly spacefm should have removed the directory?

If spacefm had unmounted the removed device via udevil, the directory would be removed (assuming udevil created it when mounting). If it's not removed, then likely something else on the system is unmounting the device when you press eject - perhaps a udev ruleor another daemon. Since udevil is not doing the unmounting, the directory is not removed.

You might add a udev rule so udevil is used to unmount. Or if you generally have spacefm running, remove the existing rule so that spacefm will do the unmounting.

To be clear, spacefm and devmon watch for devices to be removed, and when they are, will run 'udevil unmount' on the device if it is still mounted. But something else can unmount it first.

You can also middle-click on the drive in spacefm, which will unmount it. This isn't a bug you're dealing with - it's just that you're not unmounting the device prior to ejecting it, and whatever is unmounting the device on your system isn't using udevil.

from udevil.

arclance avatar arclance commented on July 17, 2024

This is what I see in gdb when I put the disk in.

udev changed: /dev/sr1
udev changed: /dev/sr1

Automount: /usr/bin/udevil mount /dev/sr1 -o 'noexec,nosuid,noatime'
Mounted /dev/sr1 at /media/STARGATE_ATLANTIS_S2
mount changed: /dev/sr1

And this is what I see when I hit the eject button.

udev changed: /dev/sr1
udev changed: /dev/sr1

These are the only udev rules I have for cd/dvd.

# This file was automatically generated by the /lib/udev/write_cd_rules
# program, run by the cd-aliases-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and set the $GENERATED variable.

# DVD-ROM_GDRH10N (pci-0000:00:1f.2-scsi-3:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-3:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-3:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"

# DVD-ROM_GDRH10N (pci-0000:00:1f.2-scsi-0:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="dvd1", ENV{GENERATED}="1"

I don't know much about them, so I don't know if they would affect unmounting or not.
Are they just creating symlinks to /dev/srX in the system default location?
If they are I can just get rid of them since I don't want that to happen.

I do still have udisks1 installed since "system-config-printer" depends on it and I need that to manage my printers.

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

If spacefm unmounted it you would see this in the terminal after 'udev changed: /dev/sr1':
Unmount-If-Mounted: [...] udevil umount /dev/sr1

You can test this by removing a usb stick without unmounting it first, and compare that with your eject results.

Since you didn't see 'unmount-if-mounted' then by the time spacefm handled the udev change, it was already unmounted. Hence udevil was not run to unmount it, hence the directory was not removed.

If udisks1 daemon is running that could be doing it - not sure. I'm no expert on udev rules so I won't get into that.

I could make spacefm and devmon run 'udevil clean' automatically after any device removal - I'll consider that change to help with this.

from udevil.

arclance avatar arclance commented on July 17, 2024
I could make spacefm and devmon run 'udevil clean' automatically after any device removal - I'll consider that change to help with this.

That sounds like a good idea.

I guess something must be getting the eject button press signal before spacefm has a chance to recognize it and it unmounts the disk first.
The only think I can think of that would do that is udiscks1.

I will look at my log files and see if I see any indication as to what is going on there.

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

devmon 1.1.2 (distributed in udevil 0.3.1) now takes care of this. spacefm 0.7.10 doesn't yet include this change (it was released ahead of schedule to correct an issue, so this change didn't get included yet).

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

spacefm next branch (>0.7.10) now routinely cleans mounts points on device removals.
IgnorantGuru/spacefm@f32283a

Also, a problem where udevil and spacefm considered the device to have media if mounted has been corrected (26cec11).

from udevil.

arclance avatar arclance commented on July 17, 2024

The fix in the next branch does not work.
The folder is still there but empty this time.
A few seconds after the disc is removed udevil tries to remount the disc

udev changed: /dev/sr1
udev changed: /dev/sr1

Automount: /usr/bin/udevil mount /dev/sr1 -o 'noexec,nosuid,noatime'
Mounted /dev/sr1 at /media/STARGATE_CONTINUUM
mount changed: /dev/sr1
[New Thread 0x7fffd77fe700 (LWP 17451)]
[Thread 0x7fffd77fe700 (LWP 17451) exited]
udev changed: /dev/sr1
Unmount-If-Mounted: bash -c "grep -qs '^/dev/sr1 ' /etc/mtab &>/dev/null && /usr/bin/udevil umount '/dev/sr1' &>/dev/null"
udev changed: /dev/sr1
udev changed: /dev/sr1
udev changed: /dev/sr1
[New Thread 0x7fffd77fe700 (LWP 17939)]
[Thread 0x7fffd77fe700 (LWP 17939) exited]
[New Thread 0x7fffd77fe700 (LWP 17955)]
[Thread 0x7fffd77fe700 (LWP 17955) exited]
[New Thread 0x7fffd77fe700 (LWP 17972)]
[Thread 0x7fffd77fe700 (LWP 17972) exited]
[New Thread 0x7fffd77fe700 (LWP 18002)]
[Thread 0x7fffd77fe700 (LWP 18002) exited]
[New Thread 0x7fffd77fe700 (LWP 18019)]
[Thread 0x7fffd77fe700 (LWP 18019) exited]

TASK_COMMAND=/usr/bin/udevil mount /dev/sr0 -o 'noexec,nosuid,noatime'
SPAWN=/bin/bash  /tmp/spacefm-arclance-2b8a6d96.tmp/1485263f-tmp.sh  run
    pid = 18036
child finished  pid=18036 exit_status=1

and fails with this error message.

udevil: error 63: no media in device /dev/sr0 (or specify type with -t)

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

I have added a debug message to spacefm next which will print this when it does a clean:

Clean: bash -c "sleep 1 ; /usr/bin/udevil clean"

So you can see when it's doing it.

udevil issue #7 should not be related to this.

Unless you believe there is a bug in udevil or devmon, the rest is a spacefm issue. I can't follow what you're doing above. If you still have a problem please open an issue for spacefm detailing exactly what you're doing (with one drive only for now, please), what result you're getting at each step, and what result you're expecting. Thanks.

from udevil.

arclance avatar arclance commented on July 17, 2024

You mentioned the spacefm fix here so I commented on it here.
I will make a spacfm bug report for it since you asked and it is not fixed.

with one drive only for now, please

I was only using one device I don't know why udevil tired to mount the second drive at the end.
I did not notice that they were different drives until you mentioned it.
That may be another bug in udevil or spacefm I don't know which one.

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

Noting your new issue in spacefm issue #134

from udevil.

IgnorantGuru avatar IgnorantGuru commented on July 17, 2024

To clarify what was corrected in this issue (6): I originally understood the problem to be that when something else unmounted a device, the udevil mount point was not removed (as expected). So devmon and spacefm now run 'udevil clean' when they see a device unmounted, which should remove the (udevil-created) mount point regardless of what does the unmounting. But of course spacefm or devmon need to be running for this to happen.

But arclance's issue was in fact that the disc is still mounted after being ejected, and udevil cannot unmount it as detailed in issue #7.

from udevil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.