Menu

#4521 webmin bypasses systemd units

1.720
open
nobody
None
5
2014-12-13
2014-12-11
kurczaq
No

Hi

seems webmin does not work with systemd? It is at least bypassing the apache2.service unit when restarting apache? I have additional systemd directives in the unit files (e.g. limits) and they are totally ignored when I restart apache via webmin . this is not good at all (I assume it uses apachectl?). It would be desirable to have configurable behavior here

Discussion

  • kurczaq

    kurczaq - 2014-12-11

    would be a good idea to be able to map systemd units to webmin restart mechanisms... when webmin restarts apache it also says that apache2.service is not running in systemd :(

     
  • Jamie Cameron

    Jamie Cameron - 2014-12-12

    Which Linux distribution and version are you running there? The issue may be that Webmin's default config for the command to restart Apache isn't up to date.

    Also, can you post the /etc/webmin/apache/config file from your system?

     
  • kurczaq

    kurczaq - 2014-12-12

    it is running on SuSE 12.3.
    I do not see any option in the apache module to force using the systemd? I think it silently uses apachectl...

    Apache is self-compiled (so it is in a non-standard directory but can this be an issue?)

    www2:~ # cat /etc/webmin/apache/config
    virt_name=
    defines_mods=
    link_dir=
    test_manual=1
    show_list=0
    access_conf=
    mime_types=
    auto_mods=1
    stop_cmd=
    virt_file=/usr/local/apache/conf/vhost/vhost.conf
    srm_conf=
    pid_file=
    test_apachectl=1
    max_servers=100
    httpd_dir=/usr/local/apache
    start_cmd=
    show_order=1
    graceful_cmd=
    test_always=0
    httpd_conf=
    defines_file=
    apachectl_path=/usr/local/apache/bin/apachectl
    show_names=0
    httpd_version=
    test_config=1
    apply_cmd=
    httpd_path=/usr/local/apache/bin/httpd
    allow_virtualmin=0
    apache_docbase=
    defines_name=APACHE_SERVER_FLAGS

     
  • kurczaq

    kurczaq - 2014-12-12

    I see in principle there is start_cmd= but it is not editable via apache mod? Or just do not find it?

     
  • kurczaq

    kurczaq - 2014-12-12

    I would expect the settings either under "default server" or "global configuration" but there is nothing.
    In fact there is some limit control under "default server" but it does not cover full setrlimit() caps, just cpu time, memory size, #proc - not enough for production env. Usually you would set it via the unit file of systemd (or with sysv likely via /etc/security/limits.conf or so).

     
  • Jamie Cameron

    Jamie Cameron - 2014-12-12

    You should be able to click on the Module Config link in the Apache module, and set the start command to something like "service httpd stop"

    At which release did SuSE switch to systemd though?

     
  • kurczaq

    kurczaq - 2014-12-12

    ah thanks man! yeah I Overlooked the mod config link on the top!
    Suse switched in 12.0 I think (as option to sysv) however recently systemd is default (but sysv is still installable instead of systemd).

     
  • kurczaq

    kurczaq - 2014-12-12

    My point is just this: there should be a way to set resource limits on all services used/started in webmin. In the apache module you have few options to click (but not the full spectrum of setrlimit()) - but this only applies when started via apachectl.
    On systems with systemd apachectl should not by used anyway because they will ship with apache(2).service unit for systemd, or admin will write one to integrate apache into systemd (if you compile yourself).
    Personally I do not like systemd because it broke with some principles, however this is how it goes today - new stuff appears.
    The classical way to set limits was /etc/security/limits.conf and was supposed to be used when PAM is in action (to suXXXX to the user). Some apps disregarded it (I think apache even), other did not (safe_mysql, startproc?), so there is lot of confusion on this issue (rlimits) now.

    So what about adding some general control over limits into the systemd module (bootup&shutdown) - at the moment it just allows you to textually edit the unit file - it would be more sexy to have all the rlimit option offered by systemd as editable webmin fields like LimitNPROC=... LimitSTACK=... (offer fields for soft & hard limits) - that would be really COOL! (so our poor admins' brains do not need to remember all these systemd options). That way we would have a nice feature to limit all services present on the system!

    (particularily the systemctl --system daemon-reload stuff is a totally stupid feature...)

     

    Last edit: kurczaq 2014-12-12
  • Jamie Cameron

    Jamie Cameron - 2014-12-12

    Thanks, that's a good suggestion.

    What is the Apache systemd unit called on SuSE 12 though? The old init script was called "apache2", but has the same name been kept for the migration to systemd?

     
  • kurczaq

    kurczaq - 2014-12-12

    I have another SuSE 13.1 here, with apache2 installed from rpm (so all default install):

    cat /usr/lib/systemd/system/apache2.service

    [Unit]
    Description=The Apache Webserver
    Wants=network.target nss-lookup.target
    After=network.target nss-lookup.target
    Before=getty@tty1.service

    [Service]
    Type=notify
    PrivateTmp=true
    EnvironmentFile=/etc/sysconfig/apache2
    ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND -k start
    ExecReload=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND -k graceful
    ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND -k graceful-stop

    [Install]
    WantedBy=multi-user.target

     
  • kurczaq

    kurczaq - 2014-12-12

    I'm not sure but probably when you decide to install apache 1.3 they will call the unit apache.service (no "2").

     
  • kurczaq

    kurczaq - 2014-12-12

    it works now when I manually specify to use "systemctl start apache2.service" in apache mod config (however would be better I guess to autodetect that?)

     
  • kurczaq

    kurczaq - 2014-12-12

    weird stuff for mysql.service too: there is no unit file for that, only /etc/init.d/mysql sysv script, however it appears as managed by systemd (and is restartable via systemctl).

     
  • kurczaq

    kurczaq - 2014-12-12

    yeah ok got it, mysql is not a native systemd service on suse, bad bad.

     systemctl status mysql.service
    mysql.service - LSB: Start the MySQL database server
              Loaded: loaded (/etc/init.d/mysql)
              Active: active (running) since Fri, 2014-12-12 19:04:56 CET; 14min ago
             Process: 28437 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
             Process: 28507 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
              CGroup: name=systemd:/system/mysql.service
                       28589 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --user=mysql --pid-file=/var/run/mysql/mysqld.pid --socket=/home/vhost/WWW/var/run/mysql/mysql.sock --datadir=/var/lib/mys...
                       28975 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/my...
    
     
  • kurczaq

    kurczaq - 2014-12-12

    webmin shows then the /etc/init.d/mysql file in systemd module as unit file. Ok the error here is on Suse's side.

     
  • Jamie Cameron

    Jamie Cameron - 2014-12-13

    I think what I'll do is change the default start/stop/restart commands for Apache on SuSE to "service apache2 start" and so on.

     

Log in to post a comment.

MongoDB Logo MongoDB