1

I have a Digital Ocean droplet which I use as my development environment.

I deleted /bin directory !! via SSH. Now I know it was a stupid thing to do but it is the truth now. I am not great with UNIX/Linux systems but these are the things I tried as stupid as they may seem.

  1. I copied the bin folder from another Ubuntu logged in as root user (from AWS - Production server) I get Permission Denied whenever I run commands like ls

  2. I tried to change the kernel from Digital Ocean Control Panel and reboot. I don't know what it does but now the droplet isn't rebooting. On the Digital Ocean Console is see several errors like:

init: Failed to spawn XXXXX main process: unable to execute: Permission denied

I have backed up all necessary data from the server via SFTP. How do I fix the issue? Does destroying the droplet and creating the new one help?

I have raised a ticket to support but cannot wait for the response as I need it up and running for testing the new release. Here are a few details if it helps: I use it for PHP web development. Tools I run on the instance: Apache, MongoDB, MySQL, PHP5

1
  • 1
    Having the needed files in /bin is not enough. They also need the same permissions. If you copied then then these are probably all set to whatever your default it. Solutions: 1) search for chmod accidents here on SU. Same solution. 2) If you ever want to have a know stable system then reinstall of restore from backup.
    – Hennes
    Aug 12, 2016 at 13:56

3 Answers 3

3

This worked for me:

  1. Turn off the droplet from SSH or Digital Ocean Control Panel.
  2. Raise a support ticket to mount a Recovery ISO on your droplet.
  3. Restart your droplet instance (if not already on) and open console from your DO Control Panel. You should see a "Digital Ocean Recovery Environment" with several Options.
  4. Select Option 1. Then Option 2 and Option 4. (Basically Mount the Recovery ISO, Configure Networking and Enable SSH/SFTP.
  5. Locate /mnt directory and download your recovered files (if any) to your local machine.
  6. If just getting back your files was enough, ask support to unmount Recovery ISO and restart your droplet.
  7. If you deleted your /bin (like me) go ahead and Destroy your droplet and create another one and go through painful process of reinstalling LAMP stack and/or other tools you need.
  8. Make note to self and don't use root user ever again.
1

There are a few ways to fix this:

Firstly I'd recommend taking a snapshot of your droplet, this is free. If any of the steps you take from this point on break your droplet any further, you can then restore from this snapshot.

Creating a new Droplet and transferring your data would be the best and safest option.

Alternately, even though I wouldn't recommend, you could copy /bin from another droplet, using rsync to copy the permissions, if you have a snapshot or backup. If you do this with a new Droplet it is likely to cause problems because files may be of different version, or you may have installed extra applications.

-3

The best way to fix this, would be to insert the linux install disc and re-installing your linux OS as this is the only way to guarantee to fix your system and not have any future problems related to what you just did. If your linux install disc has the option to repair your system, you could do try doing that, but I recommend selecting the option to re-install the OS since you backed up the data you want saved. This is a prime example of what can happen when using the root user as the default user. If you were using a normal user with sudo privileges, you wouldn't have been able to delete the bin directory lol.

2
  • It is a remote server from Digital Ocean. I need to send Linux OS CD to their data centre?? LOL
    – enemetch
    Aug 12, 2016 at 16:44
  • @eNeMetcH Most datacenter's like Digital Ocean provide a Front-End control panel to facilitate of installing or re-installing OS's
    – Frostalf
    Aug 12, 2016 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .