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!?)

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.

1
  • 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 '19 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.