How to restart network services (runit)?

Forum Forums Official Releases antiX-21/22 “Grup Yorum” How to restart network services (runit)?

  • This topic has 14 replies, 7 voices, and was last updated Apr 26-6:01 pm by techore.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #105380
    Member
    techore

      How do I restart the network stack under runit without reboot?

      Not seeing an /etc/init.d/network or equivalent but I may just be tired.

      Thank you.

      #105385
      Member
      Robin
        Helpful
        Up
        0
        ::
        sudo sv status connman
        sudo sv stop connman
        sudo sv start connman
        sudo sv restart connman

        The folders to look into are found in /etc/service/…

        Further reading about managing runit services from command line: http://smarden.org/runit/faq.html#control

        Windows is like a submarine. Open a window and serious problems will start.

        #105387
        Member
        techore
          Helpful
          Up
          0
          ::

          @Robin, excellent answer but I failed to provide details. Thank you.

          At boot, interfaces are brought up as defined in /etc/network/interfaces that are not managed, e.g. blacklisted, by connman. How do those get reset without a reboot?

          #105388
          Member
          Robin
            Helpful
            Up
            1
            ::

            Maybe you need to look into the subfolders within

            /etc/runit/runsvdir

            This should be the place where runit runlevel structure can be found which is followed at system startup. You’ll find some scripts in them, obviously representing the services to be started when a specific runlevel is entered.

            To switch to another runlevel there is a command

            runsvchdir

            I have not tested all this by now, so I can’t give you any details. Maybe somebody else?

            Further reading about runit runlevels: http://smarden.org/runit/runlevels.html

            Windows is like a submarine. Open a window and serious problems will start.

            #105389
            Member
            olsztyn
              Helpful
              Up
              0
              ::

              I think the question @techore articulated is very interesting. To me there should be an established process to restart network stack without rebooting. This is Linux after all and stacks like this should not need the entire system rebooted to be restarted.
              Thanks @techore for raising attention to such question…

              Live antiX Boot Options (Previously posted by Xecure):
              https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

              #105390
              Member
              techore
                Helpful
                Up
                0
                ::

                Maybe you need to look into the subfolders within /etc/runit/runsvdir

                @Robin, I will dig into the runit service scripts and see what I can find. Thank you for sharing runsvdir command. I either forgot or never knew.

                This is Linux after all and stacks like this should not need the entire system rebooted to be restarted.

                @olsztyn, agreed, but this is probably a matter of my own ignorance-I have only been using antiX for eighteen months. I suspect there is a command or script to reset the entire network stack that uses both /etc/network/interfaces and connman’s service unit. ‘ifup’ and ‘ifdown’ work for the immediate need to manage bridge0.

                Thank you both. If I find a solution, I will share.

                #105395
                Member
                Xunzi_23
                  Helpful
                  Up
                  0
                  ::

                  Hi Techore,
                  Maybe useful
                  using the runit service manager in the antiX 23 Beta you can stop and restart conmann.
                  /etc/runit
                  The conmann runit service files are in /etc/runit/runsvdir/current/connman

                  • This reply was modified 2 weeks ago by Xunzi_23.
                  #105397
                  Moderator
                  caprea
                    Helpful
                    Up
                    0
                    ::

                    Maybe I’m wrong but if you use the /etc/network/interfaces file for your connection then ceni is used.
                    Ceni isn’t a service. It just works when it is configured,uses less resources, cant get restartet as a service like connman.

                    #105418
                    Member
                    techore
                      Helpful
                      Up
                      0
                      ::

                      Hi Techore,
                      Maybe useful
                      using the runit service manager in the antiX 23 Beta you can stop and restart conmann.
                      /etc/runit
                      The conmann runit service files are in /etc/runit/runsvdir/current/connman

                      The runit service manager is very nice. anticapitalista (?), did a great job on it.

                      I spend most of my time on the cli and use ‘sv’, but I do use the runit-service-manager from time to time.

                      #105420
                      Member
                      techore
                        Helpful
                        Up
                        0
                        ::

                        Maybe I’m wrong but if you use the /etc/network/interfaces file for your connection then ceni is used.
                        Ceni isn’t a service. It just works when it is configured,uses less resources, cant get restartet as a service like connman.

                        You are correct that ceni uses /etc/network/interfaces on antiX but it doesn’t support bridges. As I recollect, /etc/network/interfaces predates systemd so it is not new nor ceni specific. The only reason the antix-dwm spin has connman is ceni wireless scans take a very long time, otherwise, I would use ceni over connman. They both have their pros/cons.

                        Lunch! Time to dig into antiX 22 runit init files.

                        #105452
                        Member
                        abc-nix
                          Helpful
                          Up
                          1
                          ::

                          Hi.

                          I am curious of what you are trying to achieve. Is this the same as restarting the networking service in sysVinit-based systems?
                          In antix runit I could only find this service in the antix-core folder. And it seems to be referenced in the antix-wifi-switch script also.

                          Would this work under runit?
                          sudo /etc/runit-core/S14networking restart

                          #105464
                          Forum Admin
                          anticapitalista
                            Helpful
                            Up
                            2
                            ::

                            If using ceni or dhclient and not connmann, there are no runit services.

                            Try ifup eg

                            ifup eth0

                            Philosophers have interpreted the world in many ways; the point is to change it.

                            antiX with runit - leaner and meaner.

                            #105477
                            Member
                            techore
                              Helpful
                              Up
                              0
                              ::

                              If using ceni or dhclient and not connmann, there are no runit services.

                              Thank you for stating there isn’t runit service to manage non-connman interfaces. I wasn’t seeing one but.. thank you.

                              I’ve been using ifup, ifdown, and ifstatus without issue. I think that I will write a wrapper to reset both connman managed and unmanaged interfaces.

                              #105478
                              Member
                              techore
                                Helpful
                                Up
                                0
                                ::

                                Would this work under runit? ‘sudo /etc/runit-core/S14networking restart’

                                Looks promising! It does restart the bridge interface and triggers dhcp. Nice!

                                #105479
                                Member
                                techore
                                  Helpful
                                  Up
                                  0
                                  ::

                                  @abc-nix, /hugs.

                                  I’ll need to test this further but it is working thus far.

                                  > cat /usr/local/bin/netrestart
                                  #!/usr/bin/env bash
                                  # Project: antix-dwm
                                  # Location: /usr/local/bin/netrestart.sh
                                  # Dependencies: connman
                                  # Description: Simple script to reset network interfaces using
                                  # connman and /etc/runit-core/S14networking. Symlink for convenience.
                                  #   ln -s /usr/local/bin/netrestart /etc/init.d/networking 
                                  # Usage: sudo /etc/init.d/networking
                                  
                                  printf "\n========>  Restarting connman runit service\n\n"
                                  sv restart connman
                                  
                                  printf "\n========>  Restarting /etc/runit-core/S14networking\n\n"
                                  /etc/runit-core/S14networking restart

                                  Results:

                                  ========>  Restarting connman runit service
                                  
                                  ok: run: connman: (pid 52441) 0s
                                  
                                  ========>  Restarting /etc/runit-core/S14networking
                                  
                                  Running /etc/runit-core/S14networking restart is deprecated because it may not re-enable some interfaces ... (warning).
                                  Reconfiguring network interfaces...Killed old client process
                                  Internet Systems Consortium DHCP Client 4.4.1
                                  Copyright 2004-2018 Internet Systems Consortium.
                                  All rights reserved.
                                  For info, please visit https://www.isc.org/software/dhcp/
                                  
                                  Listening on LPF/bridge0/9e:86:de:ae:3f:7b
                                  Sending on   LPF/bridge0/9e:86:de:ae:3f:7b
                                  Sending on   Socket/fallback
                                  DHCPRELEASE of 192.168.34.108 on bridge0 to 192.168.34.2 port 67
                                  Internet Systems Consortium DHCP Client 4.4.1
                                  Copyright 2004-2018 Internet Systems Consortium.
                                  All rights reserved.
                                  For info, please visit https://www.isc.org/software/dhcp/
                                  
                                  Listening on LPF/bridge0/9e:86:de:ae:3f:7b
                                  Sending on   LPF/bridge0/9e:86:de:ae:3f:7b
                                  Sending on   Socket/fallback
                                  DHCPDISCOVER on bridge0 to 255.255.255.255 port 67 interval 7
                                  DHCPOFFER of 192.168.34.108 from 192.168.34.2
                                  DHCPREQUEST for 192.168.34.108 on bridge0 to 255.255.255.255 port 67
                                  DHCPACK of 192.168.34.108 from 192.168.34.2
                                  bound to 192.168.34.108 -- renewal in 1584 seconds.
                                  done.

                                  Thank you all!

                                Viewing 15 posts - 1 through 15 (of 15 total)
                                • You must be logged in to reply to this topic.