You are not logged in.

#1 2014-12-25 18:01:44

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

I just deleted /usr/lib/*

Merry Christmas

I hope somebody out there has the present of knowledge for me. While meaning to delete /usr/local/lib/*, I accidently deleted /usr/lib!!! Before turning off my computer and losing internet access, I'd like to know if it's possible to

1) get a list of all the packages I need to reinstall in order to rebuild the libraries
2) install stuff even though neither "sudo" nor "su" are recognized.

Also, I'm traveling for a couple of months and managed to lose the usb stick with the Arch install, and being Christmas, I don't know if I can buy another usb stick until tomorrow. I hope there's some way to do this without booting into a usb stick. I don't have optical disk reader/burner either.

Last edited by jasonwryan (2014-12-25 19:22:31)

Offline

#2 2014-12-25 18:18:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: I just deleted /usr/lib/*

Can you switch to a different console using Ctrl-Alt-F2 and log in as root?  If not, I fear you are going to need to boot from a recovery media.
If not, You might be able to use bash as your init process.  Tell your boot loader to use /usr/bin/bash as init.  Then, if you are lucky, you might be able to install stuff from your cache.
You may be able to determine the missing files using pacman -Qk


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-12-25 18:25:46

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,163
Website

Re: I just deleted /usr/lib/*

I'd have thought getting a list of packages should be easier than the second thing you've asked, either through pacman (as ewaller suggested) itself or some clever parsing of pacman.log

No idea about the second bit without a recovery media.

Last edited by clfarron4 (2014-12-25 18:26:19)


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#4 2014-12-25 18:33:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: I just deleted /usr/lib/*

I think you're SOL without a bootable media.  You may still have all the required files in the package cache, but there is probably no way to use them.  Pacman relies on several libs in /usr/lib.  Even without pacman if you wanted to manually extract those packages, you'd need something like tar - and tar also relies on libs in /usr/lib.

It may be possible if all the required libs have been recently used and just luckily happen to still be in ram so they don't need to be reloaded from disk.  But I suspect this is highly unlikely.  You can easily find out by just trying to run pacman or tar.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2014-12-25 18:33:42

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: I just deleted /usr/lib/*


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2014-12-25 18:37:52

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

Seems like I will have to wait until I can get install media because even Ctrl-Alt-F2 doesn't work - it just gives a flashing cursor in the top left corner. Even "ls" or "cat" don't work. The only command I've found that still works is "cd". The applications that were running when I did this still work, but I can't launch anything else. Given that "ls" doesn't work, it's no surprise that "pacman" doesn't either.

Offline

#7 2014-12-25 18:47:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: I just deleted /usr/lib/*

`cd` works because it is a shell builtin function - and your shell is already running.  `ls` and `cat` are separate binaries that rely on libraries.  So yes, you definitely need another bootable medium.  And arch iso would make it very easy, but even another distro could work if you were to manually unpack the cached packages - this, however, would be easy to screw up, so I'd advise just waiting until you have a bootable iso.  Then, while there may be ways to get a more perfectly targetted solution, I'd go with the easy but effective approach:

1) mount your partitions
2) pacman -r /mnt -S base
3) reboot into multi-user target on your system
4) pacman -Qk to find remaining broken packages
5) pacman -Syu <results from 4>


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2014-12-25 19:06:25

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

Thanks Trilby, when I get the arch install media, I'll follow your steps, but would like you to elaborate on step 3. What is the systemctl command to reboot into multi-user target? Is that different than what would happen by default with 'systemctl reboot'?

Offline

#9 2014-12-25 19:20:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: I just deleted /usr/lib/*

That depends how your system is currently configured.  Mine only boots into multi-user target as-is.  But if you have a graphical target it will most likely fail.  You could still change to another tty, I think, so step 3 is probably optional - but you can see how here.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2014-12-25 19:29:35

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

Thanks. I'll update when I've got an install media and got my system back to normal.

Offline

#11 2014-12-25 20:29:16

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: I just deleted /usr/lib/*

If you have busybox installed then you might be able to recover without a live medium.

Check if the following command works:

busybox ls

If it does it should be possible to unpack the necessary files to get pacman working. I'll try to come up with a script to do so if no one else does.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#12 2014-12-25 20:36:56

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

Thanks Xyne, but I'm not running busybox. I'm using Xfce (with as many "devel" components installed as are available).

Offline

#13 2014-12-25 20:50:15

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: I just deleted /usr/lib/*

busybox is a statically compiled executable provided by the "busybox" package. It is a simple tool that is unrelated to the DE.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#14 2014-12-25 20:55:39

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

I have not already installed busybox and anything that wasn't running when I deleted /usr/lib/* won't run now. In order to use it, it would've needed to be already installed and running, I think. I'm hoping somebody I visit today will have a usb flash drive I can use.

Offline

#15 2014-12-25 21:26:39

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: I just deleted /usr/lib/*

I understand that. I was hoping that you already had it installed, in which case I could have provided a script to help you recover the system.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#16 2014-12-25 22:34:56

headkase
Member
Registered: 2011-12-06
Posts: 1,975

Re: I just deleted /usr/lib/*

rm -r strikes down another victim.  At least modern versions of it will ask if you're sure if you just give it "/".  Sorry for the situation in general though, hope you get back up and running with a minimum of fuss.

Offline

#17 2014-12-25 22:49:14

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: I just deleted /usr/lib/*

It won't help in this case but for future reference for anyone who comes across this thread, I have created a script named pkg-busybox_recovery that should be able to help in such a situation.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#18 2014-12-25 23:49:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: I just deleted /usr/lib/*

Xyne, it seems busybox is dynamically linked against two libraries in /usr/lib, libm and libc.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#19 2014-12-26 00:32:50

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: I just deleted /usr/lib/*

Trilby wrote:

Xyne, it seems busybox is dynamically linked against two libraries in /usr/lib, libm and libc.

Well, f@#%. That sort of defeats the purpose of busybox. I didn't even think to check that. Pre-compiled binaries are available online from upstream though.

I'll investigate why the repo version isn't statically linked.

edit
Related ticket: https://bugs.archlinux.org/task/43227

Last edited by Xyne (2014-12-26 00:42:44)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#20 2014-12-26 17:21:16

colinkeenan
Member
From: Kansas City, MO USA
Registered: 2013-06-13
Posts: 213
Website

Re: I just deleted /usr/lib/*

I got a USB flash drive stick from somebody yesterday, and also got a backup from a couple of months ago on another drive to boot. First I tried the 5 steps given by Trilby, from the backup boot, but couldn't get 'base' properly re-installed because it was still looking for some libraries when doing mkinitcpio. But, at least I had a fully functional Arch install from which to make the install media. I tried the 5 steps again from the Arch iso, but it failed for the same reason. Since I also had a fully up-to-date backup of personal data, I decided to just go for a complete re-install of Arch. I always install Arch on just one partition, without a separate home folder, because when I go to the trouble of a full re-install, I want the home folder to be clean as well. I just backup anything from it that wouldn't come from a clean install and simple configuration. This is the first time I've had to rely on my backup system, and I'm glad to see it's working well. There's still a few improvements I can make, but I don't seem to have lost anything.

Offline

Board footer

Powered by FluxBB