[Testers needed] antiX wifi switcher (bash script)

Forum Forums antiX-development Development [Testers needed] antiX wifi switcher (bash script)

  • This topic has 24 replies, 8 voices, and was last updated Sep 17-12:55 pm by Xecure.
Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #41421
    Member
    Xecure

      Preface:
      With the inclusion of connman in antiX 19, many users have reported problems activating wifi and switching between connman and ceni. For most cases, we recommended removing connman and replacing the /etc/resolv.conf symbolic link. For the ones that really wanted to use connman but hat already used ceni beforehand, they found that connman didn’t work because of the wlan instructions in /etc/network/interfaces created by ceni.
      These problems and the proposed solutions were not new-user friendly. For this reason, I created this script.

      antix-wifi-switch (placeholder name) is a simple script with one purpose: ease the activation and transition from one network manager to the other in antiX 19.
      No need for unblocking Wi-Fi. The script will unlock wifi if it is being soft blocked.
      No manual file editing with root privileges. The script will replace the resolv.conf symlink and ask for permissions to clear the /etc/network/interface file.
      No uninstall/purge of packages needed. Ceni and connman can both be installed, and the user can decide when they want to switch.

      It has a simple gui interface (yad based) but can also work on terminal (for cases where Xorg is not running). It should work on any antiX 19 flavor (core, base and full). It ever will work for people who prefer using connmanctl.

      Usage: antix-wifi-switch [<options>] [ceni|connman]
      
      Switch between ceni and connman easily. Can be launched in terminal
      or gui mode. You can also specify the program directly to reduce steps.
      
      	   ceni:  will automatically switch to ceni to manage your network
      	connman:  will remove all ceni configurations and launch connman
      	
      Options:
      	-c --cli	Launches in terminal mode
      	-g --gui	Launches a yad gui (requires yad to be installed)
      	-h --help	Show this usage
      	-v --version	Show version information
      
      Notes:
      	- For now only connman and ceni are configured. Specially built for
      	antiX 19. Should work for any antiX flavor (core, base or full)

      I think this script is interesting enough to be included in the antix-goodies package (and placed in the control centre) for the next antiX release, under a name like “Wifi setup” or something better. For that to happen, it needs to be tested a lot before it is ready.

      Tester recommendations:
      Anyone interested in helping can download the antix-wifi-switch file (from gitlab) and, when they have the free time, test it on a system with antiX 19 and Wi-Fi.
      It is highly recommended to use a live system or a “disposable” installation, as the script can break your network configuration (if a bug hasn’t been caught).
      I have only tested on live systems and found many errors that really broke important files. Most of them should have been solved, but I cannot guarantee that this will not happen to you.

      Any bug report, interface changes or other suggestions are welcome.

      Thanks for your time.

      Gitlab site (for those interested): https://gitlab.com/nXecure/antix-wifi-switch
      [Ignore the attachment. It is an old version.]

      • This topic was modified 2 years, 8 months ago by Xecure. Reason: Reworking the post
      • This topic was modified 2 years, 8 months ago by Xecure. Reason: Adding download link

      antiX Live system enthusiast.
      General Live Boot Parameters for antiX.

      #41441
      Moderator
      caprea
        Helpful
        Up
        0
        ::

        Thanks Xecure, an easy switcher is probably a good idea.

        First quick results, I started with antiX-full, installed to harddrive and connman as my wifi-manager.
        Opened wifi-switcher and changed to ceni. Everything went well, the /etc/resolc.conf file was now linked to /etc/resolvconf/run/resolv.conf. I could use ceni and make my settings there and immediately was connected.
        After a reboot however unfortunately, the /etc/resolv.conf file was linked again to /run/connman/resolv.conf.
        I couldn’t connect. Good news: I could switch back to connman with your wifi-switcher without problems then.

        Again, thanks for your commitment.

        #41442
        Member
        Xecure
          Helpful
          Up
          0
          ::

          Thanks for testing it. I will figure out what is managing the creation of the symlink and update the script.

          Edit: Thanks to caprea, I have fixed the issue. Now it should be possible to make the switch to connman/ceni reboot persistent.
          Thanks again.

          • This reply was modified 2 years, 8 months ago by Xecure.

          antiX Live system enthusiast.
          General Live Boot Parameters for antiX.

          #41449
          Moderator
          caprea
            Helpful
            Up
            0
            ::

            Yes, it’s working fine now here. This is a very useful thing for antiX and will make the start with antiX easier for many users who have problems with their internet connection right from the start. Great. Thanks Xecure.

            #41458
            Forum Admin
            anticapitalista
              Helpful
              Up
              0
              ::

              Hopefully I’ll have some time tomorrow to give this a run. Seems like an excellent addition.
              We should probably make sure it is fully localized and provide a .desktop file so it appears in the menus.

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

              antiX with runit - leaner and meaner.

              #41463
              Member
              Xecure
                Helpful
                Up
                0
                ::

                Thanks for the feedback, caprea.

                Hopefully I’ll have some time tomorrow to give this a run.

                When ever you and anyone else has time to test is a good time.
                I think most (if not all) the messages are prepared for a .pot gettext export, so once we know it work for all testers I will prepare all files that you ask me to prepare.

                antiX Live system enthusiast.
                General Live Boot Parameters for antiX.

                #41578
                Forum Admin
                SamK
                  Helpful
                  Up
                  0
                  ::

                  @Xecure
                  Your idea is welcome and should prove useful.

                  It was on my radar to do what you are doing with this script. I have so little available time at present I have not been able to get around to it, so it was just another item in the queue. Not sure when I will have spare capacity to help testing.

                  #41609
                  Member
                  bci
                    Helpful
                    Up
                    0
                    ::

                    I tried the script, it’s great – but ceni makes me have to resize the terminal window till it’s absurdly enormous for my rather small laptop screen. I can function, but it’s a bit inconvenient. Don’t know if this is a detail with the script, or with how stuff is configured on my box. I’m using sakura for a terminal emulator

                    Some excerpts from my inxi -F:

                    System:
                    Host: antix1 Kernel: 4.9.212-antix.1-amd64-smp x86_64 bits: 64
                    Desktop: IceWM 1.8.1
                    Distro: antiX-19.1_x64-full Marielle Franco 23 December 2019
                    Machine:
                    Type: Laptop System: LENOVO product: 42983SU v: ThinkPad X220 Tablet
                    serial: <root required>
                    Mobo: LENOVO model: 42983SU serial: <root required> UEFI [Legacy]: LENOVO
                    v: 8DET58WW (1.28 ) date: 02/14/2012

                    Graphics:
                    Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics
                    driver: i915 v: kernel
                    Display: x11 server: X.Org 1.20.4 driver: modesetting unloaded: fbdev,vesa
                    resolution: 1366×768~60Hz
                    OpenGL: renderer: Mesa DRI Intel Sandybridge Mobile v: 3.3 Mesa 18.3.6

                    #41610
                    Forum Admin
                    Dave
                      Helpful
                      Up
                      0
                      ::

                      Have not tested this script, but I am glad to see one being made!
                      For me it is the same situation as SamK really.
                      Some helpful suggestions after a quick glance at the github page.
                      – checks a such if [[ "$SWITCH_NM" != "" ]]; then may be better to use the test function -n or !-z (a test list: https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html)
                      – In the check installed function you might consider using a case statement to make it easier to add other network management tools if wanted in the future. (wicd/network-manager/etc)
                      – Along with the warning about a missing resolv.conf… add a link to the one that will work for the chosen setup with a message that this was done and how to remove.
                      – Along with the echo messages, consider making the calls functions to echo (example error “this is the error”) so you can use logging as well (very helpful in troubleshooting if run from the control centre without terminal). Example:

                      log_file="$HOME/.wifi-switcher.log"
                      function error {
                          echo "ERROR: $@" |tee -a $log_file
                      }
                      function warn {
                          echo "WARNING: $@"
                      }

                      – I have not tested but from reading it seems if the wifi is soft blocked and you are switching to ceni with the default antix setup (connman installed) it will try to kill and run connman to unblock the wifi before starting ceni

                      switch_to_ceni(){
                      	echo $"Switching to ceni"
                      	# 0. Enable Wifi
                      	enable_wifi && sleep 2
                      
                      enable_wifi(){
                      	# Check if wifi is locked and unlock if possible.
                      	if [ $(rfkill list wifi | grep -c "Soft blocked: yes" 2>/dev/null) -gt 0 ]; then
                      		echo $"Wi-Fi softblocked."
                      		# ask for sudo password
                      		# Use connmanctl (if installed) to enable wifi
                      		if [ -x /usr/bin/connmanctl ]; then
                      

                      perhaps consider adding switches to the function to bypass the test. Example (though probably not the best way):

                      function enable_wifi() {
                          case $1 in 
                              ceni) 
                                  use_connman=0;
                                  use_rfkill=1;;
                              connman)
                                  use_connman=1;
                                  use_rfkill=1;;
                              *)
                                  use_connman=0;
                                  use_rfkill=1;;
                          esac
                      }

                      – The hardblock check is probably better to be in the check_wifi function to avoid duplication
                      – The default PROGRAM_INTERFACE=”” declaration may be better set in the if DISPLAY test.
                      – Likewise and with the above point, maybe check for yad in the same if statement via ||
                      – Not 100% certain on the necessity of the export declarations, but IIRC they should be written like variable=item; export variable; rather than export variable=item;

                      • This reply was modified 2 years, 7 months ago by Dave.

                      Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                      #41646
                      Member
                      Xecure
                        Helpful
                        Up
                        0
                        ::

                        I’m using sakura for a terminal emulator

                        resolution: 1366×768~60Hz

                        It is probably your terminal emulator that uses big fonts. I developed the script in a laptop with this exact resolution (1366×768) and I never had to resize the terminal window (using default roxterm).

                        Thanks SamK and Dave. We can only use the time we have. Free time is more precious than money.I am lucky I can spend some nights and weekends on this.

                        Thanks, Dave for all the advice. I will apply the changes you propose when I have time tonight.

                        About

                        – I have not tested but from reading it seems if the wifi is soft blocked and you are switching to ceni with the default antix setup (connman installed) it will try to kill and run connman to unblock the wifi before starting ceni

                        Maybe it is my imagination, but using connman to unblock wifi seems faster than using “rfkill unblock wifi”. I will change it anyway.

                        Thanks for all the tips.

                        antiX Live system enthusiast.
                        General Live Boot Parameters for antiX.

                        #41652
                        Member
                        ex_Koo
                          Helpful
                          Up
                          0
                          ::

                          @Xecure

                          I reinstalled connman just to test your script.
                          Moved your script to /usr/local/bin/ just so I could run it from anywhere. Running from terminal the gui worked just fine started with connman entered wifi key worked 100% even rebooting wifi still work with connman.

                          Then switched to ceni entered key into ceni worked 100%. BUT on rebooting I have no internet with ceni, had to once again run ceni to enter the key again, to get internet working.

                          So I rebooted again still with ceni in control no internet again, then just ran your switcher and when back to connman let it edit the network interface and bingo internet was working 100% with connman with out entering the key again. So now connman works better for me then ceni.

                          I need to go to bed.

                          #41657
                          Member
                          Xecure
                            Helpful
                            Up
                            0
                            ::

                            Thanks for testing, Koo. Sorry for the problems with ceni after restarting. It worked for me on antiX 19.2 full 64bit (restarting after selecting ceni and it reconnected). I guess it could be related to some service that interrupts the networking service. In the past, some users reported that restarting this service (sudo service networking restart) had wifi configured with Ceni reconnect without any other input.

                            I hope that for now you can do with connman.
                            Thanks for the feedback.

                            antiX Live system enthusiast.
                            General Live Boot Parameters for antiX.

                            #41663
                            Forum Admin
                            anticapitalista
                              Helpful
                              Up
                              0
                              ::

                              Maybe it is due to running runit as the init?
                              When I get time I’ll try it on my antiX-19 runit setup.

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

                              antiX with runit - leaner and meaner.

                              #41694
                              Moderator
                              caprea
                                Helpful
                                Up
                                0
                                ::

                                To rule this out completely, @Koo, you did not perhaps download the wrong (first instead of second) zip-file ?

                                No problems with runit here, tested on a live-stick with persistence, 32 bit, base.

                                • This reply was modified 2 years, 7 months ago by caprea.
                                #41702
                                Moderator
                                Brian Masinick
                                  Helpful
                                  Up
                                  0
                                  ::

                                  To rule this out completely, @Koo, you did not perhaps download the wrong (first instead of second) zip-file ?

                                  No problems with runit here, tested on a live-stick with persistence, 32 bit, base.

                                  Same here: the other day I trashed a runit setup (semi intentionally) with an ugly mix of Stable, Testing, and Sid packages. I’d barely get into the window manager and it’d freeze up.

                                  So I simply reinstalled 19.2.1 runit over the mess and now it’s probably most niible setup – very close to my 19.2.1 antiX Base setup!
                                  No obvious problems anywhere. Good job!

                                  --
                                  Brian Masinick

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