You are not logged in.

#1 2015-12-07 06:08:26

stabwound
Member
Registered: 2015-07-24
Posts: 48

Mangled /bin, how to fix?

I managed to mangle /bin and completely wiped it from the system.

Is this recoverable at this point?

This is a remote system that I can no longer SSH into and it no longer boots, but I can boot into a recovery console and manipulate the files in /dev/sda1 where Arch is installed.

Is there some way I can fix this without having to completely reinstall?

Offline

#2 2015-12-07 06:17:33

severach
Member
Registered: 2015-05-23
Posts: 198

Re: Mangled /bin, how to fix?

/bin is a symlink. If you really mangled /bin and not /usr/bin then just recreate the symlink.

ln -s usr/bin (mount folder)/bin

IDK what a recovery console is. Perhaps you mean that you can boot into the CD/USB version of Arch. If /usr/bin is toast then you can't chroot but that's OK. See pacman --root for making the pacman on CD update your broken folders.

See how to reinstall all packages in the system?

A semi competent assistant on site can get your system booted to the CD/USB and enable ssh so you can get in to do the repair.

Last edited by severach (2015-12-07 06:19:18)

Offline

#3 2015-12-07 06:44:42

stabwound
Member
Registered: 2015-07-24
Posts: 48

Re: Mangled /bin, how to fix?

This is an OVH dedicated server running Arch, they have some sort of recovery console you can SSH into. It's some sort of very basic Linux, not Arch so I assume I can't run Pacman.

I tried symlinking like you suggested and it didn't help fix anything. Unfortunately I can't see the error messages either since it's a remote server.

Offline

#4 2015-12-07 07:39:04

severach
Member
Registered: 2015-05-23
Posts: 198

Re: Mangled /bin, how to fix?

Without better info on what's destroyed I can take another stab.

Sounds like the recovery console has some Internet access. Install the core system onto any computer in the junk box. tar up the /usr/bin folder, ftp, and untar on the broken server. Once you've cobbled up enough to boot or chroot then pacman can fix the rest--assuming you haven't destroyed /etc or /var.

Seems to me the entire Arch OS could be installed this way.

Offline

#5 2015-12-07 13:18:34

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Mangled /bin, how to fix?

What did you do to mangle /bin?


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#6 2015-12-07 13:37:27

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

Re: Mangled /bin, how to fix?

And how did you initially install arch?  You should be able to take a few bits from that initial procedure to get to a point where you can use pacman --root.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2015-12-07 14:05:25

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Mangled /bin, how to fix?

stabwound wrote:

This is an OVH dedicated server running Arch, they have some sort of recovery console you can SSH into. It's some sort of very basic Linux, not Arch so I assume I can't run Pacman.

You mean the recovery console is not Arch but it lets you mount your Arch file-systems?  Can you do that and chroot in?

Offline

#8 2015-12-07 16:21:58

stabwound
Member
Registered: 2015-07-24
Posts: 48

Re: Mangled /bin, how to fix?

Thanks for the advice everyone.

I've managed to fix things to the point that I can chroot into the Arch system.

Before I destroy things even worse, what pacman commands should I issue in an attempt to fix this mess?

Offline

#9 2015-12-07 16:38:08

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

Re: Mangled /bin, how to fix?

If you could chroot in, then /usr/bin/bash must be there - and I suspect the /bin symlink is likely in place (as I *think* the chroot process calls /bin/bash - but I could be wrong on this part).

Look around (with ls -l), see what's there and report back.

Also the following should be very useful:

pacman -Qk | grep -v ' 0 missing'

If that returns nothing, you should be in good shape - but I'd do a pacman -Syu too.  If on the otherhand the -Qk lists some packages missing files, you will most likely need to reinstall those packages - but first, just list the output here.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2015-12-07 16:47:24

stabwound
Member
Registered: 2015-07-24
Posts: 48

Re: Mangled /bin, how to fix?

Thanks for the quick response!

I actually reinstalled all packages with pacman (pacman -Qenq | pacman -S -) and lo and behold, the system boots again as normal.

Thanks for the help everyone.

Last edited by stabwound (2015-12-07 16:50:55)

Offline

#11 2015-12-07 17:35:13

severach
Member
Registered: 2015-05-23
Posts: 198

Re: Mangled /bin, how to fix?

# pacman -Qenq | wc -l
274
# pacman -Qnq | wc -l
1112

I think pacman -e might be a mistake. For my system pacman will only reinstall the 274 explicitly installed packages. Files for the remaining 800+ packages may remain missing.

The drawback is that after reinstalling, all 1112 packages will be marked as explicit. Maybe someone else will come up with a clever command line to prevent this.

Offline

#12 2015-12-07 17:38:32

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: Mangled /bin, how to fix?

severach wrote:

The drawback is that after reinstalling, all 1112 packages will be marked as explicit. Maybe someone else will come up with a clever command line to prevent this.

Pacman doesn't change the install reason on a reinstall.

Offline

Board footer

Powered by FluxBB