Host of issues stemming from too many symlink levels errors












0















On an AWS EC2 instance, I was upgrading imagemagick. Current installation was 6.8.x which is vulnerable, and I was moving it to 6.9.10-12 which if I read properly, I think it's patched.



Somewhere during the process, I stumbled upon the following error when executing a sudo command:



-bash sudo: Too many levels of symbolic links [paraphrased]



This was when trying to add a new link onto /usr/bin/.



So I had a look inside to see if there was something funky in there... and I found a bin folder inside /usr/bin/ that was linked to /usr/bin//



During that time, I temporarily lost internet access, which was regained rather quickly, so I re-start my ssh connection to the ec2 instance and lo and behold....



$ sudo
The program 'sudo' can be found in the following packages:
* sudo
* sudo-ldap
Try: sudo apt install <selected package>


So... now my user lost access to sudo as well... any sort of command to fix any links inside /usr/bin will need sudo access... installing sudo needs sudo access... going su - to switch to root, seems to also need sudo access because it otherwise asks me for password for root, and aws does not give you that when launching an instance...



Would the steps detailed on this answer be my only way to fix this now? (If this can be fixed at all!?)










share|improve this question





























    0















    On an AWS EC2 instance, I was upgrading imagemagick. Current installation was 6.8.x which is vulnerable, and I was moving it to 6.9.10-12 which if I read properly, I think it's patched.



    Somewhere during the process, I stumbled upon the following error when executing a sudo command:



    -bash sudo: Too many levels of symbolic links [paraphrased]



    This was when trying to add a new link onto /usr/bin/.



    So I had a look inside to see if there was something funky in there... and I found a bin folder inside /usr/bin/ that was linked to /usr/bin//



    During that time, I temporarily lost internet access, which was regained rather quickly, so I re-start my ssh connection to the ec2 instance and lo and behold....



    $ sudo
    The program 'sudo' can be found in the following packages:
    * sudo
    * sudo-ldap
    Try: sudo apt install <selected package>


    So... now my user lost access to sudo as well... any sort of command to fix any links inside /usr/bin will need sudo access... installing sudo needs sudo access... going su - to switch to root, seems to also need sudo access because it otherwise asks me for password for root, and aws does not give you that when launching an instance...



    Would the steps detailed on this answer be my only way to fix this now? (If this can be fixed at all!?)










    share|improve this question



























      0












      0








      0








      On an AWS EC2 instance, I was upgrading imagemagick. Current installation was 6.8.x which is vulnerable, and I was moving it to 6.9.10-12 which if I read properly, I think it's patched.



      Somewhere during the process, I stumbled upon the following error when executing a sudo command:



      -bash sudo: Too many levels of symbolic links [paraphrased]



      This was when trying to add a new link onto /usr/bin/.



      So I had a look inside to see if there was something funky in there... and I found a bin folder inside /usr/bin/ that was linked to /usr/bin//



      During that time, I temporarily lost internet access, which was regained rather quickly, so I re-start my ssh connection to the ec2 instance and lo and behold....



      $ sudo
      The program 'sudo' can be found in the following packages:
      * sudo
      * sudo-ldap
      Try: sudo apt install <selected package>


      So... now my user lost access to sudo as well... any sort of command to fix any links inside /usr/bin will need sudo access... installing sudo needs sudo access... going su - to switch to root, seems to also need sudo access because it otherwise asks me for password for root, and aws does not give you that when launching an instance...



      Would the steps detailed on this answer be my only way to fix this now? (If this can be fixed at all!?)










      share|improve this question
















      On an AWS EC2 instance, I was upgrading imagemagick. Current installation was 6.8.x which is vulnerable, and I was moving it to 6.9.10-12 which if I read properly, I think it's patched.



      Somewhere during the process, I stumbled upon the following error when executing a sudo command:



      -bash sudo: Too many levels of symbolic links [paraphrased]



      This was when trying to add a new link onto /usr/bin/.



      So I had a look inside to see if there was something funky in there... and I found a bin folder inside /usr/bin/ that was linked to /usr/bin//



      During that time, I temporarily lost internet access, which was regained rather quickly, so I re-start my ssh connection to the ec2 instance and lo and behold....



      $ sudo
      The program 'sudo' can be found in the following packages:
      * sudo
      * sudo-ldap
      Try: sudo apt install <selected package>


      So... now my user lost access to sudo as well... any sort of command to fix any links inside /usr/bin will need sudo access... installing sudo needs sudo access... going su - to switch to root, seems to also need sudo access because it otherwise asks me for password for root, and aws does not give you that when launching an instance...



      Would the steps detailed on this answer be my only way to fix this now? (If this can be fixed at all!?)







      ubuntu symlink amazon-ec2 aws






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 13 at 21:05









      Rui F Ribeiro

      39.5k1479133




      39.5k1479133










      asked Oct 15 '18 at 19:40









      EffectiXEffectiX

      1031




      1031






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Yes, you screwed up by creating a cyclic link. You did this in /usr/bin, which is why you can't execute commands any longer.



          Yes, the easiest way is to access the screwed-up file system from the outside, as described in the answer you linked, and fix the cyclic link.






          share|improve this answer
























          • Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

            – EffectiX
            Jan 14 at 17:06











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475648%2fhost-of-issues-stemming-from-too-many-symlink-levels-errors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Yes, you screwed up by creating a cyclic link. You did this in /usr/bin, which is why you can't execute commands any longer.



          Yes, the easiest way is to access the screwed-up file system from the outside, as described in the answer you linked, and fix the cyclic link.






          share|improve this answer
























          • Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

            – EffectiX
            Jan 14 at 17:06
















          0














          Yes, you screwed up by creating a cyclic link. You did this in /usr/bin, which is why you can't execute commands any longer.



          Yes, the easiest way is to access the screwed-up file system from the outside, as described in the answer you linked, and fix the cyclic link.






          share|improve this answer
























          • Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

            – EffectiX
            Jan 14 at 17:06














          0












          0








          0







          Yes, you screwed up by creating a cyclic link. You did this in /usr/bin, which is why you can't execute commands any longer.



          Yes, the easiest way is to access the screwed-up file system from the outside, as described in the answer you linked, and fix the cyclic link.






          share|improve this answer













          Yes, you screwed up by creating a cyclic link. You did this in /usr/bin, which is why you can't execute commands any longer.



          Yes, the easiest way is to access the screwed-up file system from the outside, as described in the answer you linked, and fix the cyclic link.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 16 '18 at 6:52









          dirktdirkt

          16.8k21336




          16.8k21336













          • Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

            – EffectiX
            Jan 14 at 17:06



















          • Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

            – EffectiX
            Jan 14 at 17:06

















          Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

          – EffectiX
          Jan 14 at 17:06





          Updating: Got it fixed. To think that all this coming from following install instructions on imagemagick... Thanks for confirming the procedure dirkt.

          – EffectiX
          Jan 14 at 17:06


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475648%2fhost-of-issues-stemming-from-too-many-symlink-levels-errors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?