[systemd-devel] [PATCH] Document ...|... udev match syntax
--- man/udev.xml | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/man/udev.xml b/man/udev.xml index db72937..2948b9c 100644 --- a/man/udev.xml +++ b/man/udev.xml @@ -272,8 +272,8 @@ /varlistentry /variablelist - paraMost of the fields support shell glob pattern matching. The following - pattern characters are supported:/para + paraMost of the fields support shell glob pattern matching and + alternate patterns. The following special characters are supported:/para variablelist varlistentry termliteral*/literal/term @@ -300,6 +300,14 @@ any characters not enclosed are matched./para /listitem /varlistentry +varlistentry + termliteral|/literal/term + listitem +paraSeparates alternative patterns. For example, the pattern string +literalabc|x*/literal would match either literalabc/literal +or literalx*/literal./para + /listitem +/varlistentry /variablelist paraThe following keys can get values assigned:/para -- tg: (d74f9e8..) u/udev-man-match-syntax (depends on: master) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Match section of .link file not working
Ok, so there is only one problem now: ID_PATH is the same for all my vif interfaces, and i need to select only one of them. Please show udevadm info -q all for each interface. P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlan0 E: DEVPATH=/devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlan0 E: DEVTYPE=wlan E: ID_BUS=usb E: ID_MODEL=USB2.0_WLAN E: ID_MODEL_ENC=USB2.0\x20WLAN E: ID_MODEL_FROM_DATABASE=TP-Link TL-WN821N v2 / TL-WN822N v1 802.11n [Atheros AR9170] E: ID_MODEL_ID=1002 E: ID_NET_DRIVER=carl9170 E: ID_NET_NAME_MAC=wlx6cfdb907b167 E: ID_OUI_FROM_DATABASE=Proware Technologies Co Ltd. E: ID_PATH=platform-musb-hdrc.1.auto-usb-0:1:1.0 E: ID_PATH_TAG=platform-musb-hdrc_1_auto-usb-0_1_1_0 E: ID_REVISION=0106 E: ID_SERIAL=ATHER_USB2.0_WLAN_12345 E: ID_SERIAL_SHORT=12345 E: ID_TYPE=generic E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class E: ID_USB_DRIVER=carl9170 E: ID_USB_INTERFACES=:ff: E: ID_USB_INTERFACE_NUM=00 E: ID_USB_PROTOCOL_FROM_DATABASE=Vendor Specific Protocol E: ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass E: ID_VENDOR=ATHER E: ID_VENDOR_ENC=ATHER E: ID_VENDOR_FROM_DATABASE=Atheros Communications, Inc. E: ID_VENDOR_ID=0cf3 E: IFINDEX=10 E: INTERFACE=wlan0 E: SUBSYSTEM=net E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/wlan0 E: TAGS=:systemd: E: USEC_INITIALIZED=805171 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv1 E: DEVPATH=/devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv1 E: DEVTYPE=wlan E: ID_BUS=usb E: ID_MODEL=USB2.0_WLAN E: ID_MODEL_ENC=USB2.0\x20WLAN E: ID_MODEL_FROM_DATABASE=TP-Link TL-WN821N v2 / TL-WN822N v1 802.11n [Atheros AR9170] E: ID_MODEL_ID=1002 E: ID_NET_DRIVER=carl9170 E: ID_NET_NAME_MAC=wlx6cfdb907b167 E: ID_OUI_FROM_DATABASE=Proware Technologies Co Ltd. E: ID_PATH=platform-musb-hdrc.1.auto-usb-0:1:1.0 E: ID_PATH_TAG=platform-musb-hdrc_1_auto-usb-0_1_1_0 E: ID_REVISION=0106 E: ID_SERIAL=ATHER_USB2.0_WLAN_12345 E: ID_SERIAL_SHORT=12345 E: ID_TYPE=generic E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class E: ID_USB_DRIVER=carl9170 E: ID_USB_INTERFACES=:ff: E: ID_USB_INTERFACE_NUM=00 E: ID_USB_PROTOCOL_FROM_DATABASE=Vendor Specific Protocol E: ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass E: ID_VENDOR=ATHER E: ID_VENDOR_ENC=ATHER E: ID_VENDOR_FROM_DATABASE=Atheros Communications, Inc. E: ID_VENDOR_ID=0cf3 E: IFINDEX=11 E: INTERFACE=wlv1 E: SUBSYSTEM=net E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/wlv1 E: TAGS=:systemd: E: USEC_INITIALIZED=113969784 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv2 E: DEVPATH=/devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv2 E: DEVTYPE=wlan E: ID_BUS=usb E: ID_MODEL=USB2.0_WLAN E: ID_MODEL_ENC=USB2.0\x20WLAN E: ID_MODEL_FROM_DATABASE=TP-Link TL-WN821N v2 / TL-WN822N v1 802.11n [Atheros AR9170] E: ID_MODEL_ID=1002 E: ID_NET_DRIVER=carl9170 E: ID_NET_NAME_MAC=wlx6cfdb907b167 E: ID_OUI_FROM_DATABASE=Proware Technologies Co Ltd. E: ID_PATH=platform-musb-hdrc.1.auto-usb-0:1:1.0 E: ID_PATH_TAG=platform-musb-hdrc_1_auto-usb-0_1_1_0 E: ID_REVISION=0106 E: ID_SERIAL=ATHER_USB2.0_WLAN_12345 E: ID_SERIAL_SHORT=12345 E: ID_TYPE=generic E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class E: ID_USB_DRIVER=carl9170 E: ID_USB_INTERFACES=:ff: E: ID_USB_INTERFACE_NUM=00 E: ID_USB_PROTOCOL_FROM_DATABASE=Vendor Specific Protocol E: ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass E: ID_VENDOR=ATHER E: ID_VENDOR_ENC=ATHER E: ID_VENDOR_FROM_DATABASE=Atheros Communications, Inc. E: ID_VENDOR_ID=0cf3 E: IFINDEX=12 E: INTERFACE=wlv2 E: SUBSYSTEM=net E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/wlv2 E: TAGS=:systemd: E: USEC_INITIALIZED=114033988 wlv2 is a client and needs a stable mac, otherwise the dhcp f*cs up. wlv1 is an acesspoint, and needs a mac different from wlv2. (This should probably also be stable, but i can live with random for this one.) (yes, the wlv3 was just for testing, wlv1 and wlv2 are the real ones) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] [PATCH 2/3] resume: add a tool to write a device node's major:minor to /sys/power/resume.
On Sat, Aug 23, 2014 at 2:47 PM, Ivan Shapovalov intelfx...@gmail.com wrote: This can be used to initiate a resume from hibernation by path to a swap device containing the hibernation image. The respective templated unit is also added. It is instantiated using path to the desired resume device. --- Makefile-man.am | 9 + Makefile.am | 28 -- man/systemd-res...@.service.xml | 81 +++ src/resume/Makefile | 1 + src/resume/resume.c | 82 units/systemd-res...@.service.in | 23 +++ 6 files changed, 220 insertions(+), 4 deletions(-) create mode 100644 man/systemd-res...@.service.xml create mode 12 src/resume/Makefile create mode 100644 src/resume/resume.c create mode 100644 units/systemd-res...@.service.in diff --git a/Makefile-man.am b/Makefile-man.am index 5c289dd..00daae2 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -76,6 +76,8 @@ MANPAGES += \ man/systemd-nspawn.1 \ man/systemd-path.1 \ man/systemd-remount-fs.service.8 \ + man/systemd-resume-generator.8 \ + man/systemd-resume@.service.8 \ man/systemd-run.1 \ man/systemd-shutdownd.service.8 \ man/systemd-sleep.conf.5 \ @@ -206,6 +208,7 @@ MANPAGES_ALIAS += \ man/systemd-poweroff.service.8 \ man/systemd-reboot.service.8 \ man/systemd-remount-fs.8 \ + man/systemd-resume.8 \ man/systemd-shutdown.8 \ man/systemd-shutdownd.8 \ man/systemd-shutdownd.socket.8 \ @@ -311,6 +314,7 @@ man/systemd-kexec.service.8: man/systemd-halt.service.8 man/systemd-poweroff.service.8: man/systemd-halt.service.8 man/systemd-reboot.service.8: man/systemd-halt.service.8 man/systemd-remount-fs.8: man/systemd-remount-fs.service.8 +man/systemd-resume.8: man/systemd-resume@.service.8 man/systemd-shutdown.8: man/systemd-halt.service.8 man/systemd-shutdownd.8: man/systemd-shutdownd.service.8 man/systemd-shutdownd.socket.8: man/systemd-shutdownd.service.8 @@ -592,6 +596,9 @@ man/systemd-reboot.service.html: man/systemd-halt.service.html man/systemd-remount-fs.html: man/systemd-remount-fs.service.html $(html-alias) +man/systemd-resume.html: man/systemd-res...@.service.html + $(html-alias) + man/systemd-shutdown.html: man/systemd-halt.service.html $(html-alias) @@ -1626,6 +1633,8 @@ EXTRA_DIST += \ man/systemd-readahead-replay.service.xml \ man/systemd-remount-fs.service.xml \ man/systemd-resolved.service.xml \ + man/systemd-resume-generator.xml \ + man/systemd-res...@.service.xml \ man/systemd-rfk...@.service.xml \ man/systemd-run.xml \ man/systemd-shutdownd.service.xml \ diff --git a/Makefile.am b/Makefile.am index e238cde..820d082 100644 --- a/Makefile.am +++ b/Makefile.am @@ -371,13 +371,15 @@ rootlibexec_PROGRAMS = \ systemd-sleep \ systemd-bus-proxyd \ systemd-socket-proxyd \ - systemd-update-done + systemd-update-done \ + systemd-resume systemgenerator_PROGRAMS = \ systemd-getty-generator \ systemd-fstab-generator \ systemd-system-update-generator \ - systemd-debug-generator + systemd-debug-generator \ + systemd-resume-generator dist_bashcompletion_DATA = \ shell-completion/bash/busctl \ @@ -509,7 +511,8 @@ nodist_systemunit_DATA = \ units/initrd-udevadm-cleanup-db.service \ units/initrd-switch-root.service \ units/systemd-nspawn@.service \ - units/systemd-update-done.service + units/systemd-update-done.service \ + units/systemd-resume@.service dist_userunit_DATA = \ units/user/basic.target \ @@ -556,7 +559,8 @@ EXTRA_DIST += \ units/initrd-udevadm-cleanup-db.service.in \ units/initrd-switch-root.service.in \ units/systemd-nsp...@.service.in \ - units/systemd-update-done.service.in + units/systemd-update-done.service.in \ + units/systemd-res...@.service.in CLEANFILES += \ units/console-shell.service.m4 \ @@ -1930,6 +1934,14 @@ systemd_delta_LDADD = \ libsystemd-shared.la # -- +systemd_resume_SOURCES = \ + src/resume/resume.c + +systemd_resume_LDADD = \ + libsystemd-internal.la \ + libsystemd-shared.la + +# -- systemd_getty_generator_SOURCES = \ src/getty-generator/getty-generator.c @@ -1962,6 +1974,14 @@ systemd_system_update_generator_LDADD = \ libsystemd-label.la \ libsystemd-shared.la +# --
Re: [systemd-devel] [RFC] [PATCHv2 3/3] resume-generator: add a generator for instantiating the resume unit.
On Sat, Aug 23, 2014 at 8:59 PM, Ivan Shapovalov intelfx...@gmail.com wrote: resume-generator understands resume= kernel command line parameter and instantiates the systemd-resume@.service accordingly if it is passed. This enables resume from hibernation using device specified on the kernel command line, where the device path may point to an arbitrary udev-created symlink, not only /dev/sdXY which is understood by the in-kernel implementation. --- Makefile-man.am | 2 + man/kernel-command-line.xml | 13 - man/systemd-resume-generator.xml| 91 src/resume-generator/Makefile | 1 + src/resume-generator/resume-generator.c | 93 + 5 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 man/systemd-resume-generator.xml create mode 12 src/resume-generator/Makefile create mode 100644 src/resume-generator/resume-generator.c diff --git a/Makefile-man.am b/Makefile-man.am index be19905..00daae2 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -76,6 +76,7 @@ MANPAGES += \ man/systemd-nspawn.1 \ man/systemd-path.1 \ man/systemd-remount-fs.service.8 \ + man/systemd-resume-generator.8 \ man/systemd-resume@.service.8 \ man/systemd-run.1 \ man/systemd-shutdownd.service.8 \ @@ -1632,6 +1633,7 @@ EXTRA_DIST += \ man/systemd-readahead-replay.service.xml \ man/systemd-remount-fs.service.xml \ man/systemd-resolved.service.xml \ + man/systemd-resume-generator.xml \ man/systemd-res...@.service.xml \ man/systemd-rfk...@.service.xml \ man/systemd-run.xml \ diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index f244bfc..4bc6cee 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -351,6 +351,16 @@ /listitem /varlistentry +varlistentry +termvarnameresume=/varname/term + +listitem +paraEnables resume from hibernation +using the specified device. For +details, see + citerefentryrefentrytitlesystemd-resume-generator/refentrytitlemanvolnum8/manvolnum/citerefentry./para +/listitem +/varlistentry /variablelist /refsect1 @@ -373,7 +383,8 @@ citerefentryrefentrytitlesystemd-gpt-auto-generator/refentrytitlemanvolnum8/manvolnum/citerefentry, citerefentryrefentrytitlesystemd-modules-load.service/refentrytitlemanvolnum8/manvolnum/citerefentry, citerefentryrefentrytitlesystemd-backlight@.service/refentrytitlemanvolnum8/manvolnum/citerefentry, - citerefentryrefentrytitlesystemd-rfkill@.service/refentrytitlemanvolnum8/manvolnum/citerefentry + citerefentryrefentrytitlesystemd-rfkill@.service/refentrytitlemanvolnum8/manvolnum/citerefentry, + citerefentryrefentrytitlesystemd-resume-generator/refentrytitlemanvolnum8/manvolnum/citerefentry /para /refsect1 diff --git a/man/systemd-resume-generator.xml b/man/systemd-resume-generator.xml new file mode 100644 index 000..7962534 --- /dev/null +++ b/man/systemd-resume-generator.xml @@ -0,0 +1,91 @@ +?xml version=1.0? +!--*-nxml-*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; +!-- + This file is part of systemd. + + Copyright 2014 Ivan Shapovalov + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +-- +refentry id=systemd-resume-generator + +refentryinfo +titlesystemd-resume-generator/title +productnamesystemd/productname + +authorgroup +author +contribDeveloper/contrib +firstnameIvan/firstname +
Re: [systemd-devel] [PATCH] TODO: add molly-guard functionality
On 24 August 2014 04:26, Josh Triplett j...@joshtriplett.org wrote: + - add molly-guard functionality: prompt for hostname if interactively shutting down a remote system (running as child of ssh) I'll assume (and hope) that both the hostname prompt and SSH child rule are merely example configurations of a more generic system. SSH is far from the only possible use-case, and hostnames aren't always that relevant. Which makes me wonder whether this can't already be done today, with some simple Requires/ExecStart{,Pre}/... snippets on shutdown.target. These could even be shipped by default, pointing to some empty systemd/shutdown.d directory. (Now, that still sounds quite dirty, and leaves an unpleasant SysV aftertaste; but it's a lot better than hard-coding this [*if* that's what anyone is contemplating. Perhaps I'm being paranoid, but I never know when adding another --disable- switch to ./configure will finally return E2BIG...]) Regards, T G-R ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Match section of .link file not working
В Sun, 24 Aug 2014 09:19:13 +0200 Simon Peeters peeters.si...@gmail.com пишет: Ok, so there is only one problem now: ID_PATH is the same for all my vif interfaces, and i need to select only one of them. Please show udevadm info -q all for each interface. P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlan0 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv1 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv2 wlv2 is a client and needs a stable mac, otherwise the dhcp f*cs up. wlv1 is an acesspoint, and needs a mac different from wlv2. (This should probably also be stable, but i can live with random for this one.) So you have single device that exports multiple interfaces. To distinguish between them driver would need to provide some persistent information about each interface. I understand that dev_id (or dev_port) is supposed to be it, but as of now almost no driver actually bothers to set them. I wonder how is it possible to match such devices at all ... (yes, the wlv3 was just for testing, wlv1 and wlv2 are the real ones) You mean wlan0? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Match section of .link file not working
2014-08-24 20:29 GMT+02:00 Andrei Borzenkov arvidj...@gmail.com: В Sun, 24 Aug 2014 09:19:13 +0200 Simon Peeters peeters.si...@gmail.com пишет: Ok, so there is only one problem now: ID_PATH is the same for all my vif interfaces, and i need to select only one of them. Please show udevadm info -q all for each interface. P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlan0 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv1 P: /devices/ocp/4740.usb/47401c00.usb/musb-hdrc.1.auto/usb2/2-1/2-1:1.0/net/wlv2 wlv2 is a client and needs a stable mac, otherwise the dhcp f*cs up. wlv1 is an acesspoint, and needs a mac different from wlv2. (This should probably also be stable, but i can live with random for this one.) So you have single device that exports multiple interfaces. No, and yes. The wireless adaptor actually only exprts phy0. The kernel then by default creates wlan0. Then i use : # iw phy phy0 interface add wlv1 type __ap # iw phy phy0 interface add wlv2 type station To create the 2 virtual interfaces that I use. The only real difference is the name I give them. (and the type in this case) To distinguish between them driver would need to provide some persistent information about each interface. I understand that dev_id (or dev_port) is supposed to be it, but as of now almost no driver actually bothers to set them. I think dev_id and dev_port are already used, but not really applicable here. I wonder how is it possible to match such devices at all ... Me to. (yes, the wlv3 was just for testing, wlv1 and wlv2 are the real ones) You mean wlan0? no, wlan0 is the original device, I use wlv3 as an example in the first mail, but was ommited in this reply because I already deleted it) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Link down for systemd articles
Am 18.08.2014 um 15:19 schrieb Lennart Poettering: On Mon, 18.08.14 12:45, Saket Sinha (saket.sinh...@gmail.com) wrote: I have been working on systemd recently and was referring to articles by Lennart Poettering for the same. However, I am not able to access the articles hosted at the below link - http://0pointer.de/blog/projects/ Is the server down or something ? Somebody found it funny to DoS my server with HTTP or so. I turned HTTP off temporarily. I have now started it again ctstate NEW recent: UPDATE seconds: 2 hit_count: 150 name: udpflood side: source mask: 255.255.255.255 ctstate NEW recent: UPDATE seconds: 2 hit_count: 150 name: DEFAULT side: source mask: 255.255.255.255 multiport dports 25,80,443,465,587 tcp flags:0x17/0x02 #conn src/32 75 multiport dports 25,80,443,465,587 tcp flags:0x17/0x02 #conn src/24 150 multiport dports 25,80,443,465,587 tcp flags:0x17/0x02 #conn src/16 175 multiport dports 25,80,443,465,587 tcp flags:0x17/0x02 #conn src/8 200 signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Make journalctl start at the end of the journal by default
Am 18.08.2014 um 15:27 schrieb Lennart Poettering: And also I would like to see the full logs always by default. Usually after lots of searching you find the offending log entry for the error, only to find out you forgot to pass the right command line options to journalctl and the important bit is cut off. cut off? You can just scroll to the right in most pagers, such as less? that don't change the fact --full should be the default instead force anybody with a smaller screen to create aliases if he want to read things just by use the scrollbar modern terminal applications like konsole offer signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [RFC] [PATCHv3 2/3] resume: add a tool to write a device node's major:minor to /sys/power/resume.
This can be used to initiate a resume from hibernation by path to a swap device containing the hibernation image. The respective templated unit is also added. It is instantiated using path to the desired resume device. --- Makefile-man.am | 7 Makefile.am | 17 ++-- man/systemd-res...@.service.xml | 81 +++ src/resume/Makefile | 1 + src/resume/resume.c | 83 units/systemd-res...@.service.in | 20 ++ 6 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 man/systemd-res...@.service.xml create mode 12 src/resume/Makefile create mode 100644 src/resume/resume.c create mode 100644 units/systemd-res...@.service.in diff --git a/Makefile-man.am b/Makefile-man.am index 5c289dd..be19905 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -76,6 +76,7 @@ MANPAGES += \ man/systemd-nspawn.1 \ man/systemd-path.1 \ man/systemd-remount-fs.service.8 \ + man/systemd-resume@.service.8 \ man/systemd-run.1 \ man/systemd-shutdownd.service.8 \ man/systemd-sleep.conf.5 \ @@ -206,6 +207,7 @@ MANPAGES_ALIAS += \ man/systemd-poweroff.service.8 \ man/systemd-reboot.service.8 \ man/systemd-remount-fs.8 \ + man/systemd-resume.8 \ man/systemd-shutdown.8 \ man/systemd-shutdownd.8 \ man/systemd-shutdownd.socket.8 \ @@ -311,6 +313,7 @@ man/systemd-kexec.service.8: man/systemd-halt.service.8 man/systemd-poweroff.service.8: man/systemd-halt.service.8 man/systemd-reboot.service.8: man/systemd-halt.service.8 man/systemd-remount-fs.8: man/systemd-remount-fs.service.8 +man/systemd-resume.8: man/systemd-resume@.service.8 man/systemd-shutdown.8: man/systemd-halt.service.8 man/systemd-shutdownd.8: man/systemd-shutdownd.service.8 man/systemd-shutdownd.socket.8: man/systemd-shutdownd.service.8 @@ -592,6 +595,9 @@ man/systemd-reboot.service.html: man/systemd-halt.service.html man/systemd-remount-fs.html: man/systemd-remount-fs.service.html $(html-alias) +man/systemd-resume.html: man/systemd-res...@.service.html + $(html-alias) + man/systemd-shutdown.html: man/systemd-halt.service.html $(html-alias) @@ -1626,6 +1632,7 @@ EXTRA_DIST += \ man/systemd-readahead-replay.service.xml \ man/systemd-remount-fs.service.xml \ man/systemd-resolved.service.xml \ + man/systemd-res...@.service.xml \ man/systemd-rfk...@.service.xml \ man/systemd-run.xml \ man/systemd-shutdownd.service.xml \ diff --git a/Makefile.am b/Makefile.am index e238cde..c4327ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -371,7 +371,8 @@ rootlibexec_PROGRAMS = \ systemd-sleep \ systemd-bus-proxyd \ systemd-socket-proxyd \ - systemd-update-done + systemd-update-done \ + systemd-resume systemgenerator_PROGRAMS = \ systemd-getty-generator \ @@ -509,7 +510,8 @@ nodist_systemunit_DATA = \ units/initrd-udevadm-cleanup-db.service \ units/initrd-switch-root.service \ units/systemd-nspawn@.service \ - units/systemd-update-done.service + units/systemd-update-done.service \ + units/systemd-resume@.service dist_userunit_DATA = \ units/user/basic.target \ @@ -556,7 +558,8 @@ EXTRA_DIST += \ units/initrd-udevadm-cleanup-db.service.in \ units/initrd-switch-root.service.in \ units/systemd-nsp...@.service.in \ - units/systemd-update-done.service.in + units/systemd-update-done.service.in \ + units/systemd-res...@.service.in CLEANFILES += \ units/console-shell.service.m4 \ @@ -1930,6 +1933,14 @@ systemd_delta_LDADD = \ libsystemd-shared.la # -- +systemd_resume_SOURCES = \ + src/resume/resume.c + +systemd_resume_LDADD = \ + libsystemd-internal.la \ + libsystemd-shared.la + +# -- systemd_getty_generator_SOURCES = \ src/getty-generator/getty-generator.c diff --git a/man/systemd-res...@.service.xml b/man/systemd-res...@.service.xml new file mode 100644 index 000..b7d28fb --- /dev/null +++ b/man/systemd-res...@.service.xml @@ -0,0 +1,81 @@ +?xml version=1.0? +!--*-nxml-*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; +!-- + This file is part of systemd. + + Copyright 2014 Ivan Shapovalov + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but +
[systemd-devel] [RFC] [PATCHv3 1/3] units: order systemd-fsck@.service after local-fs-pre.target.
With this change, it becomes possible to order a unit to activate before any modifications to the file systems. This is especially useful for supporting resume from hibernation. --- units/systemd-f...@.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/units/systemd-f...@.service.in b/units/systemd-f...@.service.in index c12efa8..d2cda6a 100644 --- a/units/systemd-f...@.service.in +++ b/units/systemd-f...@.service.in @@ -10,7 +10,7 @@ Description=File System Check on %f Documentation=man:systemd-fsck@.service(8) DefaultDependencies=no BindsTo=%i.device -After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service +After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service local-fs-pre.target Before=shutdown.target [Service] -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [RFC] [PATCHv3 0/3] resume: implement support for resuming from hibernation
This patchset allows systemd to parse resume= kernel command line parameter and initiate resume from the specified device. It adds: - a 'systemd-resume' tool which takes path to a device node and writes its major:minor to /sys/power/state; - a corresponding 'systemd-resume@.service' templated unit; - a 'systemd-resume-generator' generator which parses the kernel command line and instantiates the unit as necessary. This functionality already exists in-kernel, but only for /dev/sdXY-style pathes. Implementing it in userspace allows to use arbitrary udev-created symlinks, e. g. persistent block device pathes (/dev/disk/by-foo/bar). Userspace parsing of resume= kernel command line parameter has been traditionally done in initramfs via shell scripts (for Arch Linux, this is resume mkinitcpio hook), so I feel that this feature has its place within systemd. Due to the nature of hibernation, the resume unit must be activated before any modifications to filesystems take place. This can happen only in initramfs before mounting anything. So, first patch orders all non-root fsck after local-fs-pre.target, which in turn allows to order the resume unit before those fsck instances. Second and third patches add the tool, the unit and the generator. There are some issues with this implementation. - legacy usr.mount is not automatically ordered after local-fs-pre.target, so systemd-resume@.service has to be manually ordered before it; - systemd-udevd.service, which is needed for creating persistent block device symlinks, is transitively ordered after systemd-remount-fs.service via at least systemd-udev-hwdb-update.service and systemd-sysusers.service. Hence, if these units are present, an ordering cycle happens and resume is impossible. Encountering these conditions is very unlikely inside of an initramfs (who would make the in-initramfs /usr external? who would add systemd-sysusers into initramfs?), but there can still be pathological cases. So, I would like someone to comment on these issues. Thanks for reviewing! v2: fix issues pointed out by Andrei: - don't RemainAfterExit because it's useless - don't attempt to resume outside of initramfs because it's unsafe (reiserfs replays journal even if mounted RO) v3: fix mistakes spotted by Thomas: - return 0 in main path of resume.c:process_resume() - fix type and add missing cleanup attribute in resume-generator.c:main() Ivan Shapovalov (3): units: order systemd-fsck@.service after local-fs-pre.target. resume: add a tool to write a device node's major:minor to /sys/power/resume. resume-generator: add a generator for instantiating the resume unit. Makefile-man.am | 9 Makefile.am | 28 -- man/kernel-command-line.xml | 13 - man/systemd-resume-generator.xml| 91 +++ man/systemd-res...@.service.xml | 81 src/resume-generator/Makefile | 1 + src/resume-generator/resume-generator.c | 95 + src/resume/Makefile | 1 + src/resume/resume.c | 83 units/systemd-f...@.service.in | 2 +- units/systemd-res...@.service.in| 20 +++ 11 files changed, 418 insertions(+), 6 deletions(-) create mode 100644 man/systemd-resume-generator.xml create mode 100644 man/systemd-res...@.service.xml create mode 12 src/resume-generator/Makefile create mode 100644 src/resume-generator/resume-generator.c create mode 12 src/resume/Makefile create mode 100644 src/resume/resume.c create mode 100644 units/systemd-res...@.service.in -- 2.1.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [RFC] [PATCHv3 3/3] resume-generator: add a generator for instantiating the resume unit.
resume-generator understands resume= kernel command line parameter and instantiates the systemd-resume@.service accordingly if it is passed. This enables resume from hibernation using device specified on the kernel command line, where the device path may point to an arbitrary udev-created symlink, not only /dev/sdXY which is understood by the in-kernel implementation. --- Makefile-man.am | 2 + Makefile.am | 11 +++- man/kernel-command-line.xml | 13 - man/systemd-resume-generator.xml| 91 +++ src/resume-generator/Makefile | 1 + src/resume-generator/resume-generator.c | 95 + 6 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 man/systemd-resume-generator.xml create mode 12 src/resume-generator/Makefile create mode 100644 src/resume-generator/resume-generator.c diff --git a/Makefile-man.am b/Makefile-man.am index be19905..00daae2 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -76,6 +76,7 @@ MANPAGES += \ man/systemd-nspawn.1 \ man/systemd-path.1 \ man/systemd-remount-fs.service.8 \ + man/systemd-resume-generator.8 \ man/systemd-resume@.service.8 \ man/systemd-run.1 \ man/systemd-shutdownd.service.8 \ @@ -1632,6 +1633,7 @@ EXTRA_DIST += \ man/systemd-readahead-replay.service.xml \ man/systemd-remount-fs.service.xml \ man/systemd-resolved.service.xml \ + man/systemd-resume-generator.xml \ man/systemd-res...@.service.xml \ man/systemd-rfk...@.service.xml \ man/systemd-run.xml \ diff --git a/Makefile.am b/Makefile.am index c4327ca..820d082 100644 --- a/Makefile.am +++ b/Makefile.am @@ -378,7 +378,8 @@ systemgenerator_PROGRAMS = \ systemd-getty-generator \ systemd-fstab-generator \ systemd-system-update-generator \ - systemd-debug-generator + systemd-debug-generator \ + systemd-resume-generator dist_bashcompletion_DATA = \ shell-completion/bash/busctl \ @@ -1973,6 +1974,14 @@ systemd_system_update_generator_LDADD = \ libsystemd-label.la \ libsystemd-shared.la +# -- +systemd_resume_generator_SOURCES = \ + src/resume-generator/resume-generator.c + +systemd_resume_generator_LDADD = \ + libsystemd-label.la \ + libsystemd-shared.la + if ENABLE_EFI # -- systemgenerator_PROGRAMS += \ diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index f244bfc..4bc6cee 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -351,6 +351,16 @@ /listitem /varlistentry +varlistentry +termvarnameresume=/varname/term + +listitem +paraEnables resume from hibernation +using the specified device. For +details, see + citerefentryrefentrytitlesystemd-resume-generator/refentrytitlemanvolnum8/manvolnum/citerefentry./para +/listitem +/varlistentry /variablelist /refsect1 @@ -373,7 +383,8 @@ citerefentryrefentrytitlesystemd-gpt-auto-generator/refentrytitlemanvolnum8/manvolnum/citerefentry, citerefentryrefentrytitlesystemd-modules-load.service/refentrytitlemanvolnum8/manvolnum/citerefentry, citerefentryrefentrytitlesystemd-backlight@.service/refentrytitlemanvolnum8/manvolnum/citerefentry, - citerefentryrefentrytitlesystemd-rfkill@.service/refentrytitlemanvolnum8/manvolnum/citerefentry + citerefentryrefentrytitlesystemd-rfkill@.service/refentrytitlemanvolnum8/manvolnum/citerefentry, + citerefentryrefentrytitlesystemd-resume-generator/refentrytitlemanvolnum8/manvolnum/citerefentry /para /refsect1 diff --git a/man/systemd-resume-generator.xml b/man/systemd-resume-generator.xml new file mode 100644 index 000..7962534 --- /dev/null +++ b/man/systemd-resume-generator.xml @@ -0,0 +1,91 @@ +?xml version=1.0? +!--*-nxml-*-- +!DOCTYPE refentry PUBLIC -//OASIS//DTD DocBook XML V4.2//EN http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; +!-- + This file is part of systemd. + + Copyright 2014 Ivan Shapovalov + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1
[systemd-devel] [PATCH] tty-ask-password-agent: reset a signal handler for SIGTERM to the default
Hello, When trapping SIGTERM in a script and running systemctl from the script, systemctl sometimes hangs with tty-ask-password agent process. I have no idea whether systemd developpers think this is a bug or not. If this is a bug, I have three ideas to fix this. This patch is based on the 1). 1) Reset a signal handler for SIGTERM to the default before spawning an agent process from systemctl. 2) Prepare a timeout limit in systemctl. If it exceeds the limit, kill the agent process forsively by SIGKILL. 3) Use another IPC instead signal mechanism to kill the agent process such as pipe. == Subject: [PATCH] tty-ask-password-agent: reset a signal handler for SIGTERM to the default If a signal handler for SIGTERM is SIG_IGN, SIGTERM could be immediately processed before sigprocmask(). Then, as a result, systemctl hangs at waitid() and agent at poll(). The actual case where a signal handler for SIGTERM becomes SIG_IGN is when systemctl is used in a service script that traps SIGTERM. Here is an example. ~]# trap 15 ~]# strace -ff -F -e trace=clone,execve,rt_sigprocmask,signalfd4,poll,kill,waitid systemctl stop kdump execve(/usr/bin/systemctl, [systemctl, stop, kdump], [/* 30 vars */]) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 poll([{fd=4, events=POLLOUT}], 1, 9) = 1 ([{fd=4, revents=POLLOUT}]) poll([{fd=4, events=POLLIN}], 1, 9) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLOUT}], 1, 9) = 1 ([{fd=4, revents=POLLOUT}]) poll([{fd=4, events=POLLIN}], 1, 9) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLOUT}], 1, 9) = 1 ([{fd=4, revents=POLLOUT}]) clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe39df60b50) = 19820 poll([{fd=4, events=POLLIN}], 1, 25000) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLIN}], 1, 25000) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLIN}], 1, 25000) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLIN}], 1, 25000) = 1 ([{fd=4, revents=POLLIN}]) poll([{fd=4, events=POLLIN}], 1, 25000) = 1 ([{fd=4, revents=POLLIN}]) kill(19820, SIGTERM)= 0 kill(19820, SIGCONT)= 0 waitid(P_PID, 19820, Process 19820 attached unfinished ... [pid 19820] --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=19819, si_uid=0} --- [pid 19820] --- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=19819, si_uid=0} --- [pid 19820] execve(/usr/bin/systemd-tty-ask-password-agent, [/usr/bin/systemd-tty-ask-passwor..., --watch], [/* 30 vars */]) = 0 [pid 19820] rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 [pid 19820] rt_sigprocmask(SIG_SETMASK, [INT TERM], NULL, 8) = 0 [pid 19820] signalfd4(-1, [INT TERM], 8, O_NONBLOCK|O_CLOEXEC) = 5 [pid 19820] poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 2, 4294967295 --- src/shared/spawn-ask-password-agent.c | 16 1 file changed, 16 insertions(+) diff --git a/src/shared/spawn-ask-password-agent.c b/src/shared/spawn-ask-password-agent.c index c1a9c58..604fad6 100644 --- a/src/shared/spawn-ask-password-agent.c +++ b/src/shared/spawn-ask-password-agent.c @@ -34,6 +34,10 @@ static pid_t agent_pid = 0; int ask_password_agent_open(void) { +struct sigaction sa_old, sa_new = { +.sa_handler = SIG_DFL, +.sa_flags = SA_RESTART, +}; int r; if (agent_pid 0) @@ -44,6 +48,15 @@ int ask_password_agent_open(void) { if (!isatty(STDIN_FILENO)) return 0; +/* If a signal handler for SIGTERM is SIG_IGN, it's + * immediately processed by systemd-tty-ask-password process + * before sigprocmask() and then systemctl hangs at waitid() + * and agent at poll(). To avoid such case, reset a signal + * hander for SIGTERM to the default. + */ +if (sigaction(SIGTERM, sa_new, sa_old) 0) +return -errno; + r = fork_agent(agent_pid, NULL, 0, SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, @@ -51,6 +64,9 @@ int ask_password_agent_open(void) { if (r 0) log_error(Failed to fork TTY ask password agent: %s, strerror(-r)); +if (sigaction(SIGTERM, sa_old, NULL) 0) +return -errno; + return r; } -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel