mediascanner fails to watch removable devices if /media/$USER doesn't exist when starting

Bug #1354543 reported by Sergio Schvezov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mediascanner2 (Ubuntu)
Fix Released
Critical
Jussi Pakkanen

Bug Description

If the system has never mounted a removable device then /media/$USER does not exist which causes mediascanner to fail it's watch with this error:

Mount directory does not exist

if something is mounted after this, then it just doesn't notice it.

starting mediascanner after /media/$USER is created allows everything to work.

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: mediascanner2.0 0.102+14.10.20140805-0ubuntu1
Uname: Linux 3.4.67 armv7l
ApportVersion: 2.14.5-0ubuntu3
Architecture: armhf
Date: Fri Aug 8 14:39:22 2014
InstallationDate: Installed on 2014-08-08 (0 days ago)
InstallationMedia: Ubuntu Utopic Unicorn (development branch) - armhf (20140808-020205)
SourcePackage: mediascanner2
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Sergio Schvezov (sergiusens) wrote :
summary: - mediascanner fails to what removable devices if /media/$USER doesn't
- exist
+ mediascanner fails to watch removable devices if /media/$USER doesn't
+ exist when starting
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Jussi can you take a look? this is to make SD cards work properly for media playback

Changed in mediascanner2 (Ubuntu):
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Jussi Pakkanen (jpakkane)
tags: added: rtm14
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The core question is why does not /media/$USER exist when Mediascanner is starting? It does exist on the desktop. Could this be a timing issue or is the configuration completely different?

Revision history for this message
Sergio Schvezov (sergiusens) wrote : Re: [Bug 1354543] mediascanner fails to watch removable devices if/media/$USER doesn't exist when starting

On lunes 11 de agosto de 2014 05h'04:19 ART, Jussi Pakkanen wrote:
> The core question is why does not /media/$USER exist when Mediascanner
> is starting? It does exist on the desktop. Could this be a timing issue
> or is the configuration completely different?

/media is created as a temp filesystem and udisks2 only creates the full
path on first mount.

The desktop has a persistent filesystem, so the rule is probably the same
and would only fail for the first time after a new install. We also don't
have udisks (sans 2) on the phone.

I just tested on desktop by creating a new user and /media/$USER doesn't
exist until I first mount something; of course, this is hidden by the
persistence and long term desktop use.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The way Mediascanner currently gets to know about mounted drives is a bit hacky as it listens to inotify events in that directory. Is there a more reliable way of getting mount/unmount events from the system? Maybe over dbus?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Download full text (3.5 KiB)

On lunes 11 de agosto de 2014 08h'58:22 ART, Jussi Pakkanen wrote:
> The way Mediascanner currently gets to know about mounted drives is a
> bit hacky as it listens to inotify events in that directory. Is there a
> more reliable way of getting mount/unmount events from the system? Maybe
> over dbus?

I wrote ciborium which interfaces with udisks2, I can create a specific
signal to track or you could watch udisks2 (which is kind of involved IMO,
but already there):

Here's filesystem-mount:

signal sender=:1.58 -> dest=(null destination) serial=30
path=/org/freedesktop/UDisks2;
interface=org.freedesktop.DBus.ObjectManager; member=InterfacesAdded
   object path "/org/freedesktop/UDisks2/jobs/2"
   array [
      dict entry(
         string "org.freedesktop.UDisks2.Job"
         array [
            dict entry(
               string "Operation"
               variant string "filesystem-mount"
            )
            dict entry(
               string "Progress"
               variant double 0
            )
            dict entry(
               string "ProgressValid"
               variant boolean false
            )
            dict entry(
               string "Bytes"
               variant uint64 0
            )
            dict entry(
               string "Rate"
               variant uint64 0
            )
            dict entry(
               string "StartTime"
               variant uint64 1407760864560033
            )
            dict entry(
               string "ExpectedEndTime"
               variant uint64 0
            )
            dict entry(
               string "Objects"
               variant array [
                     object path
"/org/freedesktop/UDisks2/block_devices/mmcblk1p1"
                  ]
            )
            dict entry(
               string "StartedByUID"
               variant uint32 32011
            )
            dict entry(
               string "Cancelable"
               variant boolean true
            )
         ]
      )
   ]
signal sender=:1.58 -> dest=(null destination) serial=31
path=/org/freedesktop/UDisks2/jobs/2;
interface=org.freedesktop.UDisks2.Job; member=Completed
   boolean true
   string ""
signal sender=:1.58 -> dest=(null destination) serial=32
path=/org/freedesktop/UDisks2;
interface=org.freedesktop.DBus.ObjectManager; member=InterfacesRemoved
   object path "/org/freedesktop/UDisks2/jobs/2"
   array [
      string "org.freedesktop.UDisks2.Job"
   ]
signal sender=:1.58 -> dest=(null destination) serial=34
path=/org/freedesktop/UDisks2/block_devices/mmcblk1p1;
interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.UDisks2.Filesystem"
   array [
      dict entry(
         string "MountPoints"
         variant array [
               array of bytes [
                  2f 6d 65 64 69 61 2f 70 68 61 62 6c 65 74 2f 4b 69 6e 67
73
                  74 6f 6e 00
               ]
            ]
      )
   ]
   array [
   ]

unmounting is a bit more invo...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mediascanner2 - 0.103+14.10.20140815.1-0ubuntu1

---------------
mediascanner2 (0.103+14.10.20140815.1-0ubuntu1) utopic; urgency=medium

  [ Dimitri John Ledkov ]
  * Add missing dependencies to libmediascanner-2.0-dev package. (LP:
    #1351358)

  [ James Henstridge ]
  * Automatically update models when the daemon sends the
    InvalidateResults D-Bus signal. Add a status property to models to
    let loading progress be tracked. Rename rowCount property to count,
    keeping the old name around for compatibility. (LP: #1347444)

  [ Jussi Pakkanen ]
  * Minor fixes for libc++.
  * Handle the case when /media/username does not exist when
    Mediascanner first starts up. (LP: #1354543)
 -- Ubuntu daily release <email address hidden> Fri, 15 Aug 2014 11:18:39 +0000

Changed in mediascanner2 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.