Sudo causing segmentation fault

Beginning this afternoon, any sudo command started to fail like so:

sudo ls                                                               [1]
zsh: segmentation fault (core dumped)  sudo ls
sudo pacman -Syyu                                                   [139]
zsh: segmentation fault (core dumped)  sudo pacman -Syyu

su still works, so I was able to update all of my packages (except for AUR), though sudo is still not working. Using dmesg -wH the following error appears every time I invoke sudo:

[  +0.000256] sudo[3708]: segfault at 0 ip 00007f8df6642a85 sp 00007fffd6f0e2c8 error 4 in libc-2.32.so[7f8df6506000+14d000]

I’m at a loss for how to proceed after this.

What about running just sudo, does that work? You could run sudo in gdb: gdb sudo, then r ls and enter, then when it dies, type bt and enter, and then it’ll show where the problem is. Maybe that could shed some light on the issue.

Sorry, I’m not quite sure I understand-- I’ve never used gdb before. Simply running sudo works just fine, though, but sudo gdb segfaults. When I try to run sudo within gdb, I get:

(gdb) sudo
Undefined command: "sudo".  Try "help".

Some more (hopefully useful) information. The problem I have seems similar to the one here: Sudo broken [Solved] / Newbie Corner / Arch Linux Forums. I noticed that the segfault does not appear when I run strace sudo ls, but I do get the following error at the end of the strace:

write(2, "effective uid is not 0, is /usr/"..., 133effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?) = 133

the output of coredumpctl gdb sudo ls still indicates a segfault, however:

~ >>> coredumpctl gdb sudo ls                                                                                                                                                                                                                                                                     [1]
           PID: 7887 (sudo)
           UID: 1000 (osman)
           GID: 1000 (osman)
        Signal: 11 (SEGV)
     Timestamp: Tue 2020-12-08 20:18:04 EST (21min ago)
  Command Line: sudo -s
    Executable: /usr/bin/sudo
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-8e179c86-e009-4421-9c87-d50c3cd78ad2.scope
          Unit: user@1000.service
     User Unit: vte-spawn-8e179c86-e009-4421-9c87-d50c3cd78ad2.scope
         Slice: user-1000.slice
     Owner UID: 1000 (osman)
       Boot ID: c4aebb3ae7544e23b786215519e7a82c
    Machine ID: bacf17a284dd4a6dad8290b0ddae9f97
      Hostname: univac
       Storage: none
       Message: Process 7887 (sudo) of user 1000 dumped core.

The thread I linked above, smbclient was apparently the one causing problems. However, smbclient was last updated on the 2nd, and this problem only appeared today.

I had the same issue earlier. I just restored my Timeshift system backup from last night with no success. However, I was able to run sudo pacman -Syu after switching to a BASH shell. After updating again neither ZSH nor BASH worked again. I may try restoring my backup again and hold off on the update until tomorrow.

These are the packages that were updated since my Timeshift backup was made last night:

Packages (26) apparmor-3.0.1-1  fprintd-1.90.6-1  fwupd-1.5.3-1  gdk-pixbuf2-2.42.2-1  haskell-aeson-1.5.4.1-19  haskell-strict-0.4.0.1-1  lib32-gdk-pixbuf2-2.42.2-1  libfprint-1.90.5-1
              linux54-5.4.82-1  linux54-headers-5.4.82-1  linux54-nvidia-455.45.01-3  linux59-5.9.13-1  linux59-headers-5.9.13-1  linux59-nvidia-455.45.01-3
              linux59-virtualbox-host-modules-6.1.16-11  mesa-20.3.0-3  onlyoffice-desktopeditors-6.1.0-1  sbc-1.5-1  shellcheck-0.7.1-205  simple-scan-3.38.2-1  systemd-247.1-2
              systemd-libs-247.1-2  systemd-sysvcompat-247.1-2  vivaldi-3.5.2115.73-3  vivaldi-ffmpeg-codecs-87.0.4280.88-2  xapp-2.0.2-1

Do you mean sudo started working again after you updated? I can successfully update using su, but sudo is still broken after the update.

No, sudo and sudo su are now working fine after I restored my Timeshift backup before those updates.

I tried downgrading apparmor, but that didn’t help. I just restored my Timeshift backup again and will hold off updating for now. Maybe it’s the systemd packages. I see Arch pushed 247.1-3, which we don’t have just yet.

1 Like

It looks (to me) like it is caused by the difference of libc that it is compiled against. (and probably all other programs)

  • On stable i see this:
    >  pacman -Qo /lib/libc-2.32.so                                                                                                
    /usr/lib/libc-2.32.so is owned by glibc 2.32-5
    

Sorry, I made some typos. You need to run gdb sudo in a root shell, then type r ls then enter, and when it dies, type bt and then enter.

I have the same problem using unstable branch but I fixed this switching to testing branch with su -c, and doing downgrade.

2 Likes

The problem is that sudo works fine in a root shell.

# sudo ls
Bilder	Dokumente  Musik       Schreibtisch  Vorlagen
chess	Downloads  Ă–ffentlich  Videos
> sudo ls                                                                  
zsh: segmentation fault (core dumped)  sudo ls

You are not running sudo in a root shell there, you are probably only running ls in a root shell…
(Unless i interpreted your output wrongly ofcourse)

It could also be because of the difference of shell used in the root shell, which is bash…

1 Like

I do not quite understand, if I am root, it is a root shell, right?

~ >>> su                                                                       
Passwort: 
[ms7971 torsten]# sudo ls
Bilder	Dokumente  Musik       Schreibtisch  Vorlagen
chess	Downloads  Ă–ffentlich  Videos
[ms7971 torsten]# whoami
root

No, it is also not due to the shell. Also with bash there is the error.

~ >>> bash -i                                                                  
[torsten@ms7971 ~]$ sudo ls
Speicherzugriffsfehler (Speicherabzug geschrieben)

Ok, just trying to eliminate possibilities…

Since my Update from the systemd today i got the same issue.

~ >>> sudo nano                                                                                                                                                                                              [139]
zsh: segmentation fault (core dumped)  sudo nano
~ >>> bash -i                                                                                                                                                                                                [139]
[matze@matze-amdr5 ~]$ sudo nano
Speicherzugriffsfehler (Speicherabzug geschrieben)

Same problem here

I switched to the Testing branch and downgraded, everything is working fine now.

how do you change the branch without root?

Downgraded systemd?

I solved the issue by downgrading fprintd from 1.90.6-1 -> 1.90.1-1 and libfprint from 1.90.5-1 -> 1.90.3-1.