Sudo error: double free or corruption (out)

hi guys,

just did a fresh install of ubuntu mate 22.04 but unable to sudo
$ sudo passwd root
double free or corruption (out)
Aborted (core dumped)

it gives error above whenever i try to sudo, any fix/ work around?

system:
Kernel Linux 5.15.0-39-generic x86_64
Release 22.04 LTS (Jammy Jellyfish) 64-bit
MATE 1.26.0

`pkexec mate-terminal' this command fix it, it seems

As a user, you should just type sudo su to become root (the prompt changes to #).
You do what you do, then exit and you 're back as regular user.

user@lake:~$ sudo su
[sudo] password for user:     
root@lake:/home/user# bla-bla
bla-bla: command not found
root@lake:/home/user# exit
exit
user@lake:~$
1 Like

i spoke too soon, it's still not working.
the problem persist, every time i try sudo, it give same error.
can someone help? this is really troublesome.

$ sudo su
double free or corruption (out)
Aborted (core dumped)

Type id ... and post. Are you a member of the (27) sudo group?

i think so.

$ id
uid=1000(leo) gid=1000(leo) groups=1000(leo),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),121(lpadmin),135(lxd),136(sambashare)
am i suppose to be in the wheel group?

or should i put my own name below the root?

cat /etc/sudoers

User privilege specification

root ALL=(ALL:ALL) ALL

You are a member of the sudo group but more importantly, did you mess up with the /etc/sudoers file???

A default configuration will allow users who belong to the sudo group to execute commands.

If you want to do so without being prompted, yes, you need a line at the end,
leo ALL=(ALL:ALL) ALL
there should be a TAB after leo.

no, i didn't touch the /etc/sudoers at all.
i tried put leo ALL=(ALL:ALL) ALL after root but is still not working.

i enabled sudo_debug & sudoers_debug but can't see anything useful (unable to upload it here).

could it be not a group membership problem? even as root, the error came up as soon as i type sudo and press enter ...
"#sudo
double free or corruption (out)
Aborted (core dumped)"

i tried reinstall sudo also not working.
any other suggestions?

i just did a reinstallation of the OS.
immediately after the new installation, sudo works fine,
but after i updated the new system with apt upgrade, sudo gives this error:
double free or corruption (out)
Aborted (core dumped)

clearly, the new updates broke the sudo program, is this a bug???

I did a fresh install of um22.04 on a Lenovo laptop.

sudo apt update, sudo apt upgrade, sudo reboot all worked without issues.

did you have the same problem after installing all system updates?

No, I can do sudo apt update all day long, no issues.

I found a very old bugreport on debian about the same type of error which doesn't seem to have been fixed .
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565552

It might be triggered by wrong permissions. The right permissions would be 0440

That old bug seems also to be triggered easily by, for instance, a wrong character in one of the lines in /etc/sudoers

I don't think it's unthinkable that it could be triggered by VMS/Windows line endings (CR-LF).

OTOH. I might be completely wrong about this.
@pavlos_kairis , what do you think ? Could it be possible ?

I think it is pretty scary if a simple mistake in a configfile could trigger this kind of error.

1 Like

/etc/sudoers is a sensitive file and a simple mistake can render your system without sudo.

I leave it alone. In your case, you want to add user leo so that you're not prompted for pw.

You created a file /etc/sudoers.d/custom and in custom you put the line
leo ALL=(ALL) NOPASSWD: ALL
(again, there is a TAB after leo)

Am I correct so far?

this is getting a bit too complicated & i haven't got time for it,
doas is a good alternative to sudo ....

I am also getting the same problem, don't know why. I was ill for one month, and shut down my laptop for one month after that now, when I opened it, and want to run this command, shocking as no any sudo command is runnning
like as :
sudo apt update
double free or corruption (out)
Aborted (core dumped)

1 Like

Still I haven't fixed it, can anyone help me in this

Welcome @Muhib_Arshad to the community!

Thanks, but can you help me in this error