0

In a remote system to which I don't have console access, which I'm connecting through ssh, I broke the sudo installation and now I'm not able to use it at all, and I'm not able to restart as a root. The command I ran was:

sudo mv /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6_org

Everytime I do sudo <command or option> it says segmentation fault, for example:

~$ sudo -s
Segmentation fault (core dumped)

As specific cases,

  • id works: uid=1479554(s1474782) gid=100(users) groups=100(users),27(sudo),999(docker)
  • sh works as well
  • sudo id doesn't work: sudo id Segmentation fault (core dumped)
  • su s1474782 -c id doesn't work: sudo id Segmentation fault (core dumped)

I was updating some libraries and I think I broke the libm.so.6 library, however I don't see sudo depending on it:

ldd $(which sudo)
    linux-vdso.so.1 =>  (0x00007ffd7ef9e000)
    libaudit.so.1 => /lib/x86_64-linux-gnu/libaudit.so.1 (0x00007f139de21000)
    libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f139dbff000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f139d9fc000)
    libsudo_util.so.0 => /usr/lib/sudo/libsudo_util.so.0 (0x00007f139d7e8000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f139d41e000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f139d1ae000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f139cfaa000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f139e26b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f139cd8d000)

Any advice how to solve this? I can just re-install sudo?

4
  • 1
    Does su s1474782 -c id work? You'll need to use your password to test this, and I'm asusming your username is s1474782. (I'm looking to see if the problem lies in the PAM authentication subsystem or in sudo itself. Commented Oct 30, 2024 at 20:28
  • And for next time: do not update libraries in such way (especially standard library: libm is part of C standard library). And if you want to develop such libraries, you should test on a container or/and have static linked toolset Commented Oct 31, 2024 at 11:01
  • Hi @ChrisDavies, su s1474782 -c id gives the same Segmentation fault (core dumped) error, I'll update the question Commented Oct 31, 2024 at 13:53
  • @GiacomoCatenazzi, you are right, I learnt it the hard way... Commented Oct 31, 2024 at 13:56

1 Answer 1

2

To fix this, try logging in as the root user if you can, or boot your system into recovery mode to gain root access.

From there, rename libm.so.6_org back to libm.so.6. This should allow sudo to work again since the library will be restored to its original state.

3
  • Hi, I can not restart or access as a root as this is a server. I edited the question accordingly Commented Oct 31, 2024 at 14:13
  • @user236040 that doesn't make sense. The system is broken. You or someone needs to fix it. When you say "it's a server" do you really mean that "it's a remote system to which I don't have console access"? Commented Oct 31, 2024 at 14:15
  • Hi, sorry, that's exactly what I meant Commented Oct 31, 2024 at 14:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.