The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Deleted the entire sbin folder

Discussion in 'General Discussion' started by server948, Aug 6, 2016.

  1. server948

    server948 Registered

    Joined:
    Aug 6, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    solaris
    cPanel Access Level:
    Root Administrator
    I accidentally deleted the entire sbin folder. Has been causing problems. Would like to get it back if possible. Otherwise maybe you can tell me how to solve the issues that result from having deleted it.

    Things' I've done so far

    /scripts/upcp --force

    remove and reinstall sshd<br>
    reinstall csf<br>
    reinstall named (and solve other issues to get it reinstalled)<br>
    reinstall watchmysql<br>
    and others.



    The problem with working too late. In ssh I was trying to remove a folder I created in `/usr/sbin` but forgot to add the folder name so thus the entire `sbin` folder was instantly deleted. I do not have a backup of this folder (only of cpanel accounts).

    I did this by accident:

    Code:
        rm -rf /usr/sbin
    Immediately the server was still fine. However, named would not restart. A couple hours later, the server went down. However, even though the server was down, httpd was still running. Well, eventually I got it up again by removing and reinstalling `sshd` and also reinstalling `named` and tweaking a couple things to get named started.


    Since creating this stupid mistake, I have had to do numerous things:

    remove and reinstall sshd<br>
    reinstall csf<br>
    reinstall named (and solve other issues to get it reinstalled)<br>
    reinstall watchmysql<br>
    and others.

    I also did `/scripts/upcp --force` to try to get cpanel to reinstall any missing files.

    However, I did look and sbin still only has a few symbolic links, instead of like 30 or more symbolic links that it had before deleting the folder. I'm worried these missing symbolic links will cause issues. Also I don't know what else might be missing.

    So far the only service that appears to be giving an issue is `nscd` which refuses to start. Trying to check it or restart `nscd` service gives me nothing. See;

    Code:
           # service nscd restart
        # service nscd status
        # service nscd start
        #
    As you see it just goes to the next line with nothing returned.

    Also ftpd status returns unrecognized, although for this one I'm not sure if maybe ftpd is called something else.

    Code:
           # service ftpd status
        ftpd: unrecognized service

    Also please note I have been trying to get r1soft to work but for now I do not have a full backup of the server; obviously that would be the easiest way but that isn't an option at this time.

    I got r1soft to hopefully mitigate the issue, but I couldn't get r1soft working before this problem occurred. In the future I'll have the server fully backed up for such issues, but for now I don't have that option.

    Please help. I am inside of cpanel and sites are up now but I don't know if it will go down later or possibly have even more serious issues later.

    **Update:** Also see the following issue:

    Code:
           # /usr/local/cpanel/scripts/check_cpanel_rpms --fix
        [2016-08-06 15:28:32 -0700]
        [2016-08-06 15:28:32 -0700]   Problems were detected with cPanel-provided files which are RPM controlled.
        [2016-08-06 15:28:32 -0700]   If you did not make these changes intentionally, you can correct them by running:
        [2016-08-06 15:28:32 -0700]
        [2016-08-06 15:28:32 -0700]   > /usr/local/cpanel/scripts/check_cpanel_rpms --fix
        [2016-08-06 15:28:32 -0700]   The following RPMs are missing from your system:
        [2016-08-06 15:28:32 -0700]   cpanel-mailman-2.1.21-12.cp1158
        [2016-08-06 15:28:53 -0700]   Removing 0 broken rpms:
        [2016-08-06 15:28:53 -0700]   rpm: no packages given for erase
        [2016-08-06 15:28:55 -0700]   Downloading http://httpupdate.cpanel.net/RPM/11.58/centos/6/x86_64/rpm.sha512
        [2016-08-06 15:28:55 -0700]   Successfully verified signature for cpanel (key types: release).
        [2016-08-06 15:28:55 -0700]   cpanel-mailman-2.1.21-12.cp1158.x86_64.rpm already downloaded
        [2016-08-06 15:28:56 -0700]   Disabling service monitoring.
        [2016-08-06 15:28:57 -0700]   Hooks system enabled.
        [2016-08-06 15:28:57 -0700]   Checking for and running RPM::Versions 'pre' hooks for any RPMs about to be installed
        [2016-08-06 15:28:57 -0700]   All required 'pre' hooks have been run
        [2016-08-06 15:29:04 -0700]   No RPMS need to be uninstalled
        [2016-08-06 15:29:04 -0700]   Installing new rpms: cpanel-mailman-2.1.21-12.cp1158.x86_64.rpm
        [2016-08-06 15:29:04 -0700]   Preparing packages for installation...
        [2016-08-06 15:29:04 -0700]   uid=99(nobody) gid=99(nobody) groups=99(nobody)
        [2016-08-06 15:29:04 -0700]   uid=8(mail) gid=12(mail) groups=12(mail),496(mysyslog)
        [2016-08-06 15:29:04 -0700]   /var/tmp/rpm-tmp.wE4wtO: line 46: /usr/sbin/usermod: No such file or directory
        [2016-08-06 15:29:04 -0700]   /var/tmp/rpm-tmp.wE4wtO: line 48: /usr/sbin/usermod: No such file or directory
        [2016-08-06 15:29:04 -0700]   error: %pre(cpanel-mailman-2.1.21-12.cp1158.x86_64) scriptlet failed, exit status 127
        [2016-08-06 15:29:04 -0700]   error:   install: %pre scriptlet failed (2), skipping cpanel-mailman-2.1.21-12.cp1158
        [2016-08-06 15:29:04 -0700] W Error Code: 1
        [2016-08-06 15:29:04 -0700] E The following possible errors were detected while installing RPMs:
        [2016-08-06 15:29:04 -0700] E %pre(cpanel-mailman-2.1.21-12.cp1158.x86_64) scriptlet failed, exit status 127 install
    
    So apparently the `usermod` folder was one of the folders in `sbin` which due to now being missing is also causing issues.
     
    #1 server948, Aug 6, 2016
    Last edited by a moderator: Aug 7, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Unfortunately, I'm unsure of a reliable method to recover the /usr/sbin directory on CentOS. I recommend backing up your existing data to a remote location and reinstalling the OS/cPanel. You can then attempt to manually restore the account-specific data. The other option is to setup the new server first, install cPanel, and then attempt to transfer the data via the "Transfer Tool" option in Web Host Manager:

    Transfer Tool - Documentation - cPanel Documentation
    How to Move All cPanel Accounts from One Server to Another - cPanel Knowledge Base - cPanel Documentation

    Note the removal of your /usr/sbin directory may prevent the Transfer Tool from working as intended.

    Thank you.
     
  3. server948

    server948 Registered

    Joined:
    Aug 6, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    solaris
    cPanel Access Level:
    Root Administrator
    Setup the new server? What new server? I only have one server and I'm not getting another one.
     
  4. server948

    server948 Registered

    Joined:
    Aug 6, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    solaris
    cPanel Access Level:
    Root Administrator
    If so where do I find it in cpanel backups?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Unfortunately, the backup system included with cPanel does not backup the entire filesystem. It's designed to backup individual accounts and certain system configuration files. Documentation on the available backup configuration options is found at:

    Backup Configuration - Documentation - cPanel Documentation

    You could consult with your data center/hosting provider to see if any data is automatically backed up, however it's likely the removal of that directory will prevent the OS from working normally. Users are typically advised to backup the existing data, and then reinstall the OS/cPanel.

    Thank you.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    One alternative to backing up your existing data and reinstalling the OS is to setup cPanel on a new server and transfer the data manually. The backup question is answered on your other open thread.

    Thank you.
     
  7. server948

    server948 Registered

    Joined:
    Aug 6, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    solaris
    cPanel Access Level:
    Root Administrator
    No way in hell. try a real answer besides "do a total reinstall".

    so how can i get the backup of sbin from a cpanel backup?
     
    #7 server948, Aug 8, 2016
    Last edited by a moderator: Aug 8, 2016
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,476
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You can't.

    Multiple threads have been merged here.

    Have you manually backed up the accounts and databases yet? If not you should be concentrating on that right now.

    A cPanel forced update fixes your cPanel installation if it finds an issue. Reinstalling CSF was a waste of your time. What you killed by mistake was a whole lot of system files. When you get into the new server, take a look at that directory and you'll see what I mean.

    If you don't have another server, you need one right now. Or, you'll need to at least download the accounts related files off that server that you still have access to for safe keeping. You don't need to backup the whole server, just your accounts and associated files.

    Moving things over to a new server or backing up local to the server so you can reload it is really your only path forward here.
     
    #8 Infopro, Aug 8, 2016
    Last edited: Aug 8, 2016
    twhiting9275 likes this.
  9. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Just my 0.02 here.

    You can TRY setting up a temporary VPS, making sure that it's precisely the same OS, version, etc, and try rsyncing the data... However, I still wouldn't rely on anything on the old server


    cPanel won't backup system binary files. It doesn't do that. It'll back up your server's accounts, mysql data, all the good stuff, but not binaries. Not gonna happen, and wisely so.

    If you don't want to go and get a new server, then, you might be able to talk your datacenter / host into the following:

    #1: Temporarily removing your primary drive, making it secondary
    #2: Temporarily adding another primary drive to your server
    #3: Reloading the OS onto the drive in #2

    Then, you can take the backups you made (you do have backups of your accounts, et all , right?) and place them on the server itself, and have the host/dc remove the SECONDARY drive and reclaim it. Obviously, you want to keep the primary drive.

    Unfortunately, as Infopro and Michael mentioned, you've pretty much majorly screwed up your server. Take it from me, who's been in this business way longer than you can imagine. You cannot safely recover from your mistake without a full OS reload. You can patch it up, and hope it works (see my first suggestion), but I wouldn't trust a thing there, because who knows what might be missing, and what might not be correct.

    This is why I tell people not to mess with things they don't understand, all the time . These mistakes are incredibly costly in time and $$$.
     
Loading...

Share This Page