run command rm -rf /*

Discussion in 'ISPConfig 3 Priority Support' started by pawan, May 13, 2021.

  1. pawan

    pawan Member

    by mistake I run the command /* but cancelled immediately, but looks like some core files got deleted.
    when I run the command ll I am getting the error
    Command 'ls' not found, but can be installed with:
    apt install coreutils
    when I run apt install coreutils
    Code:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    coreutils is already the newest version (8.28-1ubuntu1).
    The following packages were automatically installed and are no longer required:
      gyp libc-ares2 libhttp-parser2.7.1 libicu64 libjs-async libjs-inherits libjs-node-uuid libpcre16-3 libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5
      libssl1.0-dev libtidy5 libuv1 libuv1-dev nodejs-doc pkg-php-tools shtool
    Use 'apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
    3 not fully installed or removed.
    Need to get 0 B/3,861 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    E: Sub-process /usr/bin/apt-listchanges --apt || test $? -lt 10 returned an error code (100)
    E: Failure running script /usr/bin/apt-listchanges --apt || test $? -lt 10
    looks like I have broken the system, but how can I fix this?

    Note: Website is still working fine in the browser.
     
  2. pawan

    pawan Member

    The issue is resolved anyway.
    how I resolved.
    found that bin folder was deleted. tried to rsync from another system, but didn't work.
    then I zipped the bin folder in another system and copied it to a webroot and from there I downloaded it with wget.
    and then unzipped the bin in the current system root.
    all commands start working now.
     
  3. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    It is possible that there are still missing files that will cause issues later. I would recommend you to set up a new system and migrate to that while things are working.
     
  4. pawan

    pawan Member

    No Th0m, there were only two folders bin and boot
    which I have restored from other system.
    reason I am saying there cannot be other folder as I compared other folders with the working system, besides as I said, I cancelled the command immediately.
     
  5. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    It's up to you ofcourse - I am just recommending it. You could also restore a snapshot if you have one ofcourse.
     
  6. pawan

    pawan Member

    Hi Th0m - I don't have one. but can you point me - how I can create one(snapshot) for future use?
     
  7. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    This depends on how your server is hosted. Most virtual server software or VPS providers will have such a function.
     
  8. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    I would probably force a reinstall of all packages, too, to ensure all binaries are present and at the correct versions.
     
  9. pawan

    pawan Member

    okay If I want to re-install a fresh system - if I take the backup of
    /var/www
    /var/lib
    /etc/
    is that enough?
     
  10. pawan

    pawan Member

    actually I faced a issue with booting, I had to boot with a OCS - SYSCRD5.1.0(rescue)
    as reboot was not working.
    can you help me repair the booting?
    I can mount the ssd in which the os is loaded.
     
  11. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Learning to rebuild would be fun and good experience but I think it would be safer to migrate the server to another server instead of rebuilding the accidentally removed core files if the server is meant for public clients.
     
  12. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

  13. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Like @Th0m wrote, virtual server software has features that allow taking snapshot or dump of the virtual machine, so it can be restored to a state it was before or moved to another host.
    If your system is on a computer box in your office, you can use tools like Clonezilla to take an image copy of the disk, which then can be restored on the same host or another host.
    Both ways allow you to restore a booting system, not just the data on the system.
    Practise using these before trusting your production system on them.
     
    ahrasis and pawan like this.

Share This Page