Re: [systemd-devel] Run script before the first systemd-timer is triggered? Systemd-timer in UTC?
Op 28 apr. 2014, om 17:48 heeft Lennart Poettering lenn...@poettering.net het volgende geschreven: On Mon, 28.04.14 12:22, Manuel Reimer (manuel.s...@nurfuerspam.de) wrote: Lukasz Skalski l.skalski at samsung.com writes: You can define which RTC (/dev/rtcX) should be read - (rtc1) RTC used to set the system time option in kernel menuconfig. Yes, this is possible. But my RTC does not exist until I do the following on shell: echo ds1307 0x68 /sys/class/i2c-adapter/i2c-1/new_device Is there some other config option to tell the kernel to auto-initialize the I2C clock module? Isn't this something devicetree can solve? (not that i knew anything about devicetree or embedded hardware...) Devicetree can handle that, but the following under the i2c node: rtc@68 { compatible = dallas,ds1307; reg = 0x68; }; While I haven't tried it, you might be able to use aliases to make the ds1307 rtc0, but if not, do a 'status=disabled' in the on-chip rtc node. regards, Koen ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] networkd: do not complain about IFF_RUNNING
On Sun, Apr 27, 2014 at 11:35 PM, Tom Gundersen t...@jklm.no wrote: On Sun, Apr 27, 2014 at 10:33 PM, Umut Tezduyar Lindskog umut.tezdu...@axis.com wrote: Otherwise: eth0: unknown link flags gained: 0x00040 (ignoring) Hm, so this is basically working as intended at the moment. I.e., we log any change in the flags, either explicitly or with the above message. However, I guess you may have a point about IFF_RUNNING, as (as far as I can tell) it is redundant and covered by combinations of other flags and operstate (and it is pretty confusing when we get IFF_RUNNING when the device first appears, as the operstate is briefly IF_OPER_UNKNOWN). Applied the patch. Thanks. Thanks. Now that I know your point more, I would say we should make the debug message a bit more user friendly. Seeing unknown and ignoring was enough for me to dig deep and figure out what is going on. Umut Tom --- src/network/networkd-link.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 015a82d..a6ae3c1 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1129,7 +1129,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) { flags_removed = (link-flags ^ flags) link-flags; generic_flags = ~(IFF_UP | IFF_LOWER_UP | IFF_DORMANT | IFF_DEBUG | IFF_MULTICAST | IFF_BROADCAST | IFF_PROMISC | - IFF_NOARP | IFF_MASTER | IFF_SLAVE); + IFF_NOARP | IFF_MASTER | IFF_SLAVE | IFF_RUNNING); if (flags_added IFF_UP) log_debug_link(link, link is up); -- 1.7.10.4 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd freezes after rshd execution, if network connection is down
Am 28.04.2014 13:33, schrieb Jimmy Assarsson: Hi, We stumbled upon a freeze/block in systemd. The problem occurs when a rshd (socket activated) execution is completed, the network connection is down and systemd is closing the socket. This causes a long (60 seconds) freeze where it's not possible to communicate with systemd. Do you have any idea on what is causing this or how we can investigate this further? To reproduce the problem: 1) Get latest Arch Linux 2) On remote machine execute rsh $target_ip -l root 'sleep 40' 3) Set link down on the interface which is assigned with $target_ip, on systemd machine ip link set down dev $if 4) On systemd machine, wait for 'sleep 40' to be completed. Then execute any systemd command systemctl list-jobs 5) After 60 seconds systemd is responding again By looking at the stack trace (see bellow), one can see that we are trying to close a socket and waiting on a system close call. So it's probably not a systemd problem, however systemd is affected by it. We've succesfully reproduced the problem on different hardware architectures (x86_64, arm, cris), systemd versions (208, 210, 212) and rshd implementations (netkit-rsh-0.17, inetutils 1.9.2-1). The problem occurs not only when the interface's link is set down, also when the IP address is removed or the ethernet cable is unplugged. ssh seems not to be affected by the problem. We generated a core dump: kill -SIGABRT 1 Here is the stack trace (the machine is running systemd 210). (gdb) bt #0 0xb6f4d830 in raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:46 #1 0x000527e8 in crash.4282 (sig=6) at apps/systemd/systemd/src/core/main.c:156 #2 signal handler called #3 0xb6f4c28c in close () from target/armv6-axis-linux-gnueabi/lib/libpthread.so.0 #4 0x0009417c in close_nointr (fd=optimized out) at apps/systemd/systemd/src/shared/util.c:167 #5 0x00094250 in close_nointr_nofail (fd=optimized out) at apps/systemd/systemd/src/shared/util.c:191 #6 0x00073e0c in service_close_socket_fd.9824 (s=s@entry=0x1b6f918) at apps/systemd/systemd/src/core/service.c:229 #7 0x00079728 in service_set_state.9835 (s=s@entry=0x1b6f918, state=SERVICE_DEAD) at apps/systemd/systemd/src/core/service.c:1496 #8 0x00079b70 in service_enter_dead.9847 (s=0x1b6f918, f=optimized out, allow_restart=optimized out) at apps/systemd/systemd/src/core/service.c:1852 #9 0x00065470 in service_sigchld_event (u=0x1b6f918, pid=optimized out, code=1, status=0) at apps/systemd/systemd/src/core/service.c:3037 #10 0x00073490 in invoke_sigchld_event.5410 (m=m@entry=0x1ad7360, u=0x1b6f918, si=0xbe862670, si@entry=0xbe862668) at apps/systemd/systemd/src/core/manager.c:1430 #11 0x00054084 in manager_dispatch_sigchld.5415 (m=m@entry=0x1ad7360) at apps/systemd/systemd/src/core/manager.c:1477 #12 0x000629b0 in manager_dispatch_signal_fd.part.32 (userdata=optimized out) at apps/systemd/systemd/src/core/manager.c:1723 #13 manager_dispatch_signal_fd.5363 (source=optimized out, fd=optimized out, revents=optimized out, userdata=0x1ad7360) at apps/systemd/systemd/src/core/manager.c:1508 #14 0x0003e880 in source_dispatch (s=0x1ad7758) at apps/systemd/systemd/src/libsystemd/sd-event/sd-event.c:1861 #15 0x00041288 in sd_event_run (e=0x1ad61d8, timeout=optimized out) at apps/systemd/systemd/src/libsystemd/sd-event/sd-event.c:2117 #16 0x000103c8 in manager_loop (m=0x1ad7360) at apps/systemd/systemd/src/core/manager.c:1844 #17 main (argc=1, argv=0xbe862ee4) at apps/systemd/systemd/src/core/main.c:1704 Thanks, Jimmy Hmm, reminds me of: http://stackoverflow.com/questions/3757289/tcp-option-so-linger-zero-when-its-required http://oroboro.com/dealing-with-network-port-abuse-in-sockets-in-c/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-commits] src/libsystemd-network src/systemd
On Tue, 29.04.14 03:27, Tom Gundersen (tome...@kemper.freedesktop.org) wrote: +case DHCP_OPTION_NTP_SERVER: +if (len !(len % 4)) { +unsigned i; + +lease-ntp_size = len / 4; + +free(lease-ntp); +lease-ntp = new0(struct in_addr, lease-ntp_size); +if (!lease-ntp) +return -ENOMEM; + +for (i = 0; i lease-ntp_size; i++) { +memcpy(lease-ntp[i].s_addr, option + 4 * i, 4); +} This should be shorter, no? lease-ntp = newdup(struct in_addr, option, lease-ntp_size); if (!lease-ntp) ... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-commits] src/libsystemd-network src/systemd
On Tue, Apr 29, 2014 at 12:37 PM, Lennart Poettering lenn...@poettering.net wrote: On Tue, 29.04.14 03:27, Tom Gundersen (tome...@kemper.freedesktop.org) wrote: +case DHCP_OPTION_NTP_SERVER: +if (len !(len % 4)) { +unsigned i; + +lease-ntp_size = len / 4; + +free(lease-ntp); +lease-ntp = new0(struct in_addr, lease-ntp_size); +if (!lease-ntp) +return -ENOMEM; + +for (i = 0; i lease-ntp_size; i++) { +memcpy(lease-ntp[i].s_addr, option + 4 * i, 4); +} This should be shorter, no? lease-ntp = newdup(struct in_addr, option, lease-ntp_size); if (!lease-ntp) ... Oh, cool, didn't know about that one. Will fix. Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] Add support for TuxOnIce hibernation
Homepage: http://tuxonice.net/ --- src/shared/sleep-config.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index cf1cd40..d1f7fb1 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -224,6 +224,12 @@ static bool enough_memory_for_hibernation(void) { size_t size = 0, used = 0; int r; +/* TuxOnIce is an alternate implementation for hibernation. + * It can be configured to compress the image to a file or an inactive + * swap partition, so there's nothing more we can do here. */ +if (access(/sys/power/tuxonice, F_OK) == 0) +return true; + r = hibernation_partition_size(size, used); if (r 0) return false; -- 1.8.5.2.988.g9b015e5.dirty ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Add support for TuxOnIce hibernation
On Tue, Apr 29, 2014 at 1:16 PM, Julien Muchembled j...@jmuchemb.eu wrote: Homepage: http://tuxonice.net/ --- src/shared/sleep-config.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index cf1cd40..d1f7fb1 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -224,6 +224,12 @@ static bool enough_memory_for_hibernation(void) { size_t size = 0, used = 0; int r; +/* TuxOnIce is an alternate implementation for hibernation. + * It can be configured to compress the image to a file or an inactive + * swap partition, so there's nothing more we can do here. */ +if (access(/sys/power/tuxonice, F_OK) == 0) Is this available in the upstream kernel, or planned to to be merged? Systemd does not support any unmerged kernel features, unless there a very strong strategic reason to do that. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Add support for TuxOnIce hibernation
Le 04/29/14 13:39, Kay Sievers a écrit : On Tue, Apr 29, 2014 at 1:16 PM, Julien Muchembled j...@jmuchemb.eu wrote: Homepage: http://tuxonice.net/ --- src/shared/sleep-config.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index cf1cd40..d1f7fb1 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -224,6 +224,12 @@ static bool enough_memory_for_hibernation(void) { size_t size = 0, used = 0; int r; +/* TuxOnIce is an alternate implementation for hibernation. + * It can be configured to compress the image to a file or an inactive + * swap partition, so there's nothing more we can do here. */ +if (access(/sys/power/tuxonice, F_OK) == 0) Is this available in the upstream kernel, or planned to to be merged? It's not available in vanilla. I don't know if it's planned to be merged. Systemd does not support any unmerged kernel features, unless there a very strong strategic reason to do that. I use Debian, which has just packaged version 208, and hibernate key stopped working after upgrading from 204. Rebuilding systemd with this patch is the only option. I am the maintainer a TOI user interface for Debian[1] and I recently added systemd support to it[2] This patch could be a Debian patch to systemd package but it would help all dists that support TOI if it was merged upstream. I use TOI since 2006 and given its quality, I hope you will accept such a small and simple patch. Julien [1] http://packages.qa.debian.org/t/tuxonice-userui.html [2] http://anonscm.debian.org/gitweb/?p=collab-maint/tuxonice-userui.git;a=commit;h=aed3cfd321440118575d52ee54dbf07ebe5a2987 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Add support for TuxOnIce hibernation
On Tue, Apr 29, 2014 at 2:36 PM, Julien Muchembled j...@jmuchemb.eu wrote: Le 04/29/14 13:39, Kay Sievers a écrit : Is this available in the upstream kernel, or planned to to be merged? It's not available in vanilla. I don't know if it's planned to be merged. Systemd does not support any unmerged kernel features, unless there a very strong strategic reason to do that. I use Debian, which has just packaged version 208, and hibernate key stopped working after upgrading from 204. Rebuilding systemd with this patch is the only option. I am the maintainer a TOI user interface for Debian[1] and I recently added systemd support to it[2] This patch could be a Debian patch to systemd package but it would help all dists that support TOI if it was merged upstream. I use TOI since 2006 and given its quality, I hope you will accept such a small and simple patch. No, it is not about the size of a patch; systemd just does not support non-mainline kernel features. If Debian supports it, please add this patch to Debian. If it is some day merged into the upstream kernel, we would add support in systemd upstream too, not the other way around. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] logind: allow suspending if there are no displays
On Mon, Apr 28, 2014 at 6:10 PM, Lennart Poettering lenn...@poettering.net wrote: On Mon, 28.04.14 00:44, Mantas Mikulėnas (graw...@gmail.com) wrote: With proprietary graphics drivers, there won't be any 'drm' devices in sysfs, so logind will never suspend the system upon closing the lid, even if only one (internal) display is connected. This has been reported by multiple users so far. IMHO, it's better to suspend the system in this case for safety reasons, to avoid having nvidia blob users' laptops overheat, for the same reason that sleep inhibitors are overridden (LidSwitchIgnoreInhibited=yes). Isn't the right approach to ask nivida to just support the normal kernel APIs for this? I mean, we can tape over things, and we can shift arounds so that things keep breaking for other people, but how about just asking them to fix their stuff? True, but from the pieces of discussions I've seen in #xorg-devel, I doubt it's going to happen over a weekend. Also, similar problems in the past were mostly just affecting software design decisions; this one causes actual hardware problems. [Though, personally, maybe the monitor-count check itself should be possible to turn off, for unusual setups.] -- Mantas Mikulėnas graw...@gmail.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Delaying (SSH) key generation until the urandom pool is initialized
The message at https://mail.gnome.org/archives/ostree-list/2014-February/msg00010.html contains two boot traces from virtual machines which show that the SSH key is generated before the kernel pool is sufficiently seeded. Would it be possible using socket activation to create the listening socket for SSH, but block the actual service startup until the keys have been generated after sufficient entropy became available? What would you need on the kernel side to implement the waiting? (Textual comparison of a log message is only good for a prototype.) -- Florian Weimer / Red Hat Product Security Team ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Delaying (SSH) key generation until the urandom pool is initialized
El 29/04/14 14:43, Florian Weimer escribió: The message at https://mail.gnome.org/archives/ostree-list/2014-February/msg00010.html contains two boot traces from virtual machines which show that the SSH key is generated before the kernel pool is sufficiently seeded. Would it be possible using socket activation to create the listening socket for SSH, but block the actual service startup until the keys have been generated after sufficient entropy became available? What would you need on the kernel side to implement the waiting? (Textual comparison of a log message is only good for a prototype.) The device should block but only until it is sufficiently seeded..unfortunately I have seen it taking up a long time :-( 2014-04-29T12:13:24,00-0400 -- system start 2014-04-29T12:14:51,007880-0400 -- random: nonblocking pool is initialized In the systemd side we could avoid this by getting entropy from rdrand if available. Quite frankly, I think there is nothing we should do, this is something that has to be fixed in the kernel side only. -- Cristian I don't know the key to success, but the key to failure is trying to please everybody. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Delaying (SSH) key generation until the urandom pool is initialized
On Tue, Apr 29, 2014 at 8:43 PM, Florian Weimer fwei...@redhat.com wrote: The message at https://mail.gnome.org/archives/ostree-list/2014-February/msg00010.html contains two boot traces from virtual machines which show that the SSH key is generated before the kernel pool is sufficiently seeded. Would it be possible using socket activation to create the listening socket for SSH, but block the actual service startup until the keys have been generated after sufficient entropy became available? What would you need on the kernel side to implement the waiting? (Textual comparison of a log message is only good for a prototype.) You can easily start the sockets early, but make the daemon itself wait for the key generation to finish. The only thing you then have to make sure is that the key generation blocks until the non-blocking pool is initialized (I assume that is what's being used?). For that I suppose you just need to make the kernel block /dev/urandom until that's the case, I have seen this being discussed, but don't know the status of those patches. Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 0/2] core/cryptsetup: cleaned up patches
Applied previous comments. Przemek Rudy (2): core/cryptsetup: Add WantsMountFor option to enable fallback to password request for crypt mounts. core/cryptsetup: Remove duplicated code. src/core/automount.c | 2 +- src/core/dbus-unit.c | 3 +- src/core/load-fragment-gperf.gperf.m4 | 3 +- src/core/load-fragment.c | 8 +-- src/core/load-fragment.h | 2 +- src/core/manager.c| 11 ++-- src/core/manager.h| 8 +-- src/core/mount.c | 40 +++--- src/core/path.c | 2 +- src/core/socket.c | 2 +- src/core/swap.c | 2 +- src/core/timer.c | 2 +- src/core/unit.c | 99 --- src/core/unit.h | 7 +-- src/cryptsetup/cryptsetup-generator.c | 3 +- 15 files changed, 109 insertions(+), 85 deletions(-) -- 1.9.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] core/cryptsetup: Add WantsMountFor option to enable fallback to password request for crypt mounts.
--- src/core/dbus-unit.c | 1 + src/core/load-fragment-gperf.gperf.m4 | 1 + src/core/load-fragment.c | 47 +++ src/core/load-fragment.h | 1 + src/core/manager.c| 15 src/core/manager.h| 6 ++ src/core/mount.c | 25 +- src/core/unit.c | 144 ++ src/core/unit.h | 5 ++ src/cryptsetup/cryptsetup-generator.c | 3 +- 10 files changed, 246 insertions(+), 2 deletions(-) diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 07e7f20..31a35e9 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -516,6 +516,7 @@ const sd_bus_vtable bus_unit_vtable[] = { SD_BUS_PROPERTY(ReloadPropagatedFrom, as, property_get_dependencies, offsetof(Unit, dependencies[UNIT_RELOAD_PROPAGATED_FROM]), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(JoinsNamespaceOf, as, property_get_dependencies, offsetof(Unit, dependencies[UNIT_JOINS_NAMESPACE_OF]), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(RequiresMountsFor, as, NULL, offsetof(Unit, requires_mounts_for), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(WantsMountsFor, as, NULL, offsetof(Unit, wants_mounts_for), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Documentation, as, NULL, offsetof(Unit, documentation), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Description, s, property_get_description, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(LoadState, s, property_get_load_state, offsetof(Unit, load_state), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 21bccbb..4e51866 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -139,6 +139,7 @@ Unit.PropagateReloadFrom,config_parse_unit_deps, UNIT_RELOAD Unit.PartOf, config_parse_unit_deps, UNIT_PART_OF, 0 Unit.JoinsNamespaceOf, config_parse_unit_deps, UNIT_JOINS_NAMESPACE_OF, 0 Unit.RequiresMountsFor, config_parse_unit_requires_mounts_for, 0, 0 +Unit.WantsMountsFor, config_parse_unit_wants_mounts_for, 0, 0 Unit.StopWhenUnneeded, config_parse_bool, 0, offsetof(Unit, stop_when_unneeded) Unit.RefuseManualStart, config_parse_bool, 0, offsetof(Unit, refuse_manual_start) Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Unit, refuse_manual_stop) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 3b36d15..24c1849 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2048,6 +2048,52 @@ int config_parse_unit_requires_mounts_for( return 0; } +int config_parse_unit_wants_mounts_for( +const char *unit, +const char *filename, +unsigned line, +const char *section, +unsigned section_line, +const char *lvalue, +int ltype, +const char *rvalue, +void *data, +void *userdata) { + +Unit *u = userdata; +char *state; +size_t l; +char *w; + +assert(filename); +assert(lvalue); +assert(rvalue); +assert(data); + +FOREACH_WORD_QUOTED(w, l, rvalue, state) { +int r; +_cleanup_free_ char *n; + +n = strndup(w, l); +if (!n) +return log_oom(); + +if (!utf8_is_valid(n)) { +log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); +continue; +} + +r = unit_want_mounts_for(u, n); +if (r 0) { +log_syntax(unit, LOG_ERR, filename, line, r, + Failed to add wanted mount for, ignoring: %s, rvalue); +continue; +} +} + +return 0; +} + int config_parse_documentation(const char *unit, const char *filename, unsigned line, @@ -3422,6 +3468,7 @@ void unit_dump_config_items(FILE *f) { { config_parse_nsec, NANOSECONDS }, { config_parse_namespace_path_strv, PATH [...] }, { config_parse_unit_requires_mounts_for, PATH [...] }, +{ config_parse_unit_wants_mounts_for, PATH [...] }, { config_parse_exec_mount_flags, MOUNTFLAG [...] }, {
[systemd-devel] [PATCH 2/2] core/cryptsetup: Remove duplicated code.
--- src/core/automount.c | 2 +- src/core/dbus-unit.c | 4 +- src/core/load-fragment-gperf.gperf.m4 | 4 +- src/core/load-fragment.c | 55 + src/core/load-fragment.h | 3 +- src/core/manager.c| 24 +--- src/core/manager.h| 14 +-- src/core/mount.c | 61 -- src/core/path.c | 2 +- src/core/socket.c | 2 +- src/core/swap.c | 2 +- src/core/timer.c | 2 +- src/core/unit.c | 223 +++--- src/core/unit.h | 12 +- 14 files changed, 95 insertions(+), 315 deletions(-) diff --git a/src/core/automount.c b/src/core/automount.c index 65e6d6f..d4359b9 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -124,7 +124,7 @@ static int automount_add_mount_links(Automount *a) { if (r 0) return r; -return unit_require_mounts_for(UNIT(a), parent); +return unit_needs_mounts_for(UNIT(a), parent, true); } static int automount_add_default_dependencies(Automount *a) { diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 31a35e9..18d21ff 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -515,8 +515,8 @@ const sd_bus_vtable bus_unit_vtable[] = { SD_BUS_PROPERTY(PropagatesReloadTo, as, property_get_dependencies, offsetof(Unit, dependencies[UNIT_PROPAGATES_RELOAD_TO]), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(ReloadPropagatedFrom, as, property_get_dependencies, offsetof(Unit, dependencies[UNIT_RELOAD_PROPAGATED_FROM]), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(JoinsNamespaceOf, as, property_get_dependencies, offsetof(Unit, dependencies[UNIT_JOINS_NAMESPACE_OF]), SD_BUS_VTABLE_PROPERTY_CONST), -SD_BUS_PROPERTY(RequiresMountsFor, as, NULL, offsetof(Unit, requires_mounts_for), SD_BUS_VTABLE_PROPERTY_CONST), -SD_BUS_PROPERTY(WantsMountsFor, as, NULL, offsetof(Unit, wants_mounts_for), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(RequiresMountsFor, as, NULL, offsetof(Unit, needs_mounts_for[0]), SD_BUS_VTABLE_PROPERTY_CONST), +SD_BUS_PROPERTY(WantsMountsFor, as, NULL, offsetof(Unit, needs_mounts_for[1]), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Documentation, as, NULL, offsetof(Unit, documentation), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(Description, s, property_get_description, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY(LoadState, s, property_get_load_state, offsetof(Unit, load_state), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 4e51866..7b9406b 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -138,8 +138,8 @@ Unit.ReloadPropagatedFrom, config_parse_unit_deps, UNIT_RELOAD Unit.PropagateReloadFrom,config_parse_unit_deps, UNIT_RELOAD_PROPAGATED_FROM, 0 Unit.PartOf, config_parse_unit_deps, UNIT_PART_OF, 0 Unit.JoinsNamespaceOf, config_parse_unit_deps, UNIT_JOINS_NAMESPACE_OF, 0 -Unit.RequiresMountsFor, config_parse_unit_requires_mounts_for, 0, 0 -Unit.WantsMountsFor, config_parse_unit_wants_mounts_for, 0, 0 +Unit.RequiresMountsFor, config_parse_unit_needs_mounts_for, UNIT_REQUIRES, 0 +Unit.WantsMountsFor, config_parse_unit_needs_mounts_for, UNIT_WANTS,0 Unit.StopWhenUnneeded, config_parse_bool, 0, offsetof(Unit, stop_when_unneeded) Unit.RefuseManualStart, config_parse_bool, 0, offsetof(Unit, refuse_manual_start) Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Unit, refuse_manual_stop) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 24c1849..a1777a9 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2002,7 +2002,7 @@ int config_parse_unit_condition_null(const char *unit, DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, Failed to parse notify access specifier); DEFINE_CONFIG_PARSE_ENUM(config_parse_failure_action, failure_action, FailureAction, Failed to parse failure action specifier); -int config_parse_unit_requires_mounts_for( +int config_parse_unit_needs_mounts_for( const char *unit, const char *filename, unsigned line, @@ -2037,56 +2037,10 @@ int config_parse_unit_requires_mounts_for( continue;
Re: [systemd-devel] Host and machine ids are equal (4c93d957bcf44b289c3e4edb5bd5c355): refusing to link journals
On Mon, Apr 28, 2014 at 9:04 PM, Ruben Kerkhof ru...@rubenkerkhof.com wrote: I would have expected that to be 'Initializing machine ID from container UUID.' container_uuid is set in the environment: [root@testcontainer ~]# tr '\0' '\n' /proc/1/environ | grep container container=systemd-nspawn container_uuid=d9611cfff0114c7c8c762fe4154f7ed3 I think I know what's wrong. systemd-nspawn --uuid takes a 36-character uuid string. It is converted to sd_128_t arg_uuid in nspawn.c:parse_args and then placed in the environment of pid 1 as 32-character string: if (asprintf((char**)(envp + n_env++), container_uuid= SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid)) 0) machine-id-setup.c:generate however expects a 36-character string in the environment. Kind regards, Ruben ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkd: dont configure route if lease doesn't have one
--- src/libsystemd-network/sd-dhcp-lease.c | 34 --- src/network/networkd-link.c| 160 ++-- 2 files changed, 110 insertions(+), 84 deletions(-) diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index aa479ff..cb708c6 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -112,7 +112,10 @@ int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, struct in_addr *addr) { assert_return(lease, -EINVAL); assert_return(addr, -EINVAL); -addr-s_addr = lease-router; +if (lease-router != INADDR_ANY) +addr-s_addr = lease-router; +else +return -ENOENT; return 0; } @@ -277,6 +280,7 @@ int dhcp_lease_new(sd_dhcp_lease **ret) { if (!lease) return -ENOMEM; +lease-router = INADDR_ANY; lease-n_ref = REFCNT_INIT; *ret = lease; @@ -316,17 +320,19 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { ADDRESS=%s\n, string); r = sd_dhcp_lease_get_router(lease, address); -if (r 0) +if (r 0 r != -ENOENT) goto finish; -string = inet_ntop(AF_INET, address, buf, INET_ADDRSTRLEN); -if (!string) { -r = -errno; -goto finish; -} +if (r = 0) { +string = inet_ntop(AF_INET, address, buf, INET_ADDRSTRLEN); +if (!string) { +r = -errno; +goto finish; +} -fprintf(f, -ROUTER=%s\n, string); +fprintf(f, +ROUTER=%s\n, string); +} r = sd_dhcp_lease_get_netmask(lease, address); if (r 0) @@ -440,11 +446,13 @@ int dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret) { lease-address = addr.s_addr; -r = inet_pton(AF_INET, router, addr); -if (r 0) -return r; +if (router) { +r = inet_pton(AF_INET, router, addr); +if (r 0) +return r; -lease-router = addr.s_addr; +lease-router = addr.s_addr; +} r = inet_pton(AF_INET, netmask, addr); if (r 0) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 015a82d..8af376d 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -301,55 +301,60 @@ static int link_enter_set_routes(Link *link) { struct in_addr gateway; r = sd_dhcp_lease_get_router(link-dhcp_lease, gateway); -if (r 0) { -log_warning_link(link, DHCP error: no router: %s, - strerror(-r)); +if (r 0 r != -ENOENT) { +log_warning_link(link, DHCP error: %s, strerror(-r)); return r; } -r = route_new_dynamic(route); -if (r 0) { -log_error_link(link, Could not allocate route: %s, - strerror(-r)); -return r; -} +if (r = 0) { +r = route_new_dynamic(route); +if (r 0) { +log_error_link(link, Could not allocate route: %s, + strerror(-r)); +return r; +} -r = route_new_dynamic(route_gw); -if (r 0) { -log_error_link(link, Could not allocate route: %s, - strerror(-r)); -return r; -} +r = route_new_dynamic(route_gw); +if (r 0) { +log_error_link(link, Could not allocate route: %s, + strerror(-r)); +return r; +} -/* The dhcp netmask may mask out the gateway. Add an explicit - * route for the gw host so that we can route no matter the - * netmask or existing kernel route tables. */ -route_gw-family = AF_INET; -route_gw-dst_addr.in = gateway; -route_gw-dst_prefixlen = 32; -route_gw-scope = RT_SCOPE_LINK; +/* The dhcp netmask may mask out the gateway. Add an explicit + * route for the gw host so that we can route no matter the + * netmask or existing kernel route tables. */ +route_gw-family = AF_INET; +
Re: [systemd-devel] [PATCH] networkd: dont configure route if lease doesn't have one
Applied. Thanks! [but I had to rebase, so please check that it still works :) ] -t On Tue, Apr 29, 2014 at 10:40 PM, Umut Tezduyar Lindskog umut.tezdu...@axis.com wrote: --- src/libsystemd-network/sd-dhcp-lease.c | 34 --- src/network/networkd-link.c| 160 ++-- 2 files changed, 110 insertions(+), 84 deletions(-) diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index aa479ff..cb708c6 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -112,7 +112,10 @@ int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, struct in_addr *addr) { assert_return(lease, -EINVAL); assert_return(addr, -EINVAL); -addr-s_addr = lease-router; +if (lease-router != INADDR_ANY) +addr-s_addr = lease-router; +else +return -ENOENT; return 0; } @@ -277,6 +280,7 @@ int dhcp_lease_new(sd_dhcp_lease **ret) { if (!lease) return -ENOMEM; +lease-router = INADDR_ANY; lease-n_ref = REFCNT_INIT; *ret = lease; @@ -316,17 +320,19 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { ADDRESS=%s\n, string); r = sd_dhcp_lease_get_router(lease, address); -if (r 0) +if (r 0 r != -ENOENT) goto finish; -string = inet_ntop(AF_INET, address, buf, INET_ADDRSTRLEN); -if (!string) { -r = -errno; -goto finish; -} +if (r = 0) { +string = inet_ntop(AF_INET, address, buf, INET_ADDRSTRLEN); +if (!string) { +r = -errno; +goto finish; +} -fprintf(f, -ROUTER=%s\n, string); +fprintf(f, +ROUTER=%s\n, string); +} r = sd_dhcp_lease_get_netmask(lease, address); if (r 0) @@ -440,11 +446,13 @@ int dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret) { lease-address = addr.s_addr; -r = inet_pton(AF_INET, router, addr); -if (r 0) -return r; +if (router) { +r = inet_pton(AF_INET, router, addr); +if (r 0) +return r; -lease-router = addr.s_addr; +lease-router = addr.s_addr; +} r = inet_pton(AF_INET, netmask, addr); if (r 0) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 015a82d..8af376d 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -301,55 +301,60 @@ static int link_enter_set_routes(Link *link) { struct in_addr gateway; r = sd_dhcp_lease_get_router(link-dhcp_lease, gateway); -if (r 0) { -log_warning_link(link, DHCP error: no router: %s, - strerror(-r)); +if (r 0 r != -ENOENT) { +log_warning_link(link, DHCP error: %s, strerror(-r)); return r; } -r = route_new_dynamic(route); -if (r 0) { -log_error_link(link, Could not allocate route: %s, - strerror(-r)); -return r; -} +if (r = 0) { +r = route_new_dynamic(route); +if (r 0) { +log_error_link(link, Could not allocate route: %s, + strerror(-r)); +return r; +} -r = route_new_dynamic(route_gw); -if (r 0) { -log_error_link(link, Could not allocate route: %s, - strerror(-r)); -return r; -} +r = route_new_dynamic(route_gw); +if (r 0) { +log_error_link(link, Could not allocate route: %s, + strerror(-r)); +return r; +} -/* The dhcp netmask may mask out the gateway. Add an explicit - * route for the gw host so that we can route no matter the - * netmask or existing kernel route tables. */ -route_gw-family = AF_INET; -route_gw-dst_addr.in = gateway; -route_gw-dst_prefixlen = 32; -route_gw-scope = RT_SCOPE_LINK; +/* The
[systemd-devel] How to spin down a disc with systemd?
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
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
Re: [systemd-devel] Disable timers
systemctl disable or systemctl mask. You also have to stop it first, as that only changes the default. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel