Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-26 Thread Andrey Borzenkov
В Fri, 16 Nov 2012 17:37:27 +0100
Warpme war...@o2.pl пишет:

 [Service]
 ExecStart=/usr/local/bin/run-backup.sh
 Type=forking
 GuessMainPID=false
 RemainAfterExit=no
 
 
 
 Issue:
 it works with:
 ENV{ID_FS_LABEL_ENC}==.myth.backup, RUN+=/usr/bin/systemctl start 
 ext-usb-backup.service
 

Is your actual backup program started in background by run-backup.sh
and script itself exits? Because that is what is implied by
Type=forking. If yes, it apparently takes over 30 seconds as systemctl
is killed by udev. You probably want to use systemctl --no-block in
this case.

 but not works with:
 ENV{ID_FS_LABEL_ENC}==.myth.backup, TAG+=systemd, 
 ENV{SYSTEMD_WANTS}=ext-usb-backup.service
 

Hard to tell without systemd debug output. You can enable it online by
sending signal to systemd, see man page.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-19 Thread Colin Guthrie
'Twas brillig, and Warpme at 18/11/12 18:38 did gyre and gimble:
 On 11/18/12 5:54 PM, Colin Guthrie wrote:
 

 Just as a general observation, I don't think you even need to delve into
 udev rules to make all this work as systemd handles device mounts
 internally.


 You can simply create a .mount unit for your drive such that when it is
 inserted it is mounted automatically (you may have to BindTo= and After=
 the corresponding .device unit for the external drive IIUC).

 Then, simply adjust your ext-usb-backup.service to
 BindTo=your-mount-unit.mount and After=your-mount-unit.mount

 This means that whenever the mount unit is started (i.e. when ever it's
 mounted), your service is started immediately after mount.


 Col

 Col,
 Thx for replay.
 I'm not sure is it possible to launch different actions by different
 vol.labels within .mount unit.
 I have USB HDDs with backups, TVarchives, movies and software.
 Idea is to have solution when attaching USB HDD automatically launches
 appropriate script supporting expected actions (like start backup or
 auto add movies to library).
 It is possible to achieve this .mount units ?

It should be possible to make a .mount unit trigger automatically when a
.device unit shows up.

It should also be possible to make a .service unit trigger automatically
when a .mount unit is started.

The key trick is using BindTo and After as I mentioned above.

I've not analysed your problem totally, but I think it should work
happily without needing to touch udev directly.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-18 Thread Colin Guthrie
'Twas brillig, and Warpme at 16/11/12 16:37 did gyre and gimble:
 On 11/15/12 9:05 PM, Kay Sievers wrote:
 You can use systemd to instantiate a service on device discovery (or
 run a daemon that listens to events from udev on old init systems).
 Check how bluetooth, cups printers, usbmux, ... is handled:
 TAG+=systemd,
 ENV{SYSTEMD_WANTS}=configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service
 TAG+=systemd, ENV{SYSTEMD_WANTS}+=bluetooth.target TAG+=systemd,
 ENV{SYSTEMD_WANTS}=usbmuxd.service Kay 
 Well,
 Things pretend to be simple seems to be not simple
 After few hours of fighting with issue I have to ask for help.
 
 udev rule:
 SUBSYSTEM==block, KERNEL==sd[c-z][0-9], GOTO=begin
 GOTO=end
 LABEL=begin
   ACTION==add, GOTO=begin_add
   ACTION==remove, GOTO=begin_remove
   GOTO=end
 
 LABEL=begin_add
   SYMLINK+=usbhd-%k, GROUP=root
   ENV{ID_FS_LABEL_ENC}=usbhd-%k
   IMPORT{program}=/sbin/blkid -o udev -p $tempnode
   ENV{ID_FS_LABEL_ENC}==.myth.backup,
 ENV{MOUNT_DIR}=/media/$env{ID_FS_LABEL_ENC}, RUN+=/bin/mkdir -p
 $env{MOUNT_DIR}, RUN+=/bin/mount -t auto -o rw,noauto,noatime /dev/%k
 $env{MOUNT_DIR}
   ENV{ID_FS_LABEL_ENC}==.myth.backup, TAG+=systemd,
 ENV{SYSTEMD_WANTS}=ext-usb-backup.service
   GOTO=end


Just as a general observation, I don't think you even need to delve into
udev rules to make all this work as systemd handles device mounts
internally.


You can simply create a .mount unit for your drive such that when it is
inserted it is mounted automatically (you may have to BindTo= and After=
the corresponding .device unit for the external drive IIUC).

Then, simply adjust your ext-usb-backup.service to
BindTo=your-mount-unit.mount and After=your-mount-unit.mount

This means that whenever the mount unit is started (i.e. when ever it's
mounted), your service is started immediately after mount.


Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-18 Thread Warpme

On 11/18/12 5:54 PM, Colin Guthrie wrote:



Just as a general observation, I don't think you even need to delve into
udev rules to make all this work as systemd handles device mounts
internally.


You can simply create a .mount unit for your drive such that when it is
inserted it is mounted automatically (you may have to BindTo= and After=
the corresponding .device unit for the external drive IIUC).

Then, simply adjust your ext-usb-backup.service to
BindTo=your-mount-unit.mount and After=your-mount-unit.mount

This means that whenever the mount unit is started (i.e. when ever it's
mounted), your service is started immediately after mount.


Col


Col,
Thx for replay.
I'm not sure is it possible to launch different actions by different 
vol.labels within .mount unit.

I have USB HDDs with backups, TVarchives, movies and software.
Idea is to have solution when attaching USB HDD automatically launches 
appropriate script supporting expected actions (like start backup or 
auto add movies to library).

It is possible to achieve this .mount units ?
br

attachment: warpme.vcf___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-16 Thread Warpme

On 11/15/12 9:05 PM, Kay Sievers wrote:
You can use systemd to instantiate a service on device discovery (or 
run a daemon that listens to events from udev on old init systems). 
Check how bluetooth, cups printers, usbmux, ... is handled: 
TAG+=systemd, 
ENV{SYSTEMD_WANTS}=configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service 
TAG+=systemd, ENV{SYSTEMD_WANTS}+=bluetooth.target TAG+=systemd, 
ENV{SYSTEMD_WANTS}=usbmuxd.service Kay 

Well,
Things pretend to be simple seems to be not simple
After few hours of fighting with issue I have to ask for help.

udev rule:
SUBSYSTEM==block, KERNEL==sd[c-z][0-9], GOTO=begin
GOTO=end
LABEL=begin
  ACTION==add, GOTO=begin_add
  ACTION==remove, GOTO=begin_remove
  GOTO=end

LABEL=begin_add
  SYMLINK+=usbhd-%k, GROUP=root
  ENV{ID_FS_LABEL_ENC}=usbhd-%k
  IMPORT{program}=/sbin/blkid -o udev -p $tempnode
  ENV{ID_FS_LABEL_ENC}==.myth.backup, 
ENV{MOUNT_DIR}=/media/$env{ID_FS_LABEL_ENC}, RUN+=/bin/mkdir -p 
$env{MOUNT_DIR}, RUN+=/bin/mount -t auto -o rw,noauto,noatime /dev/%k 
$env{MOUNT_DIR}
  ENV{ID_FS_LABEL_ENC}==.myth.backup, TAG+=systemd, 
ENV{SYSTEMD_WANTS}=ext-usb-backup.service

  GOTO=end



service file:
[Unit]
Description=MythtTV ExtUSB Backup Helper

[Service]
ExecStart=/usr/local/bin/run-backup.sh
Type=forking
GuessMainPID=false
RemainAfterExit=no



Issue:
it works with:
ENV{ID_FS_LABEL_ENC}==.myth.backup, RUN+=/usr/bin/systemctl start 
ext-usb-backup.service


but not works with:
ENV{ID_FS_LABEL_ENC}==.myth.backup, TAG+=systemd, 
ENV{SYSTEMD_WANTS}=ext-usb-backup.service


(With TAG+ENV approach udev behaves like line with TAG+ENV is 
non-existing: no any error nor any sign it is parsed)


Where the hell issue is ?





log for ENV{ID_FS_LABEL_ENC}==.myth.backup, RUN+=/usr/bin/systemctl 
start ext-usb-backup.service


Nov 16 16:00:31  LINK 'usbhd-sdc1' /etc/udev/rules.d/98-usbhd.rules:50
Nov 16 16:00:31  IMPORT '/sbin/blkid -o udev -p /dev/sdc1' 
/etc/udev/rules.d/98-usbhd.rules:52

Nov 16 16:00:31  starting '/sbin/blkid -o udev -p /dev/sdc1'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_LABEL=.myth.backup'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_LABEL_ENC=.myth.backup'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_UUID=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_UUID_ENC=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_SEC_TYPE=ext2'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_VERSION=1.0'

Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 'ID_FS_TYPE=ext3'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_USAGE=filesystem'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_PART_ENTRY_SCHEME=dos'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_PART_ENTRY_TYPE=0x83'
Nov 16 16:00:31  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_PART_ENTRY_NUMBER=1'

Nov 16 16:00:31  starting '/bin/mkdir -p /media/.myth.backup'
Nov 16 16:00:31  '/bin/mkdir -p /media/.myth.backup' [16538] exit with 
return code 0
Nov 16 16:00:31  starting '/bin/mount -t auto -o rw,noauto,noatime 
/dev/sdc1 /media/.myth.backup'
Nov 16 16:00:31  '/bin/mount -t auto -o rw,noauto,noatime /dev/sdc1 
/media/.myth.backup' [16539] exit with return code 0

Nov 16 16:00:31  starting '/usr/bin/systemctl start ext-usb-backup.service'
Nov 16 16:00:31  Starting MythtTV ExtUSB Backup Helper...
Nov 16 16:00:34  validate module index
Nov 16 16:00:37  validate module index
Nov 16 16:00:40  validate module index
Nov 16 16:00:43  validate module index
Nov 16 16:00:46  validate module index
Nov 16 16:00:49  validate module index
Nov 16 16:00:52  validate module index
Nov 16 16:00:55  validate module index
Nov 16 16:00:58  validate module index
Nov 16 16:01:01  worker [16535] 
/devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host12/target12:0:0/12:0:0:0/block/sdc/sdc1 
timeout; kill it
Nov 16 16:01:01  seq 1826 
'/devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host12/target12:0:0/12:0:0:0/block/sdc/sdc1' 
killed

Nov 16 16:01:01  seq 1826 done with -64
Nov 16 16:01:01  validate module index
Nov 16 16:01:01  worker [16535] exit
Nov 16 16:01:01  worker [16535] terminated by signal 9 (Killed)
Nov 16 16:01:01  worker [16535] cleaned up
Nov 16 16:01:18  Started MythtTV ExtUSB Backup Helper.



Log for ENV{ID_FS_LABEL_ENC}==.myth.backup, TAG+=systemd, 
ENV{SYSTEMD_WANTS}=ext-usb-backup.service


Nov 16 15:57:34  IMPORT '/sbin/blkid -o udev -p /dev/sdc1' 
/etc/udev/rules.d/98-usbhd.rules:52

Nov 16 15:57:34  starting '/sbin/blkid -o udev -p /dev/sdc1'
Nov 16 15:57:34  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_LABEL=.myth.backup'
Nov 16 15:57:34  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_LABEL_ENC=.myth.backup'
Nov 16 15:57:34  '/sbin/blkid -o udev -p /dev/sdc1'(out) 
'ID_FS_UUID=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
Nov 16 15:57:34  

[systemd-devel] systemd195: issue with udev launched script

2012-11-15 Thread Warpme

Hi *

Sometime ago upgraded my ArchLinux (kernel3.3.8) server to systemd195.
Today I discovered that my backup procedure fails. It was working OK 
with previous systemd.
Forgive me if this forum is wrong place to ask such questions, but as 
udev is now part of systemd - I decided to ask here...

I know that long tasks launched by udev should be detached.
Maybe some merciful soul help me with finding error in following approach:
(maybe there is better way do to launching scripts on USN attach ?)

Goal:
attaching USB-HD should launch backup script.

Solution:
udev rule mounting hd fs and launching script.

udev rule is following:
SUBSYSTEM==block, KERNEL==sd[c-z][0-9], GOTO=begin
GOTO=end
LABEL=begin
  ACTION==add, GOTO=begin_add
  ACTION==remove, GOTO=begin_remove
  GOTO=end

LABEL=begin_add
  SYMLINK+=usbhd-%k, GROUP=root
  ENV{ID_FS_LABEL_ENC}=usbhd-%k
  IMPORT{program}=/sbin/blkid -o udev -p $tempnode
  ENV{ID_FS_LABEL_ENC}==.myth.backup, GOTO=backup_begin
  ENV{ID_FS_LABEL_ENC}==USB-Movies*, GOTO=rips_begin
  GOTO=user_storage_begin

LABEL=backup_begin
  ENV{MOUNT_DIR}=/media/$env{ID_FS_LABEL_ENC}
  RUN+=/bin/mkdir -p $env{MOUNT_DIR}
  RUN+=/bin/mount -t auto -o rw,noauto,noatime /dev/%k $env{MOUNT_DIR}
  RUN+=/usr/bin/sleep 15
  RUN+=/usr/local/bin/run-backup.sh 
  GOTO=end

Issue:
Script starts but seems to be killed by udev :-(

relevant kernel log:
Nov 15 19:18:50 systemd-udevd[3749]: LINK 'usbhd-sdc1' 
/etc/udev/rules.d/98-usbhd.rules:52
Nov 15 19:18:50 systemd-udevd[3749]: IMPORT '/sbin/blkid -o udev -p 
/dev/sdc1' /etc/udev/rules.d/98-usbhd.rules:54
Nov 15 19:18:50 systemd-udevd[3796]: starting '/sbin/blkid -o udev -p 
/dev/sdc1'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_LABEL=.myth.backup'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_LABEL_ENC=.myth.backup'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_UUID=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_UUID_ENC=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_SEC_TYPE=ext2'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_VERSION=1.0'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_TYPE=ext3'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_FS_USAGE=filesystem'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_PART_ENTRY_SCHEME=dos'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_PART_ENTRY_TYPE=0x83'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_PART_ENTRY_NUMBER=1'
Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p 
/dev/sdc1'(out) 'ID_PART_ENTRY_OFFSET=63'
Nov 15 19:18:50 systemd-udevd[3749]: '/bin/mount -t auto -o 
rw,noauto,noatime /dev/sdc1 /media/.myth.backup' [3798] exit with return 
code 0

Nov 15 19:18:50 systemd-udevd[3801]: starting '/usr/bin/sleep 15'
Nov 15 19:18:52 systemd-udevd[180]: validate module index
Nov 15 19:18:55 systemd-udevd[180]: validate module index
Nov 15 19:18:58 systemd-udevd[180]: validate module index
Nov 15 19:19:01 systemd-udevd[180]: validate module index
Nov 15 19:19:04 systemd-udevd[180]: validate module index
Nov 15 19:19:05 systemd-udevd[3749]: '/usr/bin/sleep 15' [3801] exit 
with return code 0
Nov 15 19:19:05 systemd-udevd[3858]: starting 
'/usr/local/bin/run-backup.sh '

Nov 15 19:19:07 systemd-udevd[180]: validate module index
Nov 15 19:19:10 systemd-udevd[180]: validate module index
Nov 15 19:19:13 systemd-udevd[180]: validate module index
Nov 15 19:19:16 systemd-udevd[180]: validate module index
Nov 15 19:19:19 systemd-udevd[180]: worker [3749] 
/devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host11/target11:0:0/11:0:0:0/block/sdc/sdc1 
timeout; kill it
Nov 15 19:19:19 systemd-udevd[180]: seq 1787 
'/devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host11/target11:0:0/11:0:0:0/block/sdc/sdc1' 
killed

Nov 15 19:19:19 systemd-udevd[180]: seq 1787 done with -64
Nov 15 19:19:19 systemd-udevd[180]: validate module index
Nov 15 19:19:19 systemd-udevd[180]: worker [3749] exit
Nov 15 19:19:19 systemd-udevd[180]: worker [3749] terminated by signal 9 
(Killed)

Nov 15 19:19:19 systemd-udevd[180]: worker [3749] cleaned up
Nov 15 19:19:22 systemd-udevd[180]: cleanup idle workers
Nov 15 19:19:22 systemd-udevd[180]: validate module index
Nov 15 19:19:22 systemd-udevd[3750]: unload module index
Nov 15 19:19:22 systemd-udevd[180]: worker [3750] exit
Nov 15 19:19:22 systemd-udevd[180]: worker [3750] cleaned up
attachment: warpme.vcf___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-15 Thread Dave Reisner
On Thu, Nov 15, 2012 at 07:40:19PM +0100, Warpme wrote:
 Hi *
 
 Sometime ago upgraded my ArchLinux (kernel3.3.8) server to systemd195.
 Today I discovered that my backup procedure fails. It was working OK
 with previous systemd.
 Forgive me if this forum is wrong place to ask such questions, but
 as udev is now part of systemd - I decided to ask here...
 I know that long tasks launched by udev should be detached.

No, they aren't detached. They remain in a cgroup for the udev worker
which is eventually pruned. It's completely wrong to launch any long
running task from a udev rule and you should expect that it will be
killed. If you need to launch a process from a udev rule, use
ENV{SYSTEMD_WANTS} to activate a service.

 Maybe some merciful soul help me with finding error in following approach:
 (maybe there is better way do to launching scripts on USN attach ?)
 
 Goal:
 attaching USB-HD should launch backup script.
 
 Solution:
 udev rule mounting hd fs and launching script.

 udev rule is following:
 SUBSYSTEM==block, KERNEL==sd[c-z][0-9], GOTO=begin
 GOTO=end
 LABEL=begin
   ACTION==add, GOTO=begin_add
   ACTION==remove, GOTO=begin_remove
   GOTO=end
 
 LABEL=begin_add
   SYMLINK+=usbhd-%k, GROUP=root
   ENV{ID_FS_LABEL_ENC}=usbhd-%k
   IMPORT{program}=/sbin/blkid -o udev -p $tempnode
   ENV{ID_FS_LABEL_ENC}==.myth.backup, GOTO=backup_begin
   ENV{ID_FS_LABEL_ENC}==USB-Movies*, GOTO=rips_begin
   GOTO=user_storage_begin
 
 LABEL=backup_begin
   ENV{MOUNT_DIR}=/media/$env{ID_FS_LABEL_ENC}
   RUN+=/bin/mkdir -p $env{MOUNT_DIR}
   RUN+=/bin/mount -t auto -o rw,noauto,noatime /dev/%k $env{MOUNT_DIR}
   RUN+=/usr/bin/sleep 15
   RUN+=/usr/local/bin/run-backup.sh 
   GOTO=end
 
 Issue:
 Script starts but seems to be killed by udev :-(
 
 relevant kernel log:
 Nov 15 19:18:50 systemd-udevd[3749]: LINK 'usbhd-sdc1'
 /etc/udev/rules.d/98-usbhd.rules:52
 Nov 15 19:18:50 systemd-udevd[3749]: IMPORT '/sbin/blkid -o udev -p
 /dev/sdc1' /etc/udev/rules.d/98-usbhd.rules:54
 Nov 15 19:18:50 systemd-udevd[3796]: starting '/sbin/blkid -o udev
 -p /dev/sdc1'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_LABEL=.myth.backup'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_LABEL_ENC=.myth.backup'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_UUID=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out)
 'ID_FS_UUID_ENC=fd3104ea-d5c0-4a8f-beba-8ab69115b192'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_SEC_TYPE=ext2'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_VERSION=1.0'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_TYPE=ext3'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_FS_USAGE=filesystem'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_PART_ENTRY_SCHEME=dos'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_PART_ENTRY_TYPE=0x83'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_PART_ENTRY_NUMBER=1'
 Nov 15 19:18:50 systemd-udevd[3749]: '/sbin/blkid -o udev -p
 /dev/sdc1'(out) 'ID_PART_ENTRY_OFFSET=63'
 Nov 15 19:18:50 systemd-udevd[3749]: '/bin/mount -t auto -o
 rw,noauto,noatime /dev/sdc1 /media/.myth.backup' [3798] exit with
 return code 0
 Nov 15 19:18:50 systemd-udevd[3801]: starting '/usr/bin/sleep 15'
 Nov 15 19:18:52 systemd-udevd[180]: validate module index
 Nov 15 19:18:55 systemd-udevd[180]: validate module index
 Nov 15 19:18:58 systemd-udevd[180]: validate module index
 Nov 15 19:19:01 systemd-udevd[180]: validate module index
 Nov 15 19:19:04 systemd-udevd[180]: validate module index
 Nov 15 19:19:05 systemd-udevd[3749]: '/usr/bin/sleep 15' [3801] exit
 with return code 0
 Nov 15 19:19:05 systemd-udevd[3858]: starting
 '/usr/local/bin/run-backup.sh '
 Nov 15 19:19:07 systemd-udevd[180]: validate module index
 Nov 15 19:19:10 systemd-udevd[180]: validate module index
 Nov 15 19:19:13 systemd-udevd[180]: validate module index
 Nov 15 19:19:16 systemd-udevd[180]: validate module index
 Nov 15 19:19:19 systemd-udevd[180]: worker [3749] 
 /devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host11/target11:0:0/11:0:0:0/block/sdc/sdc1
 timeout; kill it
 Nov 15 19:19:19 systemd-udevd[180]: seq 1787 
 '/devices/pci:00/:00:09.0/:04:00.0/usb3/3-1/3-1:1.0/host11/target11:0:0/11:0:0:0/block/sdc/sdc1'
 killed
 Nov 15 19:19:19 systemd-udevd[180]: seq 1787 done with -64
 Nov 15 19:19:19 systemd-udevd[180]: validate module index
 Nov 15 19:19:19 systemd-udevd[180]: worker [3749] exit
 Nov 15 19:19:19 systemd-udevd[180]: worker [3749] terminated by
 signal 9 (Killed)
 Nov 15 19:19:19 systemd-udevd[180]: worker [3749] cleaned up
 Nov 15 19:19:22 systemd-udevd[180]: 

Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-15 Thread Kay Sievers
On Thu, Nov 15, 2012 at 7:40 PM, Warpme war...@o2.pl wrote:
 Sometime ago upgraded my ArchLinux (kernel3.3.8) server to systemd195.
 Today I discovered that my backup procedure fails. It was working OK with
 previous systemd.
 Forgive me if this forum is wrong place to ask such questions, but as udev
 is now part of systemd - I decided to ask here...
 I know that long tasks launched by udev should be detached.
 Maybe some merciful soul help me with finding error in following approach:
 (maybe there is better way do to launching scripts on USN attach ?)

Udev even handlers cannot run long running processes, they get cleaned
up after a timeout. That's what you see here.

Udev events are timing critical, and they might block the entire
bootup if they do not return in time. There is no sane way to make
udev run such scripts, handle that properly. It is not really made to
start such services.

You can use systemd to instantiate a service on device discovery (or
run a daemon that listens to events from udev on old init systems).

Check how bluetooth, cups printers, usbmux, ... is handled:
  TAG+=systemd,
ENV{SYSTEMD_WANTS}=configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service
  TAG+=systemd, ENV{SYSTEMD_WANTS}+=bluetooth.target
  TAG+=systemd, ENV{SYSTEMD_WANTS}=usbmuxd.service

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd195: issue with udev launched script

2012-11-15 Thread Warpme

On 11/15/12 9:05 PM, Kay Sievers wrote:

On Thu, Nov 15, 2012 at 7:40 PM, Warpme war...@o2.pl wrote:

Sometime ago upgraded my ArchLinux (kernel3.3.8) server to systemd195.
Today I discovered that my backup procedure fails. It was working OK with
previous systemd.
Forgive me if this forum is wrong place to ask such questions, but as udev
is now part of systemd - I decided to ask here...
I know that long tasks launched by udev should be detached.
Maybe some merciful soul help me with finding error in following approach:
(maybe there is better way do to launching scripts on USN attach ?)

Udev even handlers cannot run long running processes, they get cleaned
up after a timeout. That's what you see here.

Udev events are timing critical, and they might block the entire
bootup if they do not return in time. There is no sane way to make
udev run such scripts, handle that properly. It is not really made to
start such services.

You can use systemd to instantiate a service on device discovery (or
run a daemon that listens to events from udev on old init systems).

Check how bluetooth, cups printers, usbmux, ... is handled:
   TAG+=systemd,
ENV{SYSTEMD_WANTS}=configure-printer@usb-$env{BUSNUM}-$env{DEVNUM}.service
   TAG+=systemd, ENV{SYSTEMD_WANTS}+=bluetooth.target
   TAG+=systemd, ENV{SYSTEMD_WANTS}=usbmuxd.service

Kay


Kay, Dave
Million thx for quick replay !
It's great that systemd solves in nice way also this aspect.
I definitely will go systemd+templates route.
Thx again

attachment: warpme.vcf___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel