Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 10071  / 2 Years ago, thu, february 3, 2022, 2:47:32

I accidentally deleted /usr/bin/test and now I can't update, upgrade and install packages.


I already tried the solution here: apt-get raises /usr/bin/test: Permission denied, but this is the output I got:


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
java-common libutempter0
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 29 not upgraded.
Need to get 1,353 kB of archives.
After this operation, 0 B of additional disk space will be used.
Ign:1 http://ph.archive.ubuntu.com/ubuntu impish/main amd64 coreutils amd64 8.32-4ubuntu2
Ign ...
Ign ...
Err:1 http://ph.archive.ubuntu.com/ubuntu impish/main amd64 coreutils amd64 8.32-4ubuntu2
Could not connect to ph.archive.ubuntu.com:80 (202.79.184.254), connection timed out
E: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/pool/main/c/coreutils/coreutils_8.32-4ubuntu2_amd64.deb Could not connect to ph.archive.ubuntu.com:80 (202.79.184.254), connection timed out
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


I also tried sudo apt update --fix-missing and got this output:


Err:8 http://ph.archive.ubuntu.com/ubuntu impish InRelease
Could not connect to ph.archive.ubuntu.com:80 (202.79.184.254), connection timed out
Err:9 http://ph.archive.ubuntu.com/ubuntu impish-updates InRelease
Unable to connect to ph.archive.ubuntu.com:http:
Err:10 http://ph.archive.ubuntu.com/ubuntu impish-backports InRelease
Unable to connect to ph.archive.ubuntu.com:http:
Fetched 125 kB in 37s (3,339 B/s)
sh: 1: /usr/bin/test: not found
sh: 1: /usr/bin/test: not found
sh: 1: /usr/bin/test: not found
Reading package lists... Done

Please help me.


More From » apt

 Answers
5

I suggest getting the deleted file from a live USB and putting it back. Here's how.



  1. Download the Ubuntu ISO for your version of Ubuntu. Given that you have Impish (your apt output indicates that), the Ubuntu 21.10 ISO should work for you. Download the ISO labeled Desktop Image from here.

  2. Download balenaEtcher. Get the x64 Linux version. Extract the zip. In a terminal, go into the extracted zip folder. Once you're there, if you do ls, you should see a file that ends in .AppImage. Do chmod +x balenaEtcher-1.7.3-x64.AppImage.

  3. Run balenaEtcher with ./balenaEtcher-1.7.3-x64.AppImage.

  4. Find a flash drive that is bigger than 8GB in capacity, and put it in your computer. All data on this flash drive will be destroyed.

  5. Select the downloaded ISO, and select the flash drive. Hit Flash.

  6. Once it's done, reboot your computer, enter the boot menu, and select the flash drive. Press Try Ubuntu.

  7. In the live USB session, mount the main system. It might automatically do it, and there might be a button in the GUI to do that. Figure out where it is mounted. I'll use /mnt/mainfs as an example, but you should use the real location.

  8. Open a terminal, and run sudo cp /usr/bin/test /mnt/mainfs/usr/bin/test. Replace /mnt/mainfs with wherever you mounted your main system.

  9. You're done. Shut down the live session, unplug the flash drive, and reboot. Normal Ubuntu will be back, and apt should work again.


[#838] Thursday, February 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stantildlike

Total Points: 363
Total Questions: 135
Total Answers: 120

Location: Pitcairn Islands
Member since Fri, Dec 17, 2021
2 Years ago
stantildlike questions
Fri, May 5, 23, 00:50, 1 Year ago
Tue, Jun 28, 22, 13:54, 2 Years ago
Tue, Dec 13, 22, 07:27, 1 Year ago
;