Proposal: altered antix-Updater to deal better with running apt instances

Forum Forums antiX-development Development Proposal: altered antix-Updater to deal better with running apt instances

  • This topic has 18 replies, 5 voices, and was last updated Mar 25-1:19 pm by Brian Masinick.
Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #135267
    Member
    PPC

      On a recent video about antix 23.1 I noticed that antiX-updater refused to run, saying that apt was already running. That happened once on Marcelo’s video. I only seen that happen to me twice in all the time I’ve been using it, but I think that false negative can be dealt with, and, in the same move, allow users to close any previously running instance of apt…
      Now the window warns user that apt is already running (only when the script suspects apt is running, of course). when the user clicks OK on that window, the script just runs “sudo pkill apt”, forcing any other existing instance of apt to close and then continues to check for updates. The rest of the script remains unchanged.

      Please test. If it works for everyone, I’ll propose that anticapitalista updates the package that includes this script (and also the new string has to be put of for localization, in transifex)

      • This topic was modified 1 month, 1 week ago by PPC.
      #135292
      Member
      Robin

        @PPC I guess it’s not the very best idea to kill a running apt instance. You may easily corrupt the apt database this way, or end up with a corrupted or incomplete installation of one or more packages, in case apt is doing some lengthy postinstall or cleanup stuff still. Then you will have to explain users how to deal with that, when apt throws errors one after the other then, refusing to install anything or complaining about incomplete installs to be fixed now.
        When running a sudo apt-get update I have seen apt literally doing seemingly nothing for a while, after the download of database updates was reported to be ready, pondering more than a full minute or even two or three about the new results of the download, before starting to incorporate them slowly, one percent after the other, into its database, taking another 5 minutes. Guess what happens if you kill apt in this pondering- or merging phase… Or what happens, if you kill it while it is doing some postinstall tasks still which take some more time? Never kill a running apt that way! Ask user instead to check what apt is doing right now somewhere else for him. He should know what he did right before and why apt is running on his device. You simply can’t expect user won’t start the antiX updater (or this happens cronjobbed) while apt is still completing something somewhere else.

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

        #135306
        Member
        PPC

          @Robin – I did not really mean to kill apt… My problem is that for some reason, the script claims that apt is running, when in fact it’s not. The only other work-around I can see is displaying the warning (the old warning, or an adapted one) and… continue with the script- I think that the result is that the apt the script tries to run just gives off the message that apt is busy and waits until it can run… if no real apt instance is running, antiX-updater instantly does it’s thing…
          Many thanks for the feedback!

          I attached the revised version of the script…

          P.

          • This reply was modified 1 month, 1 week ago by PPC.
          #135313
          Member
          Robin

            I did not really mean to kill apt…

            Well, you did 🙂

            the script claims that apt is running, when in fact it’s not.

            If an apt process is actually not existing, a kill command can’t help that either then.

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

            #135337
            Member
            PPC

              I think I found the ideal routine to make the script wait and keep warning the user that apt is running. Now all I need is some poor souls to test this and see if there are any false positives (i.e.- the script complains that apt is running when, if fact it’s not)…

              P.

              #135361
              Forum Admin
              rokytnji

                After I run sudo apt update. That warning goes away.

                That is how I handle my false positives.

                Sometimes I drive a crooked road to get my mind straight.
                I don't suffer from insanity. I enjoy every minute off it.
                Motorcycle racing is rocket science.

                Linux Registered User # 475019
                How to Search for AntiX solutions to your problems

                #135408
                Member
                PPC

                  @rokytnji – I also do exactly the same… but antiX-Updater was created so even folks that can’t (or refuse to) use the terminal can keep antiX updated.
                  One possible suggestion for an alternative GUI would be what Skidoo suggested, when I developing that script: just update from Synaptic!

                  P.

                  #135412
                  Member
                  sybok

                    @PPC:
                    I tried to run the updater twice from two different consoles with a minimal delay (switching from the 1st console to the 2nd one and hitting enter to execute the command I did type in advance).
                    It triggered an error message (variable ‘apt_error_message’) in the script which states

                    … (Please note that you can only run one instance of $title at a time)

                    when I was obviously able to run *two* of them with the latter started one producing the error message.

                    I suggest to replace ‘can only run one’ by ‘should run at most one’ or something along the way because I find the text saying something contradicting my above described experience.
                    If the text should be left as it is, then a check whether the updater is already running should be performed to ensure that one cannot run two at the same time.

                    #135415
                    Member
                    PPC

                      If the text should be left as it is, then a check whether the updater is already running should be performed to ensure that one cannot run two at the same time.

                      Thanks! Perfect solution. I’ve been implementing that, when I can, on system related apps, but forgot about that on this script! I’ll try adding that as soon as I can.
                      Did you notice any “false positives”?

                      P.

                      #135421
                      Member
                      sybok

                        @PPC: I did not notice false positives, I only tested for cases when another ‘apt’ or another instance of the updater was running.

                        #135456
                        Member
                        PPC

                          Ok, I added a check: if the window is already open, don’t run antiX-Updater…
                          But I added even a little extra: if the script is run with the -r flag, it does not check for updates, but rather runs a function that if there’s internet and the user has not checked for updates in the last X days (by default 2) then, once a day, it pops a “notification” window, reminding users that they should check for updates. Users can close the “notification” or run the main part of antiX-Updater and check for updates and install them, if they are available.

                          This is a fusion of my “update reminder” idea, included in FT10, with the default antiX-Updater script.
                          The idea is that if users want to be warned to check for updates one in a while, they can add “antiX-Updater -r” to the start up file and no longer have to worry if they checked for updates recently… (note that the name of this test script is NOT the default name for the script!)

                          To do:
                          A possible evolution of the script is including 2 flags, ex: -r 8 to set the number of days the script should wait before reminding users to check for updates… but I’m tired! 🙁

                          Please, do test the script, both run as usual and with the -r flag and report back… If this works I would like to see it replace the default antiX-updater script, partly solving the lack of automatic updates (well, not solving, rather finding a work around that apparent problem).

                          P.

                          • This reply was modified 1 month, 1 week ago by PPC.
                          • This reply was modified 1 month, 1 week ago by PPC.
                          #136652
                          Moderator
                          Brian Masinick

                            Here is a classic Bash shell way to solve the same problem:

                            Set up a couple of alias commands; these work GREAT for me!

                            alias u=’sudo apt-get update; sudo apt-get dist-upgrade; sudo update-grub;sudo apt-get autoremove’
                            alias ug=’sudo apt-get update; sudo apt-get dist-upgrade’
                            alias ugb=’sudo apt-get update; sudo apt-get dist-upgrade; sudo update-grub’
                            alias ur=’sudo apt-get autoremove’

                            NOTICE: for me, typing in u and pressing the Enter key in a simple command terminal is sufficient to update my entire system!
                            Easy as can be when you create the correct alias command!

                            --
                            Brian Masinick

                            #136653
                            Moderator
                            Brian Masinick

                              Also
                              alias inst=’sudo apt-get update; sudo apt-get install $@’
                              is very convenient.

                              Suppose I decide to install mg, a very fast, small text editor.
                              Easy:

                              With my alias, I type inst mg and press Enter.
                              First it updates my apt cache, which enables me access to current software;
                              then it installs whatever I specify; $@ allows me to add multiple packages or just one,
                              depending on what I want to do.

                              Commands are not difficult when you look them up, and they are EASIER
                              when you create alias definitions, such as the ones I created.

                              HOWEVER, for those of you who su to root, anticapitalista has ALSO
                              created a number of equally useful package alias commands. To me,
                              either his or mine are just as fast, arguably FASTER to use than the admittedly
                              easy yad or other scripted tools. Ultimately they all do exactly the same thing!

                              --
                              Brian Masinick

                              #136654
                              Moderator
                              Brian Masinick

                                By the way @PPC, I am only presenting other simple, fast ways to do things;
                                your stuff is AWESOME too!

                                --
                                Brian Masinick

                                #136667
                                Member
                                Robin

                                  Set up a couple of alias commands

                                  Reminds me of the old MS-DOS days… There we always have set up aliases like you describe, to make often used things handy.

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

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