Giter Site home page Giter Site logo

s6's People

Contributors

atlaua avatar heliocat avatar jjk-jacky avatar mobin-2008 avatar skarnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s6's Issues

Unable to build after #82e33dd

Following the standard build-from-code process

RUN cd /tmp && git clone git://git.skarnet.org/skalibs && cd skalibs && ./configure && make && make install
RUN cd /tmp && git clone git://git.skarnet.org/execline && cd execline && ./configure && make && make install
RUN cd /tmp && git clone git://git.skarnet.org/s6 && cd s6 && ./configure && make && make install

However, now we get build failures stating that recipe for target 's6-ftrig-listen' failed because cannot find -lexecline

This seems to be directly correlated to the recent #82e33dd

Any thoughts? Or have build instructions changed?

Thanks,
Ray

readiness notification not working

I have been trying to make readiness notification work for snmpd daemon but somehow I always end up in errno 9 EBADF 9 Bad file descriptor

Below is the readiness snippet in snmpd

#ifdef S6_NOTIFY
#define NOTIFY_FD 9
    if (write(NOTIFY_FD, "\n", 1) > 0) {
        close(NOTIFY_FD);
        printf("notifying s6 success\n");
    } else {
        printf("notifying s6 failed with errno=%d\n", errno);
    }
#endif

And below are the contents in snmpd-srv directory

root@(none):/etc/s6/source/snmpd-srv# cat notification-fd
9
root@(none):/etc/s6/source/snmpd-srv#
root@(none):/etc/s6/source/snmpd-srv# cat run
#!/bin/execlineb -P
foreground { echo "snmp service started" }
/usr/local/sbin/snmpd -f
root@(none):/etc/s6/source/snmpd-srv#
root@(none):/etc/s6/source/snmpd-srv# cat type
longrun
root@(none):/etc/s6/source/snmpd-srv#

Am I missing something? Please let me know if any further information is required.
Any help is really appreciated.

Installation Error

Tried the .configure, but:

./configure && make && sudo make install Checking for C compiler... ... gcc Checking whether C compiler works... ... yes Checking target system type... ... x86_64-linux-gnu ./configure: error: /usr/lib/skalibs/sysdeps is not a valid sysdeps directory root@devuan:~/s6# ./configure Checking for C compiler... ... gcc Checking whether C compiler works... ... yes Checking target system type... ... x86_64-linux-gnu ./configure: error: /usr/lib/skalibs/sysdeps is not a valid sysdeps directory

I tried creating that directory, but received the same error. Any advice?

s6-svscan shows warning messages on arm32v7/alpine container

Platform: arm32v7/alpine container (Host OS is either Debian 10 amd64 or Raspberry Pi OS arm32)
s6 version: 2.10.0.2

When I execute s6-svscan, following warning messages are displayed although the services work fine.

$ cat /etc/s6/cron/run
#!/bin/sh

exec cron -f -d 8

$ s6-svscan /etc/s6
crond: crond (busybox 1.32.1) started, log level 8
s6-supervise yes: warning: can't happen: timeout while the service is up!
s6-supervise yes: warning: can't happen: timeout while the service is up!
s6-supervise yes: warning: can't happen: timeout while the service is up!

s6-2.9.1.0 does not show the messages in the same situation.

importas bug

reproduce:
backtick PWD { pwd }
importas MYPATH PWD
foreground
{ mkdir -p /logs${MYPATH} }
take a look at /logs
there is a ? in the path

Failing to build the latest s6 V2.10.0.0

I followed the standard build process to install the latest s6.
It always getting issue on src/libs/s6_svc_ok.c, could you give me some guide how to solve the issue?
src/libs6/s6_svc_ok.c: In function 's6_svc_ok': src/libs6/s6_svc_ok.c:21:3: error: implicit declaration of function 'fd_islocked' [-Werror=implicit-function-declaration] r = fd_islocked(fd) ; ^ cc1: some warnings being treated as errors make: *** [Makefile:135: src/libs6/s6_svc_ok.lo] Error 1

[feature] Provide already-built (perhaps statically linked) binaries

Unfortunately many Linux distributions (for example OpenSUSE) don't provide any s6 (or execline) builds. Moreover building s6 is not straight forward as it depends on skalibs (with the same fate).

Therefore it would be nice if you could provide an already-built set of binaries (perhaps statically linked) at least for x86_64.

Alternatively in order to improve compatibility with as many Linux distributions, you could:

  • start an older CentOS VM (or Debian, Ubuntu, etc.);
  • use the rpath feature to link the skalibs .so as relative to where the binaries live; (say you provide a bin and lib folder that should always be kept side-by-side;)
  • package the binaries and any required .so (except the ones provided by libc);

Philosophy on command line built in help `--help`

I really like s6. I strive to use it, but I do sometimes struggle at times.

I note that all the tools only have terse usage built in. For example s6-svc:

alpine312:~$ s6-svc --help
s6-svc: usage: s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcyroduxOX ] servicedir

IIUC --help doesn't exist, and its just the error in usage triggering the output. The meaning of -a, or -wu etc isn't in the output.

Contrast to another tool like service (Alpine Linux):

alpine312:~$ service --help
Usage: rc-service [options] [-i] <service> <cmd>...
   or: rc-service [options] -e <service>
   or: rc-service [options] -l
   or: rc-service [options] -r <service>

Options: [ cdDe:ilr:INsSZChqVv ]
  -d, --debug                       set xtrace when running the command
  -D, --nodeps                      ignore dependencies
  -e, --exists <arg>                tests if the service exists or not
  <snip>

I don't use s6 or skalib suite tools all the time and I'm quite forgetful. I need to google the documentation to do simple things because its not clear from commands what they do without the memorising or looking up the documentation. Which is fine. I'm just curious on the rational behind it. Is it purely to minimise the file size and, programming complexity, a separation of concerns, or something else?

I know in alpine I can install the s6-doc package which has HTML documentation, and there's an on-going effort to port man-pages in https://github.com/flexibeast/s6-man-pages, which includes s6-svc. These are what I need for a self-contained system to avoid going online.

[Question] Disabling service within service itself

I use a docker image which uses s6. I added my own custom /etc/s6/custom/run s6 service script, which performs some work (only once), and then must not be restarted.

I thought if that script simply creates a /etc/s6/custom/down file, the service will not be restarted - but it is.

So instead the script performs its work, then does this: $ s6-svc -D /etc/s6/custom. That seems to work.

But I'm calling s6 from inside an s6 service. I wonder whether that is a supported scenario, or whether I am asking for trouble?

Noob here, I have a couple of questions.

I have installed and set up s6 yesterday, but I have read through the docs and there are a bunch of things I cannot understand.

Would you mind answering these few?

  1. What is a bundle.
  2. How can I enable a service, eg. sddm, on boot.
  3. How can I disable a service after it has been enabled for boot.

Thanks

s6-supervise: does not follow symlinks when creating supervise directory

if ((mkdir(subdir, (mode_t)subdirmode) == -1) && (errno != EEXIST))

XBPS packages are delivered with supervise pointing to a yet-to-exist location in /run. For example, openntpd has the following links:

/etc/sv/openntpd/log/supervise -> /run/runit/supervise.openntpd-log
/etc/sv/openntpd/supervise -> /run/runit/supervise.openntpd

Ideally, s6-supervise would resolve the link and attempt to create the directories in /run.

notifyoncheck does not kill check after localtimeout

We are using notifyoncheck to call the data/check program with -t 5000 to set a 5 second timeout for the check program to exit. There are times when the logic of the check script hangs (child process never returns). In this case, I expect notifyoncheck to kill the check and start a new one. However we are seeing multiple checks all running in the same time.

Based on https://github.com/skarnet/s6/blob/master/src/supervision/s6-notifyoncheck.c#L254, it seems like contrary to the documentation, the process is not killed and another check is performed.

selfpipe_init: error with s6-svscan

Running the s6-svscanboot on Illumos gives the following error:

s6-svscan: fatal: unable to selfpipe_init: No such file or directory

No matter how I try to run s6-svscan it gives the same error.

s6-setuidgid not working with colon, s6-applyuidgid problem?

Using binaries from v1.21.8.0/s6-overlay-amd64.tar.gz:

[root@localhost bin]# s6-setuidgid root uptime
 00:29:31 up  2:56,  2 users,  load average: 0.00, 0.01, 0.00
[root@localhost bin]# s6-setuidgid root:root uptime
s6-applyuidgid: usage: s6-applyuidgid [ -z ] [ -u uid ] [ -g gid ] [ -G gidlist ] [ -U ] prog...

Can't get s6-applyuidgid to run properly:

[root@localhost bin]# s6-applyuidgid -u root uptime
s6-applyuidgid: usage: s6-applyuidgid [ -z ] [ -u uid ] [ -g gid ] [ -G gidlist ] [ -U ] prog...

Exec Stop Functionality in s6

I've just started using s6 in some containers and I'm trying to identify a way to replicate the functionality of ExecStop in systemd? Essentially i would like to send a specific command to shutdown a process. I've attempted to use the final service file functionality as well as cont-final.d and down-signal but neither of those locations seem to execute prior to the SIGTERM being sent. Assistance is greatly appreciated.

Unable to shutdown on T500 artix with s6

S6 was recently supported by Artix Linux, so I wanted to try it out. I migrated my machine to use s6, and I was surprised. I noticed a slight speedup from when grub is done to when I can log in compared to runit, what I was using previously. I'm loving s6 so far, the way it works is simple yet powerful, it seems to be a lot more open-ended then runit as well.

But, onto the problem. On my T500, my current main machine, whenever I run sudo shutdown -h 0 it shuts down Xorg, kills the processes, then it just stays on system restart: system halted and won't actually shutdown. Restarting works, however. On runit and s6 it takes a few seconds to actually restart, but I've left it on system restart: system halted for at least 30 seconds and it stayed running, I ended up having to just hold the power button, what I have been doing. I searched around, tried a few different commands to shutdown that ended in the same problem. I thought it might have been something with the migration, so I decided to reinstall Artix and got the same problem. I'm not sure if I needed to post this to the artix forums or here, so I went with here. Any response would be greatly appreciated.

Failed to build the latest s6 v2.10.0.0

I just followed the standard build and install process for the latest s6 version.
The following error broke the installing process, see details below, could you give me some guide how to get solve this isseu.

src/libs6/s6_svc_ok.c: In function 's6_svc_ok': src/libs6/s6_svc_ok.c:21:3: error: implicit declaration of function 'fd_islocked' [-Werror=implicit-function-declaration] r = fd_islocked(fd) ; ^ cc1: some warnings being treated as errors make: *** [Makefile:135: src/libs6/s6_svc_ok.lo] Error 1

[Question] transition to s6 based init

Hello @skarnet

I want to try s6 as my primary init system. I am using Gentoo and Alpine linux

It looks like Gentoo wiki page is outdated, as it refers to 0.4 and 1.0 versions of s6 (while releases show 2.x)
https://wiki.gentoo.org/wiki/S6_and_s6-rc-based_init_system

Do you happen to know of any existing manuals or success stories that describe the process of building s6 based linux system?
Perhaps you can share some of your personal experience. I've read a lot of https://skarnet.org/software/s6/ but what I think is missing is a good "How to get started" guide.

Maybe there are Linux distributions that are better suited to get started with s6 then others.

Thanks!

compiling s6 using tcc failed

when i tried to compile s6 using tcc i get this error massage:
exec tcc -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -iquote src/include-local -Isrc/include -fPIC -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -pipe -Wall -std=c99 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer -fno-stack-protector -c -o src/daemontools-extras/s6-log.o src/daemontools-extras/s6-log.c tcc: error: invalid option -- '-iquote'

the command was:
make CC=tcc install

s6-svc -d and other signals are not affecting service as expected?

I'm having troubles using s6-svc to restart, reload, or shutdown a postgres service supervised by s6. It's possible I just don't understand s6 correctly, but after reading the doc multiple times I'm still stuck.

  • s6-svc -d is supposed to shutdown the service but it doesn't seem to do anything.
  • s6-svc -t is supposed to send a SIGTERM signal which according to PostgreSQL's doc should trigger a "Smart Shutdown", but instead it triggers a "Fast Shutdown". When I send SIGTERM via kill it does trigger the Smart Shutdown.
  • s6-svc -i is supposed to send a SIGINT signal which according to PostgreSQL's doc should trigger a "Fast Shutdown", but instead it doesn't seem to do anything. When I send SIGINT via kill it does trigger the Fast Shutdown.
  • s6-svc -h is supposed to send a SIGHUP signal which according to PostgreSQL's doc should trigger a configuration reload, but instead it doesn't seem to do anything. When I send SIGHUP via kill it does reload the configuration.

The way I know it does or doesn't do what's expected is simply by looking at PostgreSQL log file, which explicitly states whenever something is triggered.

The way I send signals with kill is:

kill -<SIGNAL_NAME> $(head -n 1 /var/lib/postgresql/13/main/postmaster.pid)

I use s6-overlay 2.2.0.1 (containing s6 2.10.0.0) and I start a PostgreSQL service with the following run file:

#!/usr/bin/with-contenv sh

s6-setuidgid postgres /usr/lib/postgresql/13/bin/postgres -D /etc/postgresql/13/main/ >> /var/log/postgresql/postgresql.log 2>&1

Did I misunderstand s6-svc documentation, or is there some issue with it?

adding hostname in s6-socklog lines and date repetition in s6-log

Hi,

I certainly missing something, but when using postfix with s6-socklog (using the s6-overlay syslogd addon), I end up having the date
duplicated in every log lines. As far as I understood posfix doesn't log any date.

I ended up using S6_LOGGING_SCRIPT='n20 s1000000' and thus removing the T parameter, but this means that s6-log and s6-socklog are both logging timestamps. I wonder if this is normal.

Also, is there a way to add a server name in the log line (to be compatible with postfix log parser), to have something like

Aug 26 11:19:05 smtp postfix/postfix-script[25430]: refreshing the Postfix mail system

instead of

Aug 26 11:19:05 postfix/postfix-script[25430]: refreshing the Postfix mail system

Best regards

ExecStartPost equivalent functionality in s6

Recently I have been migrating services from systemd to s6. Few of my systemd services use ExecStartPost commands after ExecStart is run but I couldn't see any equivalent functionality in s6. Basically I want to run few commands as soon as my main process is started (it could be a daemon or a oneshot process). Is there a way to do this?

I was actually thinking to start a script prior to starting the main process and use s6-svwait until the service is up/ready and run the commands but I later realised that is going to work only for longrun processes and not for oneshot (since supervise doesn't run for oneshot). Any help is much appreciated.

Allow s6-svscan to handle more signals

I can't seem to get s6-svscan -s to divert signals such as SIGPWR and SIGRTMIN+3 on Alpine. Creating /etc/s6/services/.s6-svscan/SIGPWR or SIGRTMIN+3 don't appear to have an effect. I even tried SIG??? since sig_name returns ??? when it can't determine the name, but that doesn't work either for whatever reason. Presumably child_spawn0 doesn't like the question marks.

Obviously, the docs don't mention this is possible since there is an explicit list of supported signals. All of the diverted signals listed in the docs work fine. However, it would be nice to be able to handle other signals even if they're not defined in sig_table and/or don't have a defined constant.

The primary reason for wanting SIGRTMIN+3 is for handling the lxc-stop command gracefully without having to set lxc.signal.halt to something else.

Perhaps s6-svscan could fall back to using the signal number when searching for the handler script if sig_name returns ???, or supporting both name and number?

s6-log: log retention duration

With the GDPR (RGPD in french) the logging policy must be stated in terms of retention duration (especially when they might contain personal data, like an IP address).

Currently s6-log does not seem to have the ability to enforce a policy like: keep the logs for at most 90 days.


It would probably needs to articulate around 2 settings:

  • max_retention: logdirs should contain only archived files newer than a given time (e.g. 89 days)
  • autorotate_duration: rotate the log after a given time (e.g. 1 day)

This last setting is necessary if a service does not log much, its timespan must be added to the max_retention duration (if a log contains 10 days of data, then the logs will be actually kept for 89+10= 99 days).

What do you think?

A few questions

I have read your whole Blog on s6, and I have a few questions -

  • Benefits over runit?
  • why use database instead of symlinks?
  • why some command-line options do not have a long form?
  • you said that the concept of runlevels in runit didn't work in case of udevd, which had to be run unsupervised in runlevel 1. How does s6 address this problem?
  • why there is no man documentation for s6 and it's related binaries?
  • did Gerrit Pape abandon runit? Has development stopped?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.