LINUX.ORG.RU

udisks не блокирует дисковод и не следит за извлечением диска из него


0

1

Ку!

Дано: Debian Testing,

ii  udisks                                 1.0.4-2                                storage media interface
ii  udisks-glue                            1.3.2-1                                simple automount daemon with support for user-defined actions

Симптомы:

Когда я вставляю компакт-диск в дисковод, он нормально монтируется, с ним можно работать. Когда я нажимаю на кнопку извлечения на дисководе, диск выезжает, несмотря на то, что файловая система на нём смонтирована. Когда я монтирую тот же диск при помощи mount /media/cdrom0, дисковод блокируется нормально и не выезжает, пока я его не размонтирую.

Почему так?

Хотелось бы, чтобы система определяла, что я нажал кнопку извлечения диска, пыталась его размонтировать и в случае успешной попытки выдвигала дисковод.

Конфиг udisks-glue:

default {
	automount = true
	post_mount_command = "notify-send 'Device mounted' '%device_file - %mount_point'"
	post_unmount_command = "notify-send 'Device unmounted' '%device_file - %mount_point'"
}


filter cdrom {
	optical = true
	usage = filesystem
}

match cdrom { 
	automount = true
	post_mount_command = "notify-send 'Device mounted' '%device_file - %mount_point'"
	post_unmount_command = "udisks --eject %device_file; notify-send 'Device unmounted' '%device_file - %mount_point'"
}

Строчка в fstab:

/dev/sr0       /media/cdrom0   udf,iso9660 user,noauto     0       0

Лог, полученный от udisks --monitor-detail:

[23:57:26][aitap@Tarkus ~]> udisks --monitor-detail
Monitoring activity from the disks daemon. Press Ctrl+C to cancel.
 // я выдвигаю лоток привода, кладу на него диск и задвигаю лоток обратно
 // это появляется сразу:
changed:     /org/freedesktop/UDisks/devices/sr0
Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-id:                     /dev/disk/by-id/ata-Optiarc_DVD_RW_AD-7200S
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Чтв 15 Дек 2011 17:05:20
  system internal:             0
  removable:                   1
  has media:                   0
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:             
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  automount hint:              
  size:                        0
  block size:                  0
  job underway:                no
  usage:                       
  type:                        
  version:                     
  uuid:                        
  label:                       
  drive:
    vendor:                    Optiarc
    model:                     Optiarc DVD RW AD-7200S
    revision:                  1.01
    serial:                    
    WWN:                       
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host4
    similar devices:
    media:                     
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_plus_r optical_dvd_plus_r_dl optical_dvd_plus_rw optical_dvd_r optical_dvd_ram optical_dvd_rw
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available
 // это - через несколько секунд:
changed:     /org/freedesktop/UDisks/devices/sr0
Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-id:                     /dev/disk/by-id/ata-Optiarc_DVD_RW_AD-7200S
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Чтв 15 Дек 2011 17:05:20
  system internal:             0
  removable:                   1
  has media:                   1 (detected at Чтв 15 Дек 2011 23:58:31)
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:
  presentation icon:
  automount hint:
  size:                        692715520
  block size:                  2048
  job underway:                no
  usage:                       filesystem
  type:                        iso9660
  version:
  uuid:
  label:                       AITap Boot CD
  optical disc:
    blank:                     0
    appendable:                0
    closed:                    1
    num tracks:                1
    num audio tracks:          0
    num sessions:              1
  drive:
    vendor:                    Optiarc
    model:                     Optiarc DVD RW AD-7200S
    revision:                  1.01
    serial:
    WWN:
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host4
    similar devices:
    media:                     optical_cd_r
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_plus_r optical_dvd_plus_r_dl optical_dvd_plus_rw optical_dvd_r optical_dvd_ram optical_dvd_rw
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available

job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                FilesystemMount, initiated by uid 1000
changed:     /org/freedesktop/UDisks/devices/sr0
Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-id:                     /dev/disk/by-id/ata-Optiarc_DVD_RW_AD-7200S
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Чтв 15 Дек 2011 17:05:20
  system internal:             0
  removable:                   1
  has media:                   1 (detected at Чтв 15 Дек 2011 23:58:31)
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  1
  mount paths:             /media/cdrom0
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:
  presentation icon:
  automount hint:
  size:                        692715520
  block size:                  2048
  job underway:                no
  usage:                       filesystem
  type:                        iso9660
  version:
  uuid:
  label:                       AITap Boot CD
  optical disc:
    blank:                     0
    appendable:                0
    closed:                    1
    num tracks:                1
    num audio tracks:          0
    num sessions:              1
  drive:
    vendor:                    Optiarc
    model:                     Optiarc DVD RW AD-7200S
    revision:                  1.01
    serial:
    WWN:
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host4
    similar devices:


    media:                     optical_cd_r
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_plus_r optical_dvd_plus_r_dl optical_dvd_plus_rw optical_dvd_r optical_dvd_ram optical_dvd_rw
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available

job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                no

 // а теперь я вынимаю диск нажатием на кнопку извлечения на дисководе
 // и снова его задвигаю
 // и снова вынимаю
 // а теперь ввожу udisks --umount /dev/sr0
 // это появляется сразу:
job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                FilesystemUnmount, initiated by uid 1000
changed:     /org/freedesktop/UDisks/devices/sr0
Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-id:                     /dev/disk/by-id/ata-Optiarc_DVD_RW_AD-7200S
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Чтв 15 Дек 2011 17:05:20
  system internal:             0
  removable:                   1
  has media:                   1 (detected at Чтв 15 Дек 2011 23:58:31)
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:
  presentation icon:
  automount hint:
  size:                        692715520
  block size:                  2048
  job underway:                FilesystemUnmount, initiated by uid 1000
  usage:                       filesystem
  type:                        iso9660
  version:
  uuid:
  label:                       AITap Boot CD
  optical disc:
    blank:                     0
    appendable:                0
    closed:                    1
    num tracks:                1
    num audio tracks:          0
    num sessions:              1
  drive:
    vendor:                    Optiarc
    model:                     Optiarc DVD RW AD-7200S
    revision:                  1.01
    serial:
    WWN:
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host4
    similar devices:
    media:                     optical_cd_r
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_plus_r optical_dvd_plus_r_dl optical_dvd_plus_rw optical_dvd_r optical_dvd_ram optical_dvd_rw
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available

job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                no
job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                DriveEject, initiated by uid 1000
changed:     /org/freedesktop/UDisks/devices/sr0
Showing information for /org/freedesktop/UDisks/devices/sr0
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sr0
  device:                      11:0
  device-file:                 /dev/sr0
    presentation:              /dev/sr0
    by-id:                     /dev/disk/by-id/ata-Optiarc_DVD_RW_AD-7200S
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Чтв 15 Дек 2011 17:05:20
  system internal:             0
  removable:                   1
  has media:                   0
    detects change:            1
    detection by polling:      1
    detection inhibitable:     1
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:
  presentation icon:
  automount hint:
  size:                        0
  block size:                  0
  job underway:                DriveEject, initiated by uid 1000
  usage:
  type:
  version:
  uuid:
  label:
  drive:
    vendor:                    Optiarc
    model:                     Optiarc DVD RW AD-7200S
    revision:                  1.01
    serial:
    WWN:
    detachable:                0
    can spindown:              0
    rotational media:          Yes, unknown rate
    write-cache:               unknown
    ejectable:                 1
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host4
    similar devices:
    media:
      compat:                  optical_cd optical_cd_r optical_cd_rw optical_dvd optical_dvd_plus_r optical_dvd_plus_r_dl optical_dvd_plus_rw optical_dvd_r optical_dvd_ram optical_dvd_rw
    interface:                 scsi
    if speed:                  (unknown)
    ATA SMART:                 not available

 // это появляется после того, как udisks выдвинет лоток дисковода и покажет на экране никому не нужное сообщение
job-changed: /org/freedesktop/UDisks/devices/sr0
  job underway:                no

Пробовал комментировать строчку в fstab. Не помогло, разве что mountpoint изменялся с /media/cdrom0 на неопределённый в /media/.

★★★★★

sysctl dev.cdrom.lock

что показывает? Попробуй изменить на 1, если там 0.

unanimous ★★★★★ ()
Ответ на: комментарий от unanimous

Было:
dev.cdrom.lock = 0

Сделал:
dev.cdrom.lock = 1

Ситуация осталась прежней.

И ведь при монтировании обычным mount с правами обычного пользователя всё прекрасно блокируется, и блокировалось раньше. В чём разница?

AITap ★★★★★ ()
Ответ на: комментарий от AITap

У меня gvfs как-то этот вопрос сам разруливает неплохо, может стоит попробовать?

kubism ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.