You are not logged in.

#1 2014-01-25 17:20:16

fowlslegs(usually)
Member
Registered: 2013-06-27
Posts: 12

[Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

So as the title states I accidently deleted /bin (meant to delete ~/bin, but omitted the tilde) and as you can imagine I rather borked my system. I copied the contents of /usr/bin to /bin and everything seems to be working fine, but I am curious if this has or will affect my system in some way (stability, functionality, performance, organization, etc.). If there is a better way to fix this please share.

Last edited by fowlslegs(usually) (2014-01-25 17:42:38)

Offline

#2 2014-01-25 17:23:52

fowlslegs(usually)
Member
Registered: 2013-06-27
Posts: 12

Re: [Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

Found the explanation below from user ultrasawblade on a stackexchange post https://unix.stackexchange.com/question … nd-usr-bin. Is this accurate for Arch?

"/sbin - Binaries needed for booting, low-level system repair, or maintenance (run level 1 or S)

/bin - Binaries needed for normal/standard system functioning at any run level.

/usr/bin - Application/distribution binaries meant to be accessed by locally logged in users

/usr/sbin - Application/distribution binaries that support or configure stuff in /sbin.

/usr/share/bin - Application/distribution binaries or scripts meant to be accesed via the web, i.e. Apache web applications

*local* - Binaries not part of a distribution; locally compiled or manually installed. There's usually never a /local/bin but always a /usr/local/bin and /usr/local/share/bin."

Offline

#3 2014-01-25 17:24:56

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,794
Website

Re: [Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

Ah ... you actually copied it all?  That is not good at all.  First you've now doubled the drive space used by everything in bin, but also the next filesystem update will fail with a conflicting file.

/bin should not contain anything, it should just be a symlink to /usr/bin.

I don't know the best approach, but if I were in your spot, I'd delete everything that was copied over to /bin, then remove the /bin dir again, then recreate the symlink or reinstall filesystem (I'd opt for the latter).

So, in short, my proposal which might have to be done from a live medium:

rm -rf /mnt/bin
pacman -r /mnt -S filesystem

Assuming you've mounted your root filesystem in the live environment's /mnt

EDIT: if this can be done from within the system it'd be very similar:

rm -rf /bin
pacman -S filesystem

If this works it'd certainly be quicker, I'd probably try this first, but I would be prepared with a live USB to fallback on the first option.

Last edited by Trilby (2014-01-25 17:26:52)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#4 2014-01-25 17:26:12

rebootl
Member
Registered: 2012-01-10
Posts: 427
Website

Re: [Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

Hm, when working with/in your home directory you should use a regular user instead of root. Then something like this cannot happen.

Luckily for you /bin should be a symlink to /usr/bin, so there's no need to copy anything:

$ ls -l /bin
lrwxrwxrwx 1 root root 7 May 31  2013 /bin -> usr/bin

You may want to check out

man ln

about creating a symlink.

Edit: Trilby beat me... Maybe reinstalling filesystem is better, though both ways should work.

Last edited by rebootl (2014-01-25 17:28:21)


Personal website: cem.revamp-it.ch
GitHub: github.com/rebootl

Offline

#5 2014-01-25 17:27:37

korn36
Member
Registered: 2014-01-14
Posts: 111

Re: [Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

Don't copy /usr/bin contents to /bin
Instead, make a symlink: ln -s /usr/bin /bin

Offline

#6 2014-01-25 17:42:07

fowlslegs(usually)
Member
Registered: 2013-06-27
Posts: 12

Re: [Solved] Deleted /bin, copied contents of /usr/bin to /bin to replace

Took Trillby's advice and reinstalled the filesystem after deleting /bin again from a live Arch key. Everything seems to be in working order. Thanks!

Offline

Board footer

Powered by FluxBB