Sudo command issue

I noticed that, if you run any command with sudo, for example, sudo whoami, and on the password prompt you hit either CTRL+X or CTRL+C, it completely breaks sudo for me.

It starts saying that my password is invalid, and only a hard restart or some other way to reset the auth stack fixes it.

sudo logs:
root ; COMMAND=/usr/bin/cp -r build/esp/EFI build/esp/Orionix /mnt/esp/
May 16 20:21:27 iusearchbtw sudo[173203]: pam_unix(sudo:auth): conversation failed
May 16 20:21:27 iusearchbtw sudo[173203]: pam_unix(sudo:auth): auth could not identify password for [uchstalker]
May 16 20:21:29 iusearchbtw sudo[173203]: uchstalker : 2 incorrect password attempts ; TTY=pts/3 ; PWD=/mnt/storage/Development/Projects/OrionixOS ; USER
=root ; COMMAND=/usr/bin/mkdir -p /mnt/esp
May 16 20:21:31 iusearchbtw sudo[173294]: pam_unix(sudo:auth): authentication failure; logname=uchstalker uid=1000 euid=0 tty=/dev/pts/3 ruser=uchstalker
rhost= user=uchstalker
May 16 20:21:38 iusearchbtw sudo[173294]: uchstalker : 3 incorrect password attempts ; TTY=pts/3 ; PWD=/mnt/storage/Development/Projects/OrionixOS ; USER
=root ; COMMAND=/usr/bin/mount esp.img /mnt/esp
May 16 20:21:38 iusearchbtw sudo[173347]: pam_unix(sudo:auth): conversation failed
May 16 20:21:38 iusearchbtw sudo[173347]: pam_unix(sudo:auth): auth could not identify password for [uchstalker]
May 16 20:24:44 iusearchbtw sudo[173907]: pam_unix(sudo:auth): conversation failed
May 16 20:24:44 iusearchbtw sudo[173907]: pam_unix(sudo:auth): auth could not identify password for [uchstalker]

A fascinating insight into someone who uses CachyOS but inserts the phrase ‘iusearchbtw’.

One would hope you realise CachyOS is not actually Arch.

I think you’re also confused about Ctrl+X - that’s not a standard terminal control character like C or D.

SIGINT is an ‘impolite’ exit.

Never use Ctrl+C or Ctrl+X at the password prompt. use Ctrl+D instead.

My understanding is that Ctrl+D sends an EOF (end-of-file) signal.

And/or this could be seen as ending the input stream.

This might exit something.
Such as an interactive shell.
It might also wrap up accepting new info but then continue processing something.

So I am not sure we can consider it a reliable way to end things in general.
Though where applicable it would be more graceful than an interrupt.

cachyos is based on archlinux, so technically i can say it.

also, i have literally zero clue on how this happens, but for me its recreatable, and it happens specifically when i press ctrl+c & ctrl+x in the sudo password input, breaks something with the auth system that as far as i know is only fixable by restarting the system.

thats not the issue tho.

the issue isn’t that it breaks the current sudo input.

it breaks the global sudo input. after it happens, sudo will no matter what and how accept my correct password that other commands like su or the login UI do accept.

‘Technically’ isn’t a qualifier for using the misleading comment ‘I use Arch’ when you actually use CachyOS.

So you’re using ‘technically’ to dismiss any added value of CachyOS as a distribution - as if it’s just a theme or a script for Arch installation.

That’s like saying ‘Ubuntu is just Debian’.

Understood - My comment was mainly replying to the mention of Ctrl+D.

As far as your described issue… I cannot reproduce;

We might need some more info like .. which shell? was sudoers file every edited?

  1. sudoers file was edited in an attempt to fix the issue, but not before.
  2. fish shell
  3. i was able to reproduce it once again, it happens specifically with this command:
    dd if=/dev/zero of=esp.img bs=1M count=64
    mkfs.fat -F32 esp.img
    sudo mkdir -p /mnt/esp
    sudo mount esp.img /mnt/esp
    sudo cp -r build/esp/* /mnt/esp/
    sudo umount /mnt/esp
  4. i figured out that it was caused by this combination: spamming ctrl+x / ctrl+c while hitting enter

note that on the sudo whoami i made sure to enter the correct password that works everywhere else lik su or login screen. i only tested it in VSCode so far but i dont think its VSCode causing this.

edit: by “only tested it in VSCode” i mean i only ran the initial command in VSCode. The sudo command broke globally accross all consoles, new and old, and TTY as well.

~ on  master [✘!] 
❯ sudo ls
[sudo] password for matt: 
^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^C^X^Csudo: a password is required
^X
~ on  master [✘!] took 3s 
❯ 

Not able to reproduce it here sorry.

@cscs - yep, CTRL-D sends EOF, which quits the prompt faster than CTRL-C/SIGINT:

~ on  master [✘!] 
❯ sudo ls
[sudo] password for matt: 
sudo: no password was provided
sudo: a password is required

~ on  master [✘!] took 2s 
❯ 

i’m pretty sure its specifically with how the command i mentioned is formed, like multiple sudo prompts stacked.

so i found out what is happening.

I was able to replicate this on both my and my friend’s system, and my friend’s system was a fresh install.

This happens only with multi-line commands, for example:

sudo echo “Hello World!”\
sudo echo “Hello World!”\
sudo echo “Hello World!”

… when the first password prompt appears, spamming Ctrl+X and Ctrl+C before hitting enter causes this bug of breaking sudo globally.

I did a bit of trolling on him with this and made him restart :slight_smile:

This might be a really big issue not just within CachyOS, i’ll try on some other distros in a VM.
its not persisten but its annoying