Re: [systemd-devel] [FIX] SANE udev rules processing performance

2020-12-07 Thread Marcin Kocur

W dniu 07.12.2020 o 11:25, Lennart Poettering pisze:

On So, 06.12.20 11:13, Marcin Kocur (marcin2...@gmail.com) wrote:


The concern is:
"Recalling #341 (closed), I do have some concerns about efficiency now that
those 650+ USB rules get processed for every non-removal event rather than
only for additions."

If you could answer in the MR comments, that would also be fine:

https://gitlab.com/sane-project/backends/-/merge_requests/541

Sorry for the stupid request, but I'm just a SANE user who tries to fix his
(and everyone's else) scanners. I don't have much knowledge about udev rules
processing performance.

Replied there now.

Lennart



Thanks a thousand! I guess there will be a major rules refactor at some 
day on  SANE's side...


--
Pozdrawiam / Greetings
Marcin Kocur █

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


[systemd-devel] SANE udev rules processing performance

2020-12-06 Thread Marcin Kocur

Hi all,
could someone with greater experience than mine address SANE's developer 
concerns about performance of changing |ACTION!="add" to 
|||ACTION=="remove" for processing all SANE rules? On my system they're 
located at:||


||/usr/lib/udev/rules.d/49-sane.rules:||

||*ACTION=="remove", GOTO="libsane_rules_end"*
ENV{DEVTYPE}=="usb_device", GOTO="libsane_create_usb_dev"
SUBSYSTEMS=="scsi", GOTO="libsane_scsi_rules_begin"
SUBSYSTEM=="usb_device", GOTO="libsane_usb_rules_begin"
SUBSYSTEM!="usb_device", GOTO="libsane_usb_rules_end"||

||This is the change:
||

||https://gitlab.com/marcin2006/backends/-/commit/1042a61c30e5ed3131f134290dea3820a70a3185
||

||The concern is:||
||"Recalling #341 (closed), I do have some concerns about efficiency now 
that those 650+ USB rules get processed for every non-removal event 
rather than only for additions."||


||If you could answer in the MR comments, that would also be fine:||

||https://gitlab.com/sane-project/backends/-/merge_requests/541||

||Sorry for the stupid request, but I'm just a SANE user who tries to 
fix his (and everyone's else) scanners. I don't have much knowledge 
about udev rules processing performance.

||

--
Pozdrawiam / Greetings
Marcin Kocur █

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


[systemd-devel] DisplayPort display non-persistent device naming

2020-10-29 Thread Marcin Kocur

Hello,

this is the output of turning off and on my display (using power button):


[mk@linux ~]$ udevadm  monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[79.909185] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
KERNEL[79.909318] remove 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3/i2c-dev/i2c-3 (i2c-dev)
KERNEL[79.909385] remove 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3 (i2c)
KERNEL[79.909564] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-2/drm_dp_aux1 
(drm_dp_aux_dev)
KERNEL[79.909599] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-2 (drm)
KERNEL[79.909733] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3/drm_dp_aux2 
(drm_dp_aux_dev)
KERNEL[79.909756] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3 (drm)
KERNEL[79.909882] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
UDEV  [79.912218] remove 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3/i2c-dev/i2c-3 (i2c-dev)
UDEV  [79.912301] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
UDEV  [79.912708] remove 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3 (i2c)
UDEV  [79.913400] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-2/drm_dp_aux1 
(drm_dp_aux_dev)
UDEV  [79.913832] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3/drm_dp_aux2 
(drm_dp_aux_dev)
UDEV  [79.913875] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-2 (drm)
UDEV  [79.914230] remove 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3 (drm)
UDEV  [79.914814] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
KERNEL[85.337964] add 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3/i2c-dev/i2c-3 (i2c-dev)
KERNEL[85.337996] add 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3 (i2c)
UDEV  [85.340976] add 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3/i2c-dev/i2c-3 (i2c-dev)
UDEV  [85.342384] add 
/devices/pci:00/:00:08.1/:08:00.0/i2c-3 (i2c)
KERNEL[85.482056] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3 (drm)
KERNEL[85.482116] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3/drm_dp_aux1 
(drm_dp_aux_dev)
KERNEL[85.482215] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
KERNEL[85.482231] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-4 (drm)
KERNEL[85.482308] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-4/drm_dp_aux2 
(drm_dp_aux_dev)
KERNEL[85.482386] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
KERNEL[85.482415] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
UDEV  [85.483698] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3 (drm)
UDEV  [85.485053] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-3/drm_dp_aux1 
(drm_dp_aux_dev)
UDEV  [85.486553] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
UDEV  [85.487973] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-4 (drm)
UDEV  [85.489186] add 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0/card0-DP-4/drm_dp_aux2 
(drm_dp_aux_dev)
UDEV  [85.490094] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)
UDEV  [85.491090] change 
/devices/pci:00/:00:08.1/:08:00.0/drm/card0 (drm)



The monitor was visible in xrandr as DP-2, after power off and on it's 
visible as DP-3 (DP-2 is still there "disconnected").


It's troublesome for:

- GUI display configurators

- scripting

- for Xorg configuration which stops to work:

Section "Monitor"
    Identifier  "DP-2"
    Option  "Primary" "true"
EndSection

Is this a bug or a feature?

--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] Which udev action is run on boot for my device?

2020-10-29 Thread Marcin Kocur

W dniu 26.10.2020 o 11:19, Lennart Poettering pisze:

Is this intended? Should I report bug to systemd or sane? The scanner is
connected to my PC all the time.

sane.

Ask them to run their rules on ACTION!="remove", i.e. on all actions
but "remove". And that includes add, bind, change, unbding and
everything else that might be added one day.

Lennart


Hi Lennart,

so I made a pull request to SANE as you suggested:

https://gitlab.com/sane-project/backends/-/merge_requests/541/diffs?commit_id=a9c181a211870ca8c129370156be813be84cf556

(which works on my system of course)

And now SANE leader is asking me if this is backwards compatible with 
older kernels and systemd versions. I assumed this change would work on 
anything but maybe you could confirm?


--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] Which udev action is run on boot for my device?

2020-10-26 Thread Marcin Kocur

W dniu 26.10.2020 o 11:19, Lennart Poettering pisze:

On So, 25.10.20 18:56, Marcin Kocur (marcin2...@gmail.com) wrote:


W dniu 25.10.2020 o 18:36, Marcin Kocur pisze:

Hello,

as the topic states, I want to know which action(s) from "add",
"remove", "change", "move", "online", "offline", "bind", and "unbind"
were triggered on my device. Is there any way to check that?

At the beginning of  /usr/lib/udev/rules.d/49-sane.rules there is:

ACTION!="add", GOTO="libsane_rules_end"

Udevadm info doesn't show libsane_matched property for my scanner.

If I trigger the device manually with action "change", the variable is
still not there, as per the rule.

But if I trigger it with "add", the variable is there and also uaccess
rule gets executed.

So the ultimate quesiton is: what kind of trigger was executed on my
device on boot time?


Okay, it seems that "bind" is the action executed. I just edit the ACTION
rule and restarted my PC until I found it.

The introduction of "bind" and "unbind" is some major kernel API
fuck-up btw. It's the main reason why packages should check for
!="remove" rather than =="add|change" or so. udev rules written for
old kernels simple didn't have to take "bind" and "unbind" into
account. The fact that kernel just added that willy-nilly breaks rules
all over the place. (that said, sane's apparent use of =="add" was
always broken, i.e. the omission of "change", so even without the
kernel bind/unbind mess the sane rules already were broken)

Also see the NEWS note on the upcoming systemd version 247:

https://github.com/systemd/systemd/blob/master/NEWS#L5


Is this intended? Should I report bug to systemd or sane? The scanner is
connected to my PC all the time.

sane.

Ask them to run their rules on ACTION!="remove", i.e. on all actions
but "remove". And that includes add, bind, change, unbding and
everything else that might be added one day.

Lennart

--
Lennart Poettering, Berlin


Thanks Lennart and Pekka,

I drawed SANE's maintainers attention to this:

https://gitlab.com/sane-project/backends/-/issues/371

https://gitlab.com/sane-project/backends/-/merge_requests/541

--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] Which udev action is run on boot for my device?

2020-10-25 Thread Marcin Kocur

W dniu 25.10.2020 o 18:36, Marcin Kocur pisze:

Hello,

as the topic states, I want to know which action(s) from "add", 
"remove", "change", "move", "online", "offline", "bind", and "unbind" 
were triggered on my device. Is there any way to check that?


At the beginning of  /usr/lib/udev/rules.d/49-sane.rules there is:

ACTION!="add", GOTO="libsane_rules_end"

Udevadm info doesn't show libsane_matched property for my scanner.

If I trigger the device manually with action "change", the variable is 
still not there, as per the rule.


But if I trigger it with "add", the variable is there and also uaccess 
rule gets executed.


So the ultimate quesiton is: what kind of trigger was executed on my 
device on boot time?


Okay, it seems that "bind" is the action executed. I just edit the 
ACTION rule and restarted my PC until I found it.


Is this intended? Should I report bug to systemd or sane? The scanner is 
connected to my PC all the time.


--
Pozdrawiam / Greetings
Marcin Kocur █

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


[systemd-devel] Which udev action is run on boot for my device?

2020-10-25 Thread Marcin Kocur

Hello,

as the topic states, I want to know which action(s) from "add", 
"remove", "change", "move", "online", "offline", "bind", and "unbind" 
were triggered on my device. Is there any way to check that?


At the beginning of  /usr/lib/udev/rules.d/49-sane.rules there is:

ACTION!="add", GOTO="libsane_rules_end"

Udevadm info doesn't show libsane_matched property for my scanner.

If I trigger the device manually with action "change", the variable is 
still not there, as per the rule.


But if I trigger it with "add", the variable is there and also uaccess 
rule gets executed.


So the ultimate quesiton is: what kind of trigger was executed on my 
device on boot time?


--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] [udev] Scanner rule not applied during boot

2020-10-21 Thread Marcin Kocur

W dniu 21.10.2020 o 08:52, Lennart Poettering pisze:

On Di, 20.10.20 23:16, Marcin Kocur (marcin2...@gmail.com) wrote:


Lennart,

I'm using outdated lxdm with Xfce.

I just disabled lxmd, copied fresh /etc/X11/xinit/xinitrc to ~/.xinitrc
(adding my environment exec command there) and started my environment from
startx: ACLs didn't change.


~/.xinitrc runs:
/etc/X11/xinit/xinitrc.d/50-systemd-user.sh
#!/bin/sh

systemctl --user import-environment DISPLAY XAUTHORITY

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
     dbus-update-activation-environment DISPLAY XAUTHORITY

fi


Those variables are:
[mk@linux ~]$ echo $DISPLAY
:0.0
[mk@linux ~]$ echo $XAUTHORITY

/home/mk/.Xauthority

I also tried out SDDM login manager: ACLs weren't applied.

Maybe pam_systemd is missing from your PAM stacks? This smells like a
distro integration thing to me, might make sense to inquire your
distro maintainers about this.

Consider logging in, and using "loginctl" to check if your session is
properly recognized and tracked.


Hmm for me it looks perfectly fine:

[mk@linux ~]$ loginctl session-status
1 - mk (1000)
   Since: Wed 2020-10-21 19:53:10 CEST; 3h 30min ago
  Leader: 533 (lxdm-session)
    Seat: seat0; vc1
 TTY: tty1
 Service: lxdm; type x11; class user
   State: active
    Unit: session-1.scope
  ├─  533 /usr/lib/lxdm/lxdm-session
  ├─  542 xfce4-session
  ├─  628 /usr/bin/ssh-agent -s
  ├─  633 xfwm4
  ├─  655 xfsettingsd
  ├─  656 xfce4-panel
  ├─  668 Thunar --daemon
  ├─  673 xfdesktop

[mk@linux ~]$ echo $XDG_SESSION_ID
1

[mk@linux ~]$journalctl -xe |grep systemd-logind

[...]

Oct 21 19:53:10 linux systemd-logind[450]: New session 1 of user mk

[mk@linux ~]$ echo $XDG_SESSION_ID
1
[mk@linux ~]$ echo $XDG_SESSION_TYPE
x11
[mk@linux ~]$ echo  $XDG_SESSION_CLASS
user
[mk@linux ~]$ echo  $XDG_SESSION_DESKTOP

[mk@linux ~]$ echo  $XDG_SEAT
seat0
[mk@linux ~]$ echo  $XDG_VTNR
1

[mk@linux ~]$ cat '/etc/pam.d/system-login'
#%PAM-1.0

auth   required   pam_shells.so
auth   requisite  pam_nologin.so
auth   include    system-auth

account    required   pam_access.so
account    required   pam_nologin.so
account    include    system-auth

password   include    system-auth

session    optional   pam_loginuid.so
session    optional   pam_keyinit.so   force revoke
session    include    system-auth
session    optional   pam_motd.so  motd=/etc/motd
session    optional   pam_mail.so  dir=/var/spool/mail standard 
quiet

-session   optional   pam_systemd.so
session    required   pam_env.so   user_readenv=


I can surely report to Arch bugtracker, but I can't find what to report. 
Everything seems to be fine, except it's not working ;) I need something 
to go on...


--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] [udev] Scanner rule not applied during boot

2020-10-20 Thread Marcin Kocur

W dniu 20.10.2020 o 20:05, Lennart Poettering pisze:

On Di, 20.10.20 18:47, Marcin Kocur (marcin2...@gmail.com) wrote:


I don't how how this uaccess tag works, but I can assume that my scanner
which is libsane_matched (as set by
/usr/lib/udev/rules.d/49-sane.rules) gets ACL permission added somewhere
later thanks to this uaccess tag.

The question is if it works on manual trigger, why doesn't on boot time?

Devices that are marked with "uaccess" get an ACL installed that
always points to the user who owns the foreground session. This should
be applied whenever you log in or switch foreground session.

If this doesn't work at login time there must be something borked with
your display manager, or possibly systemd-logind.

Which systemd version is this? Which distro? Which display manager?

Lennart

--
Lennart Poettering, Berlin



Lennart,

I'm using outdated lxdm with Xfce.

I just disabled lxmd, copied fresh /etc/X11/xinit/xinitrc to ~/.xinitrc 
(adding my environment exec command there) and started my environment 
from startx: ACLs didn't change.



~/.xinitrc runs:
/etc/X11/xinit/xinitrc.d/50-systemd-user.sh
#!/bin/sh

systemctl --user import-environment DISPLAY XAUTHORITY

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY

fi


Those variables are:
[mk@linux ~]$ echo $DISPLAY
:0.0
[mk@linux ~]$ echo $XAUTHORITY

/home/mk/.Xauthority

I also tried out SDDM login manager: ACLs weren't applied.

My software is:
systemd: 246.6-1
linux: 5.8.14.arch1-1
sane: 1.0.31-1
libusb: 1.0.23-2
distro: Archlinux

--
Pozdrawiam / Greetings
Marcin Kocur █

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


Re: [systemd-devel] [udev] Scanner rule not applied during boot

2020-10-20 Thread Marcin Kocur

W dniu 20.10.2020 o 13:44, Lennart Poettering pisze:

On Mo, 19.10.20 21:19, Marcin Kocur (marcin2...@gmail.com) wrote:


Hello systemd devs and users,

I need an advice regarding USB scanner which rule is not(?) processed at
boot time. When I trigger it manually, the scanner device file gets proper
permissions.

Here's the rule:

cat /usr/lib/udev/rules.d/49-sane.rules |grep -A1 '1200 TA'
# Mustek BearPaw 1200 CS | Mustek BearPaw 1200 TA
ATTRS{idVendor}=="055f", ATTRS{idProduct}=="021e", MODE="0664",
GROUP="scanner", ENV{libsane_matched}="yes"

Here it is how it looks like directly after the boot:

lsusb
Bus 001 Device 003: ID 055f:021e Mustek Systems, Inc. BearPaw 1200 TA/CS


getfacl /dev/bus/usb/001/003
# file: dev/bus/usb/001/007
# owner: root
# group: scanner
user::rw-
group::rw-
other::r--

And this is how it looks after triggering manually:
udevadm trigger -c add /dev/bus/usb/001/003:

getfacl /dev/bus/usb/001/003
# file: dev/bus/usb/001/007
# owner: root
# group: scanner
user::rw-
user:mk:rw-   <<<<<<<< NOW MY USER IS HERE

And?

It's still owned by the "scanner" group like before, which the line
three up shows you.

The extra ACL entry probably comes from some "uaccess" rule somebody
sets on the device. But I don#t now what rules you added or what sane
sets there precisely.

Lennart

--
Lennart Poettering, Berlin


Hi Lennart, thanks for your answer.

You're probably right, this rule sets different permissions than what is 
set on the device. So it must be some other rule.


I found via

udevadm test /dev/bus/usb/001/003

that there is a file /usr/lib/udev/rules.d/70-uaccess.rules which says:

# SCSI and USB scanners

ENV{libsane_matched}=="yes", TAG+="uaccess"

I don't how how this uaccess tag works, but I can assume that my scanner 
which is libsane_matched (as set by
/usr/lib/udev/rules.d/49-sane.rules) gets ACL permission added somewhere 
later thanks to this uaccess tag.


The question is if it works on manual trigger, why doesn't on boot time?

--
Pozdrawiam / Greetings
Marcin Kocur █

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


[systemd-devel] [udev] Scanner rule not applied during boot

2020-10-19 Thread Marcin Kocur


Hello systemd devs and users,

I need an advice regarding USB scanner which rule is not(?) processed at 
boot time. When I trigger it manually, the scanner device file gets 
proper permissions.


Here's the rule:

cat /usr/lib/udev/rules.d/49-sane.rules |grep -A1 '1200 TA'
# Mustek BearPaw 1200 CS | Mustek BearPaw 1200 TA
ATTRS{idVendor}=="055f", ATTRS{idProduct}=="021e", MODE="0664", 
GROUP="scanner", ENV{libsane_matched}="yes"


Here it is how it looks like directly after the boot:

lsusb
Bus 001 Device 003: ID 055f:021e Mustek Systems, Inc. BearPaw 1200 TA/CS


getfacl /dev/bus/usb/001/003
# file: dev/bus/usb/001/007
# owner: root
# group: scanner
user::rw-
group::rw-
other::r--

And this is how it looks after triggering manually:
udevadm trigger -c add /dev/bus/usb/001/003:

getfacl /dev/bus/usb/001/003
# file: dev/bus/usb/001/007
# owner: root
# group: scanner
user::rw-
user:mk:rw-   <<<<<<<< NOW MY USER IS HERE
group::rw-
mask::rw-
other::r--

Of course this is the effect I expect to happen directly after boot. It 
changed most likely after I upgraded my PC hardware. I tried to 
downgrade systemd, kernel and sane without any positive effect. This was 
working for me this way for past 12 years ;)


I enabled udev debug level and browsed whole journalctl but haven't 
found there anything about my device (except the fact that it's detected 
by kernel):

journalctl -b |grep '021e'

Oct 19 20:06:26 linux kernel: usb 1-6: New USB device found, 
idVendor=055f, idProduct=021e, bcdDevice= 1.00


I'm attaching the zipped log from systemd-udev.service.


My hardware:
Archlinux
systemd: 246.6-1
linux: 5.8.14.arch1-1
sane: 1.0.31-1
libusb: 1.0.23-2
Motherboard: Gibabyte B550M AORUS PRO (rev. 1.0)
Scanner: Mustek BearPaw 1200 TA
CPU: AMD Ryzen 3 PRO 4350G with Radeon Graphics

Many thanks for every tip I get to resolve this problem!

--
Pozdrawiam / Greetings
Marcin Kocur █



<>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to spin down a disc with systemd?

2014-05-01 Thread Marcin Kocur

W dniu 30.04.2014 13:02, Lennart Poettering pisze:

On Wed, 30.04.14 01:02, Marcin Kocur (marcin2...@gmail.com) wrote:


Hello all,

I wrote a service /etc/systemd/system/disable-2nd-hdd.service. I
have 2 HDD's where one of them doesn't need to work all the time. So
I thought it'd be cool to shut it down after 30 minutes of
inactivity (the disc isn't mounted when system starts):
/usr/bin/hdparm -S 241 /dev/sdb

Then I wrote a service:

[Unit]
Description=Disable sdb
Requires=local-fs.target
After=local-fs.target

These two lines are implied and hence can be removed.


My intention was to be sure that the disc is ready to be spun down.


Note that devices are probed asynchronously, and a device not needed at
boot is not waited for. THis means that your service might run before
the harddisk showed up in the kernel, or possibly that your hdparm
command is invoked before the initializating/probing/identifying of the
hdd or its filesystems is compelted, thus possibly negating the effect
of your command.

YOu probably want to invoke your commandn with RUN from a udev rule so
that it is run when the hw is found.


Thanks, I expected such situation, namely that disc is somehow probed or 
activated AFTER I issue hdparm command which causes it wake up again. 
Right. But I really expected that systemd is able to determine when the 
disc is ready and I can somehow pass this in Requires= or After= keys. 
My intention was to learn systemd a bit, not udev's hackish syntax ;p


--
Pozdrawiam / Greetings
Marcin Kocur █
Dane kontaktowe / Contact details: http://koci.net.pl/email

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


Re: [systemd-devel] Disable timers

2014-04-30 Thread Marcin Kocur

W dniu 30.04.2014 01:39, David Timothy Strauss pisze:

systemctl disable or systemctl mask. You also have to stop it first,
as that only changes the default.


systemctl mask, disable doesn't seems to work. Thanks!

--
Pozdrawiam / Greetings
Marcin Kocur █
Dane kontaktowe / Contact details: http://koci.net.pl/email

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


[systemd-devel] How to spin down a disc with systemd?

2014-04-29 Thread Marcin Kocur

Hello all,

I wrote a service /etc/systemd/system/disable-2nd-hdd.service. I have 2 
HDD's where one of them doesn't need to work all the time. So I thought 
it'd be cool to shut it down after 30 minutes of inactivity (the disc 
isn't mounted when system starts):

/usr/bin/hdparm -S 241 /dev/sdb

Then I wrote a service:

[Unit]
Description=Disable sdb
Requires=local-fs.target
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/bin/hdparm -S 241 /dev/sdb

[Install]
WantedBy=multi-user.target

Which seems to work:

[root@linux mk]# systemctl status disable-2nd-hdd.service
● disable-2nd-hdd.service - Disable sdb
Loaded: loaded (/etc/systemd/system/disable-2nd-hdd.service; enabled)
Active: inactive (dead) since pon 2014-04-28 10:00:53 CEST; 21min ago
Main PID: 248 (code=exited, status=0/SUCCESS)

kwi 28 10:00:53 linux hdparm[248]: /dev/sdb:
kwi 28 10:00:53 linux hdparm[248]: setting standby to 241 (30 minutes)

But it doesn't work, like it had never happened, the disc is not spun down.

When I change the command to /usr/bin/hdparm -y /dev/sdb (spin down disc 
immediately), the disc is spun down while booting but is starts again 
right away.


When I manually start this service after system has already booted, it 
works as expected.


Kindly asking for some help.

--
Pozdrawiam / Greetings
Marcin Kocur █
Dane kontaktowe / Contact details: http://koci.net.pl/email

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


[systemd-devel] Disable timers

2014-04-29 Thread Marcin Kocur

Hello again,

I have another question. How I can disable a timer installed by system 
vendor? I tried creating an empty service.d/service.conf file and 
systemctl disable service.timer and systemctl disable service.service.


I think you should really improve man pages. Disabling a service is 
really a basic thing and I just can't find the info. This is not only 
mine impression. Please have a look here:

http://jason.the-graham.com/2013/03/06/how-to-use-systemd-timers/

--
Pozdrawiam / Greetings
Marcin Kocur █
Dane kontaktowe / Contact details: http://koci.net.pl/email

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