[systemd-devel] Assertion 'fd == 3 + count' failed at activate.c:115
hej, when i try to run systemd-activate from the latest git i get an assertion failiure: [simon@troela server]$ /usr/lib/systemd/systemd-activate -l 9000 main.js Assertion 'fd == 3 + count' failed at src/activate/activate.c:115, function open_sockets(). Aborting. Aborted (core dumped) this is on archlinux with systemd-git from aur. i am not familiar with this code, so can anybody help me solving this? thanks Simon ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Assertion 'fd == 3 + count' failed at activate.c:115
2013/12/8 Peeters Simon peeters.si...@gmail.com: hej, when i try to run systemd-activate from the latest git i get an assertion failiure: [simon@troela server]$ /usr/lib/systemd/systemd-activate -l 9000 main.js Assertion 'fd == 3 + count' failed at src/activate/activate.c:115, function open_sockets(). Aborting. Aborted (core dumped) this is on archlinux with systemd-git from aur. i am not familiar with this code, so can anybody help me solving this? sorry for the noise, after a bit debuging i found the problem: slim appears to leak an fd into all of its children: stat /proc/14004/fd/3 (14004 is the pid a random process in my session) File: '/proc/14004/fd/3' - '/var/log/slim.log' i now work around it by isuing exec 3- in bash before i run systemd-activate ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] How to use systemctl preset ?
Hello. I have tried to use systemctl preset command. As you know that systemd.org already explained preset in manual page, So I read those things about preset and some example to use systemctl preset. http://www.freedesktop.org/software/systemd/man/systemd.preset.html But, when I try systemctl preset command, systemd print error like below. $systemctl preset Too few arguments.(error msg) $ls 00-first.preset $systemctl preset 00-first.preset Failed to issue method call: Invalid argument(error msg) I think I have been experiencing him who already sent a mail related with me. https://bugs.freedesktop.org/show_bug.cgi?id=64215 But I couldn't understand what Lennart said like below. * If you specify just test as parameter, then this would cause test.service to be reset to the preset default, but since test.service doesn't exist on your machine this fails.* i hope someone who shall explain how to apply systemctl preset to enable/disable many units at once. thanks. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] How to use systemctl preset ?
Hello. I have tried to use systemctl preset command. As you know that systemd.org already explained preset in manual page, So I read those things about preset and some example to use systemctl preset. http://www.freedesktop.org/software/systemd/man/systemd.preset.html But, when I try systemctl preset command, systemd print error like below. $systemctl preset Too few arguments.(error msg) $ls 00-first.preset $systemctl preset 00-first.preset Failed to issue method call: Invalid argument(error msg) I think I have been experiencing same problem as him who already sent a mail related with me. https://bugs.freedesktop.org/show_bug.cgi?id=64215 But I couldn't understand what Lennart said like below. * If you specify just test as parameter, then this would cause test.service to be reset to the preset default, but since test.service doesn't exist on your machine this fails.* I hope someone who shall explain how to apply systemctl preset to enable/disable many units at once. Thanks. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to use systemctl preset ?
В Mon, 9 Dec 2013 01:58:38 +0900 Tony Seo tonys...@gmail.com пишет: Hello. I have tried to use systemctl preset command. As you know that systemd.org already explained preset in manual page, So I read those things about preset and some example to use systemctl preset. http://www.freedesktop.org/software/systemd/man/systemd.preset.html But, when I try systemctl preset command, systemd print error like below. $systemctl preset Too few arguments.(error msg) It requires at least one unit name ... $ls 00-first.preset $systemctl preset 00-first.preset Failed to issue method call: Invalid argument(error msg) ... which must be unit name, not arbitrary file. I think I have been experiencing him who already sent a mail related with me. https://bugs.freedesktop.org/show_bug.cgi?id=64215 But I couldn't understand what Lennart said like below. * If you specify just test as parameter, then this would cause test.service to be reset to the preset default, but since test.service doesn't exist on your machine this fails.* i hope someone who shall explain how to apply systemctl preset to enable/disable many units at once. You need to list all units as arguments to systemctl preset. As I understand, that's intended more for packaging support where package can issue systemctl preset unit during installation to enable/disable unit according to local policy. So it is more remove policy knowledge from command than automate many units at once. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] Bring bootchart code in line with CODING_STYLE
Use double and not float, as there is little to no benefit. --- src/bootchart/svg.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c index c21f6e8..0f4fd63 100644 --- a/src/bootchart/svg.c +++ b/src/bootchart/svg.c @@ -68,16 +68,16 @@ static double idletime = -1.0; static int pfiltered = 0; static int pcount = 0; static int kcount = 0; -static float psize = 0; -static float ksize = 0; -static float esize = 0; +static double psize = 0; +static double ksize = 0; +static double esize = 0; static struct list_sample_data *sampledata; static struct list_sample_data *prev_sampledata; extern struct list_sample_data *head; static void svg_header(void) { -float w; -float h; +double w; +double h; struct list_sample_data *sampledata_last; sampledata = head; -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] Use heap allocation for stdout journald buffer
Previously this was a static array in the standard out stream structure. Behavior shouldn't change with this as we do a one-time allocation of the buffer on the heap when creating the stream, and free it when it is released. However, it sets the stage for a growable buffer in the future. --- The commit message of the next patch describes the 'why' behind this a bit better, as it actually introduces dynamic buffer resizing. This is simply a stepping stone for that work. Is there some dynamic buffer code I should be using rather than doing a bit of the roll-my-own stuff as I did? Ideally it would be for dynamic buffers of bytes rather than assuming strings, and thus not tripping over NULL bytes in the stream. However, the current stdout journal capture code would definitely not handle NULLs in the stream all that well. Suggestions welcome, thanks! src/journal/journald-stream.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 9ca26e2..193d438 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -68,7 +68,8 @@ struct StdoutStream { bool forward_to_kmsg:1; bool forward_to_console:1; -char buffer[LINE_MAX+1]; +char *buffer; +size_t size; size_t length; LIST_FIELDS(StdoutStream, stdout_stream); @@ -251,13 +252,14 @@ static int stdout_stream_scan(StdoutStream *s, bool force_flush) { end = memchr(p, '\n', remaining); if (end) skip = end - p + 1; -else if (remaining = sizeof(s-buffer) - 1) { -end = p + sizeof(s-buffer) - 1; +else if (remaining = s-size - 1) { +/* ran out of buffer space, log what we have */ +end = s-buffer + s-size - 1; skip = remaining; } else break; -*end = 0; +*end = '\0'; r = stdout_stream_line(s, p); if (r 0) @@ -268,7 +270,7 @@ static int stdout_stream_scan(StdoutStream *s, bool force_flush) { } if (force_flush remaining 0) { -p[remaining] = 0; +p[remaining] = '\0'; r = stdout_stream_line(s, p); if (r 0) return r; @@ -291,7 +293,7 @@ int stdout_stream_process(StdoutStream *s) { assert(s); -l = read(s-fd, s-buffer+s-length, sizeof(s-buffer)-1-s-length); +l = read(s-fd, s-buffer+s-length, s-size-1-s-length); if (l 0) { if (errno == EAGAIN) @@ -339,6 +341,7 @@ void stdout_stream_free(StdoutStream *s) { freecon(s-security_context); #endif +free(s-buffer); free(s-identifier); free(s); } @@ -371,6 +374,13 @@ int stdout_stream_new(Server *s) { close_nointr_nofail(fd); return log_oom(); } +stream-buffer = malloc0(LINE_MAX); +if (!stream-buffer) { +free(stream); +close_nointr_nofail(fd); +return log_oom(); +} +stream-size = LINE_MAX; stream-fd = fd; -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] journald: when buffering stdout, allow buffer to grow if needed
When logging really long lines (e.g. those without an '\n') to journald via capture of stdout, the hardcoded buffer length of LINE_MAX limited us to processing the data in 2KB chunks. This is rather inefficient if we are getting a 1+ MB message handed to us. Actual case is via a unit file where PostgreSQL logs via stdout and emits slow query logs. When the slow query is a long multi-row insert statement, it can often be a megabyte or more of text. Rather than process this as one message and going down the stack to the compression code just once, we were doing it for each and every 2K read() call. --- As stated in the prior patch, if there is some preexisting dynamic buffer stuff I should be using, please let me know. Here is a brief test script that stresses the stdout capture. Run it through systemd-run and watch the CPU usage of the systemd-journal process before and after. #!/usr/bin/env python2 data = [] for i in range(1000): data.append('abcdefghijklmnopqrstuvwxyz') data.append('%d' % i) print ' '.join(data * 5) print ' '.join(data * 15) print ' '.join(data * 25) src/journal/journald-stream.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 193d438..890c0bf 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -236,6 +236,8 @@ static int stdout_stream_line(StdoutStream *s, char *p) { assert_not_reached(Unknown stream state); } +#define STDOUT_BUFFER_MAX 256*1024u + static int stdout_stream_scan(StdoutStream *s, bool force_flush) { char *p; size_t remaining; @@ -253,7 +255,22 @@ static int stdout_stream_scan(StdoutStream *s, bool force_flush) { if (end) skip = end - p + 1; else if (remaining = s-size - 1) { -/* ran out of buffer space, log what we have */ +/* grow buffer up to max permitted size if possible; if + * we fail to alloc just use the old buffer. */ +if (s-size STDOUT_BUFFER_MAX) { +char *new_buffer; +size_t new_size; + +new_size = MIN(s-size * 2, STDOUT_BUFFER_MAX); +new_buffer = realloc(s-buffer, new_size); +if (new_buffer) { +p = new_buffer + (p - s-buffer); +memset(new_buffer[s-size], 0, new_size-s-size); +s-size = new_size; +s-buffer = new_buffer; +} +break; +} end = s-buffer + s-size - 1; skip = remaining; } else -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Question about a udev rule
I've got this small rule which seems to not work at all: ACTION!=add|change, GOTO=end_root_symlink SUBSYSTEM!=block, GOTO=end_root_symlink ENV{DEVTYPE}!=partition, GOTO=end_root_symlink IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ENV{MINOR}==$env{ROOT_MINOR}, SYMLINK+=root LABEL=end_root_symlink Can anyone tell me what I'm doing wrong? -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Re:Re: How to use systemctl preset ?
Thanks your answer, Andrey. But what is remove policy, I can't understand what you mean. Would you plz explain more abou it? I already added all units which I'd like to disable in 00-first.preset file. 00-first.preset include: disable connman.service disable wpa_supplicant.service As you said, systemctl preset connman.service command worked well and cancel symlink from installed .want folder. So, Is there any way to remove many units which I want to disable at once? Thanks. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question about a udev rule
Robert Milasan [2013-12-08 19:14 +0100]: IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ^ For starters you seem to be missing a comma there. -- Martin Pitt| http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question about a udev rule
В Sun, 8 Dec 2013 19:14:17 +0100 Robert Milasan rmila...@suse.com пишет: I've got this small rule which seems to not work at all: ACTION!=add|change, GOTO=end_root_symlink SUBSYSTEM!=block, GOTO=end_root_symlink ENV{DEVTYPE}!=partition, GOTO=end_root_symlink IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ^ is not comma missing here? ENV{MINOR}==$env{ROOT_MINOR}, SYMLINK+=root LABEL=end_root_symlink Can anyone tell me what I'm doing wrong? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question about a udev rule
On Sun, 8 Dec 2013 19:30:45 +0100 Martin Pitt martin.p...@ubuntu.com wrote: Robert Milasan [2013-12-08 19:14 +0100]: IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ^ For starters you seem to be missing a comma there. Not really, it's a new line, just the mail client didn't do a good job :) Suppose to be: IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ENV{MINOR}==$env{ROOT_MINOR}, SYMLINK+=root -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question about a udev rule
On Sun, 8 Dec 2013 19:30:45 +0100 Martin Pitt martin.p...@ubuntu.com wrote: Robert Milasan [2013-12-08 19:14 +0100]: IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ^ For starters you seem to be missing a comma there. I've attached the rule, might be easier to see it. -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmila...@suse.com GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A 10-root-symlink.rules Description: Binary data ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] Ensure unit is journaled for short-lived or oneshot processes
In the time it takes to process incoming log messages, the process we are logging details for may exit. This means the cgroup data is no longer available from '/proc'. Unfortunately, the way the code was structured before, we never log _SYSTEMD_UNIT if we don't have this cgroup information. Add an else if case that allows the passed in unit_id to be logged even if we couldn't capture cgroup information. This ensures a command like `journalctl -u run-XXX` will return all log messages from a oneshot process. --- src/journal/journald-server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 01e75b6..fc8115c 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -626,6 +626,9 @@ static void dispatch_message_real( } free(c); +} else if (unit_id) { +x = strappenda(_SYSTEMD_UNIT=, unit_id); +IOVEC_SET_STRING(iovec[n++], x); } #ifdef HAVE_SELINUX -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] Fix memory leak in stdout journal streams
--- src/journal/journald-stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 890c0bf..eb9ea36 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -360,6 +360,7 @@ void stdout_stream_free(StdoutStream *s) { free(s-buffer); free(s-identifier); +free(s-unit_id); free(s); } -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Ensure unit is journaled for short-lived or oneshot processes
How reliable is the unit_id data this falls back to? If it's going into an underscore-prefixed field in the journal, we need confidence that it's not forgeable. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Fix memory leak in stdout journal streams
This fails to apply for me. Just to check yours methods and mine, I tried applying your Ensure unit is journaled for short-lived or oneshot processes patch and succeeded. Comparing the two, it looks like the text above the first triple-hyphen got dropped. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Fix memory leak in stdout journal streams
On Sun, Dec 8, 2013 at 1:56 PM, David Timothy Strauss da...@davidstrauss.net wrote: This fails to apply for me. Just to check yours methods and mine, I tried applying your Ensure unit is journaled for short-lived or oneshot processes patch and succeeded. Comparing the two, it looks like the text above the first triple-hyphen got dropped. It is the free(s-buffer); bit that snuck in there from the other patches I sent this morning. I can rebase this one before those so it applies to the current tree, my mistake. -Dan ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] Fix memory leak in stdout journal streams
Just as 'identifier' is strdup-ed and freed, we need to do the same for unit_id. --- src/journal/journald-stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 9ca26e2..091f59d 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -340,6 +340,7 @@ void stdout_stream_free(StdoutStream *s) { #endif free(s-identifier); +free(s-unit_id); free(s); } -- 1.8.5.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Fix memory leak in stdout journal streams
On Sun, Dec 8, 2013 at 12:23 PM, Dan McGee d...@archlinux.org wrote: It is the free(s-buffer); bit that snuck in there from the other patches I sent this morning. I can rebase this one before those so it applies to the current tree, my mistake. Aha! Applied. Thanks. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] systemd: always start jobs for units in SYSTEMD_WANTS=
On Sat, 07.12.13 00:35, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote: Before they would only be started when the unit transitioned from inactive to active state. Now, they will be started also on other udev events. https://bugzilla.redhat.com/show_bug.cgi?id=1026860: we have an MD device holding an LVM PV. When it is detected, and the systemd .device unit is created, the device is not yet ready to be used. Later, after an udev change event, the device is ready and LVM udev rules add a SYSTEMD_WANTS=lvm2-pvscan@xxx.service tag. But since the device was active (in systemd's mind) before, the SYSTEMD_WANTS service was not run. Hmm? We introduce the SYSTEMD_READY property for LVM. A device is only considered active by systemd if that property is either unset or set to 1. If it is set to 0 however, the device is considered inactve. I have the suspicion that there's exactly zero to fix in systemd here, it's just that something between LVM and MD is not setting that property properly? 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-nspawn and pam_securetty
On Sat, 07.12.13 18:25, Colin Guthrie (gm...@colin.guthr.ie) wrote: Hi, So playing around a bit it seems our default pam config for pam.d/login uses a pam_securetty to only allow root logins via secure seats. The file /etc/securetty are tty0-6 and vc/1-6 When booting with nspawn, the tty is console and thus I cannot login as root. Can I ask people here a few questions: 1. Is pam_securetty worth it? Nope. It's really stupid. 2. If so, is adding console to the default /etc/securetty safe? It's in there at least on Fedora. I am pretty sure the least all distros should do is include it there. But actually they should just get rid of entirely. If you add console to securetty, then logging in directly on the nspawn console will certainly work, but using machinectl login still won't. 3. And finally, if we should not add console, could nspawn do something clever with a temporary file + bind mount to temporarily allow console logins in the /etc/securetty without actually modifying it. I don't think it's worth trying to bind mount it like that, since there a couple of ioctls that leak the original name (ptsname()), and there are cases where you need to look up the device in /sys. In fact, in systemd we have some code to track down to which tty /dev/tty, /dev/tty0, and /dev/console currently point, and playing games with renaming things certainly conrtadicts the general goal of such code... 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-nspawn and kernel command line
On Sat, 07.12.13 18:33, Colin Guthrie (gm...@colin.guthr.ie) wrote: Hi, When playing with systemd-nspawn, is there a way to override the kernel command line seen inside the container. I mean it's probably not correct that the host systems /proc/cmdline leaks into the container. Most of systemd's own code actually knows this, and will ignore /proc/cmdline if it detects that it is being run in a container. (I recently unified this checking in util.c's proc_cmdline() call, so that we don't forget to check this by mistake somewhere). Where di you run into problems with this? 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-nspawn and kernel command line
On Sat, 07.12.13 19:03, Colin Guthrie (gm...@colin.guthr.ie) wrote: 'Twas brillig, and Shawn Landden at 07/12/13 18:57 did gyre and gimble: On Sat, Dec 7, 2013 at 10:33 AM, Colin Guthrie gm...@colin.guthr.ie wrote: Hi, When playing with systemd-nspawn, is there a way to override the kernel command line seen inside the container. I mean it's probably not correct that the host systems /proc/cmdline leaks into the container. No it is not, /proc/cmdline cannot be changed. What is your use case? Perhaps this could be added to UTS namespaces? Could you not bind mount over it with a temporary file? Might be kinda tricky to do tho' if it is possible. My main use case is that we have a rescue system which passes rescue on the command line of the host system. If I use this system to boot containers (which would typically be the system we are rescuing, then it reads this rescue is read in the container and starts rescue.target automatically rather than whatever default.target is. We'd probably want to specifically boot a multi-user.target by default and the best way to do that temporarily would be to provide a fake command line to the booted instance. Now we could change what we use to identify our rescue image, but it would seem to me that this shouldn't be needed and faking kernel command lines as seen by containers should be something that's possible. So, we don't really have a clear story here. As Shawn pointed out we can certainly overmount /proc/cmdline, but you currently have to request that manually. We actually already overmount /proc/sys/kernel/random/boot_id so that every boot-up in the container gets its own boot ID, which makes the journal a lot nicer to work with (because otherwise journalctl -b is not so fun to use...) Now, if we play this game for the boot id I does make we wonder why we shouldn't also play the same game for /proc/cmdline. I mean, in general I think the onus should be on the container manager to virtualize things properly. Working around container limitations from the inside sounds much less ideal. So yeah, maybe we should generate a throw-away temporary file where we write all addition arguments of the nspawn command line into and then mount that into /proc/cmdline. Then, lets drop the special container checking in systemd for accessing /proc/cmdline. And also update the container interface wiki doc, so that other container managers follow suit. 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-nspawn and pam_securetty
'Twas brillig, and Lennart Poettering at 08/12/13 23:46 did gyre and gimble: 3. And finally, if we should not add console, could nspawn do something clever with a temporary file + bind mount to temporarily allow console logins in the /etc/securetty without actually modifying it. I don't think it's worth trying to bind mount it like that, since there a couple of ioctls that leak the original name (ptsname()), and there are cases where you need to look up the device in /sys. In fact, in systemd we have some code to track down to which tty /dev/tty, /dev/tty0, and /dev/console currently point, and playing games with renaming things certainly conrtadicts the general goal of such code... I was really meaning bind mounting over /etc/securetty with new content not the /dev/tty* or /dev/console or anything more creative like that. Your (and others) answers are pretty clear tho' and confirm what I suspected (and hence made my first question!). Cheers all! Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd unit review requested
On Fri, Dec 06, 2013 at 04:10:02PM +0100, Kay Sievers wrote: On Fri, Dec 6, 2013 at 7:20 AM, Peter Hutterer peter.hutte...@who-t.net wrote: It also depends on the wacom_w8001 and how it reacts when it's loaded and no hardware is present. Peter, couldn't this module be autoloaded? the module just sits there, it needs to be triggered by inputattach to actually hook onto the device. there's a small number of devices only that need it, so unconditionally modprobing it seems a bit wasteful. Just curious: There is one auto-loading alias in the module for the serio bus: $ modinfo wacom_w8001 | grep alias alias: serio:ty02pr39id*ex* Does that work? For all devices or only a few? Can the serial device be detected that way? Does inputattach talk to the device to find out what it is? tbh, I'm not sure how to answer these questions, it's not something I've had to deal with in the past so I've got little to no knowledge of this. inputattach does not talk to the device, it merely sets various fields as provided by the user, hence the --w8001 flag. other than that, it's pretty much down to four commands: open(dev/ttyS0) setline(fd, CS8, baudrate) ioctl(fd, TIOSETD, N_MOUSE) ioctl(fd, SPIOCSTYPE, SERIO_W8001) That's why we need the udev rule to match the pnpid, because inputattach doesn't do any matching and we need to provide the right arguments already. afaik the only way to detect the device is to search for e.g. WACf in the pnpid. Cheers, Peter ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/4] core: lazy distribute for Distribute pools
On Mon, Nov 18, 2013 at 12:36:52AM +0100, Zbigniew Jędrzejewski-Szmek wrote: On Sun, Nov 17, 2013 at 02:57:56PM -0800, Shawn Landden wrote: On Sun, Nov 17, 2013 at 2:28 PM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Sun, Nov 17, 2013 at 08:46:46PM +0100, Lennart Poettering wrote: On Sat, 16.11.13 13:18, Shawn Landden (sh...@churchofgit.com) wrote: So, what's the status here? Are you sending a new series, or is this one supposed to be merged? Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd unit review requested
On Thu, Dec 05, 2013 at 01:24:10PM +, Jóhann B. Guðmundsson wrote: [...] So we need an udev wacom-serial-driver rule that might look like this for the wacom serial devices ACTION==remove, GOTO=drivers_end ENV{MODALIAS}==?*, RUN{builtin}=kmod load $env{MODALIAS} SUBSYSTEM==tty|pnp, SUBSYSTEMS==pnp, ATTRS{id}==WACf*, ENV{ID_MODEL}=Serial Wacom Tablet $attr{id}, ENV{ID_INPUT}=1, ENV{ID_INPUT_TABLET}=1, ENV{NAME}=Serial Wacom Tablet $attr{id} ,RUN{builtin}=kmod load wacom_w8001 SUBSYSTEM==tty|pnp, SUBSYSTEMS==pnp, ATTRS{id}==FUJ*, ENV{ID_MODEL}=Serial Wacom Tablet $attr{id}, ENV{ID_INPUT}=1, ENV{ID_INPUT_TABLET}=1, ENV{NAME}=Serial Wacom Tablet $attr{id} ,RUN{builtin}=kmod load wacom_w8001 LABEL=drivers_end Followed by an systemd rule that looks something like this SUBSYSTEM==module, KERNEL==wacom*, TAG+=systemd, ENV{SYSTEMD_WANTS}+=wacom-inputattach@%k.service And the modprobe would be dropped from that unit file but as I say I'm not all that familiar with udev policy rules and I personally had not planned on mastering udev until I started the cleanup process in Fedora which might never happen today thanks to the that WG process. I tested this today and it works, except for one issue where I got stuck: since the actual service is now triggered by the module loading, %k now refers to the module name, not to the actual device anymore. I'm not sure how to get the device path (which I need for inputattach) from that. otherwise it woks just fine :) Cheers, Peter ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question regarding the NotifyAccess parameter
Hello did any body get a chance to look into this. I am a kind of stuck on this. I can work around using ExecStartPre script where I can kill the previous instances. But if systemd is capable to do it by itself, that would be the neat solution. Thanks ~S On 5 December 2013 13:19, salil GK gksa...@gmail.com wrote: Hello I am using Fedora 19 and systemd in it is 204 I guess. The issue is present in there. The following is whatmy unit file is cat /usr/lib/systemd/system/Myservice.service [Unit] Description=This is a test service [Service] #PIDFile=/var/run/Myservice.pid #ExecStartPre=/tmp/one_start_pre.sh #ExecStartPre=/bin/systemctl stop Myservice ExecStartPost=/tmp/one_start_post.sh #ExecStartPre=/usr/bin/systemctl stop Myservice RemainAfterExit=yes ExecStart=/tmp/one.sh *Restart=on-failure* NotifyAccess=all WatchdogSec=10 User=admin Group=admin [Install] Alias=myservice.services systemctl output sudo systemctl status Myservice Myservice.service - This is a test service Loaded: loaded (/usr/lib/systemd/system/Myservice.service; disabled) Active: active (running) since Thu 2013-12-05 18:39:36 IST; 1s ago Process: 20968 ExecStartPost=/tmp/one_start_post.sh (code=exited, status=0/SUCCESS) Main PID: 20967 (one.sh) CGroup: name=systemd:/system/Myservice.service ├─*20967* /bin/bash /tmp/one.sh └─20971 sleep 5 After some time I made the watchdog timer fail. sudo systemctl status Myservice Myservice.service - This is a test service Loaded: loaded (/usr/lib/systemd/system/Myservice.service; disabled) Active: active (running) since Thu 2013-12-05 18:40:52 IST; 2s ago Process: 21180 ExecStartPost=/tmp/one_start_post.sh (code=exited, status=0/SUCCESS) Main PID: 21179 (one.sh) CGroup: name=systemd:/system/Myservice.service ├─*20967* /bin/bash /tmp/one.sh ├─21006 /bin/bash /tmp/one.sh ├─21030 /bin/bash /tmp/one.sh ├─21058 /bin/bash /tmp/one.sh ├─21092 /bin/bash /tmp/one.sh ├─21133 /bin/bash /tmp/one.sh ├─21166 sleep 5 ├─21169 sleep 5 ├─21172 sleep 5 ├─21175 sleep 5 ├─21178 sleep 5 ├─21179 /bin/bash /tmp/one.sh ├─21184 sleep 5 └─21191 sleep 5 $$ ] systemctl --version systemd 204 +PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ Thanks Salil On 26 November 2013 20:27, Hoyer, Marko (ADITG/SW2) mho...@de.adit-jv.com wrote: One more issue I observed is - if I specify Restart=on-failure, if watchdog timer expire, it restart the service. But I can see that it create two processes rather than restarting the process. But if I do systemctl restart Myservice , it kills the previous instance of service and start a new service. Any pointers on why it happens so. This part has been already reported as a bug in May: http://lists.freedesktop.org/archives/systemd-devel/2013-May/011030.html Best to my knowledge, this has been fixed in systemd 203, 204, or 205 ... Please note that the link above does not contain the final bug fix. Some discussions followed which led to the final solution at a certain point. Follow the threads, you'll find it ... Best regards Marko Hoyer Software Group II (ADITG/SW2) Tel. +49 5121 49 6948 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/4] core: lazy distribute for Distribute pools
On Sun, Dec 8, 2013 at 7:50 PM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Mon, Nov 18, 2013 at 12:36:52AM +0100, Zbigniew Jędrzejewski-Szmek wrote: On Sun, Nov 17, 2013 at 02:57:56PM -0800, Shawn Landden wrote: On Sun, Nov 17, 2013 at 2:28 PM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Sun, Nov 17, 2013 at 08:46:46PM +0100, Lennart Poettering wrote: On Sat, 16.11.13 13:18, Shawn Landden (sh...@churchofgit.com) wrote: So, what's the status here? Are you sending a new series, or is this one supposed to be merged? This one doesn't work. I have have a somewhat-working next patch, but the way epoll_wait works it actually isn't lazy at all, and would require EPOLLET to even do one-spawn-per-connection (global connection), but we can't do that with the current event loop. I ended up getting side-tracked into adding mount-namespace to lsof, cause i noticed that feature lacking while working on this Anyways, a new series will come, and I am working on it. Zbyszek -- --- Shawn Landden +1 360 389 3001 (SMS preferred) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question about a udev rule
On 12/08/2013 07:14 PM, Robert Milasan wrote: I've got this small rule which seems to not work at all: ACTION!=add|change, GOTO=end_root_symlink SUBSYSTEM!=block, GOTO=end_root_symlink ENV{DEVTYPE}!=partition, GOTO=end_root_symlink IMPORT{program}=/usr/bin/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ENV{MAJOR}!=0, ENV{MAJOR}==$env{ROOT_MAJOR}, ENV{MINOR}==$env{ROOT_MINOR}, SYMLINK+=root LABEL=end_root_symlink Can anyone tell me what I'm doing wrong? 'udevadm info' pulls information from the udev database, which is filled with information _after_ the rule has been processed. So for the current event the udev database will be empty. Also, calling 'udevadm info' from a udev rule is inherently wrong, due to two reasons: 1) udev rules deal with single events only. So all information for the current event is directly available (set in environment variables etc), and there is no need to call 'udevadm info' 2) For cross-event mechanisms (ie if you need to synchronize between several events) you should be using appropriate mechanisms like collect. And the 'root' symlink is generated directly by dracut; maybe you should look there ... Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel