[GTALUG] How much do you know about how linux executes binaries?
Nicholas Krause
xerofoify at gmail.com
Wed Dec 11 13:46:04 EST 2019
On 12/11/19 12:27 PM, Lennart Sorensen via talk wrote:
> Someone at work just made a slight mistake:
>
> root at ECA:~# cd /var
> root at ECA:/var# mv core.* /* [clearly that trailing * was not meant to be there]
> [bunch of errors about target already existing]
> root at ECA:/var# ls
> -bash: /bin/ls: No such file or directory
> root at ECA:/var#
>
> So what do you do now?
My first idea would be to echo $PATH and see if the path is messed up or
/etc/profile or other bash startup scripts are not screwed up. Not sure what
the errors were but that's the first place to start.
If that's fine then /bin is a symlink from /usr/bin these days to something
in /usr/bin and I would less if my symlinks for /bin are now screwed up
and fix that. The real question through is how much of root is overwritten
in this case.
Nick
>
> I was able to fix it in about 5 minutes without using anything other
> than what was on the running system? Interesting little problem.
>
> The original state of the system was:
>
> root at ECA:/var# ls -l /
> drwxr-xr-x 2 root root 4096 Dec 9 11:47 bin
> drwxr-xr-x 2 root root 4096 Dec 6 11:16 boot
> drwxr-xr-x 10 root root 2340 Dec 6 11:18 dev
> drwxr-xr-x 46 root root 4096 Dec 9 11:48 etc
> drwxr-xr-x 6 root root 4096 Dec 5 12:09 home
> lrwxrwxrwx 1 root root 10 Dec 5 12:09 init -> /sbin/init
> drwxr-xr-x 4 root root 4096 Dec 5 12:09 lib
> drwxr-xr-x 5 root root 4096 Dec 5 12:09 lib64
> drwx------ 2 root root 4096 Dec 5 12:09 lost+found
> drwxr-xr-x 2 root root 4096 Nov 19 10:07 media
> drwxr-xr-x 4 root root 4096 Dec 5 12:09 mnt
> drwxrwxrwx 6 root root 4096 Dec 5 12:24 opt
> drwxr-xr-x 3 root root 4096 Dec 5 12:09 persistdata
> drwxr-xr-x 5 root root 4096 May 25 2018 persistent
> dr-xr-xr-x 473 root root 0 Dec 6 11:17 proc
> drwxr-xr-x 5 root root 4096 Dec 9 11:38 root
> drwxr-xr-x 12 root root 780 Dec 6 11:18 run
> drwxr-xr-x 2 root root 4096 Dec 9 11:47 sbin
> dr-xr-xr-x 11 root root 0 Dec 6 11:17 sys
> drwxrwxrwt 8 root root 400 Dec 11 12:14 tmp
> drwxr-xr-x 12 root root 4096 Dec 5 12:09 usr
> drwxr-xr-x 15 root root 4096 Dec 5 12:15 var
>
More information about the talk
mailing list