0

While trying to move a file into /usr/lib/x86_64-linux-gnu, I accidentally overwrote x86_64-linux-gnu itself. The system(ArchLinux) is still running, but I'm not sure how to safely recover x86_64-linux-gnu, what exactly/how important it is, or what will happen if the system reboots. How can I fix/recover x86_64-linux-gnu, and anything else that might have happened with the system?

edit: The command that accidentally overwrote x86_64-linux-gnu, is mv /usr/lib/liblatencyflex_layer.so /usr/lib/x86_64-linux-gnu, the intended command was mv /usr/lib/liblatencyflex_layer.so /usr/lib/x86_64-linux-gnu/ (first I had accidentally moved into /usr/lib/ instead of /usr/lib/x86_64-linux-gnu/). I'm trying to do a manual install of program that needs a liblatencyflex_layer.so file in x86_64-linux-gnu.

edit2: Apparently /usr/lib/x86_64-linux-gnu is a Debian directory not ArchLinux, and I was following the wrong tutorial; more info in the comments below twelfth's answer.

muru
  • 69,900
  • 13
  • 192
  • 292
Shringe_
  • 3
  • 3
  • How did you manage to do that? – muru Aug 01 '23 at 01:36
  • *how important it is* ... of the 1564 packages I have installed (in Debian) 803 of them install *something* in that folder, for a total of 5703 files/links/folders - so, I would say it's quite important – Jaromanda X Aug 01 '23 at 01:54
  • @JaromandaX, So what should I do? Is there some sort of way to undo/recover files after a mv? I assume I'm not able to reinstall that folder because it seems it varies by system. – Shringe_ Aug 01 '23 at 01:57
  • The steps you say you took to get yourself into this situation can't be right - you can't overwrite a directory with a file ... you must have moved the directory out of the way before "mv"ing a file into its place. – tink Aug 01 '23 at 02:35
  • @tink, I gave the exact command I did to get into this situation. So I'm not sure what to tell you. – Shringe_ Aug 01 '23 at 02:43

1 Answers1

0

what exactly... it is

Please see here for further information, as this answer explains that quite well.

Arch Linux users, please ignore the above link, which pertains to the Debian or Ubuntu handling of multiarch. For Arch handling of this, please see the Arch wiki file hierarchy.

How can I fix/recover x86_64-linux-gnu, and anything else that might have happened with the system?

There is nothing to fix. The directory does not ordinarily exist in Arch installations. Please check when manually installing whether the instructions pertain to your distribution, as differences can arise.

Assuming you did, for some reason, have the /usr/lib/x86_64-linux-gnu/ directory in your Arch installation, execute the following.

Please back up your data before running the second command.

Open a terminal and try running:

# pacman -Qk

See here and here for further explanation of the command above. This locates missing files. Then, with the results from that copied, paste them as follows:

# pacman -Syu [INSERT RESULTS FROM ABOVE]

See here for further explanation of the command above.

twelfth
  • 24
  • 1
  • Thank you I'll try that once a timeshift backup completes. – Shringe_ Aug 01 '23 at 02:03
  • No problem. I presume the timeshift is going to an external storage device? – twelfth Aug 01 '23 at 02:05
  • Should I keep or delete the new file that has overridden /usr/lib/x86_64-linux-gnu before doing either of those? – Shringe_ Aug 01 '23 at 02:05
  • You would need to provide further details as to what this new file is and your intentions for moving it. Please edit your OP to reflect this. Ordinarily, Arch advises users to move files into the home directory. – twelfth Aug 01 '23 at 02:07
  • yes, external harddrive. – Shringe_ Aug 01 '23 at 02:07
  • edited now. I don't care about the 'liblatencyflex_layer.so' that overwrote, just making sure my system Is intact, I'm not sure if it is safe to leave it there while running the commands. – Shringe_ Aug 01 '23 at 02:20
  • I think you could delete that file (though you may want to use a file manager or other GUI to be safe). If you want the command instead, `rm -i /usr/lib/x86_64-linux-gnu`. `-i` will ask for confirmation. – twelfth Aug 01 '23 at 02:26
  • I deleted /usr/lib/x86_64-linux-gnu, and then ran 'sudo pacman -Qk', all the packages appeared to have "0 missing files", 'sudo pacman -Syu' had a couple "WARNING: Possibly missing firmware for module: x" at the end. I also tried 'sudo pacman -Qkk' which reported a lot of "0 altered files" though I didn't let that last command run all the way. Still getting "No such file or directory" from 'ls /usr/lib/x86_64-linux-gnu'. – Shringe_ Aug 01 '23 at 02:52
  • @Shringe_ Just to check, you did not add an `-r` flag to the above command did you? Just one other thing; have you tried `ls /usr/lib/x86_64-linux-gnu/ | grep "flex"`? In addition, could you also just run this command `ls /usr/lib64`? – twelfth Aug 01 '23 at 02:56
  • No '-r' to any of the commands. 'ls /usr/lib/x86_64-linux-gnu/ | grep "flex"' is just another "No such file or directory", I have already done 'rm -i /usr/lib/x86_64-linux-gnu '. – Shringe_ Aug 01 '23 at 03:01
  • @Shringe_ It seems your installation may be geared toward a Debian system, hence the confusion. Please provide further information in your OP as to what exactly you were trying to install. Ordinarily, at least on Arch, if there is no ambiguity as to the file or directory, it will pick whatever is there, as [everything is a file](https://en.wikipedia.org/wiki/Everything_is_a_file) on UNIX based systems. Given Arch's [file hierarchy](https://man.archlinux.org/man/file-hierarchy.7.en) does not include `x86_64-linux-gnu/`, my guess is you created a file which did not exist in `/usr/lib/`. – twelfth Aug 01 '23 at 03:22
  • 1
    Oops you are right, the tutorial I was following I thought was an Arch tutorial, not Debian. I feel pretty silly right now, but thank you so much for all the help you have given me. I swore I had used this same tutorial for installation on a previous Arch system, so not sure what I'm remembering. https://github.com/ishitatsuyuki/LatencyFleX – Shringe_ Aug 01 '23 at 03:31
  • No problem, and glad it helped. We all do that sort of thing, from time to time. If you need help with that installation, I would recommend you begin another question, though can you not simply [build from source](https://github.com/ishitatsuyuki/LatencyFleX/blob/master/docs/BUILDING.md)? Note, using that guide, only use one command per code block; i.e., after `cd layer`, only do one of the following commands, like `meson build`. – twelfth Aug 01 '23 at 04:13
  • I got it working, just accidentally went to the Debian installation at first. Building is just compiling correct? If so I don't think building it would actually put all the different files where they need to go; It's mostly moving around DLLs and different libs into a Wine c_drive and some Linux locations. – Shringe_ Aug 01 '23 at 04:38