Sample Header Ad - 728x90

"sudo" prompts for password in terminal that has started "agetty ttyS0 9600" instead of the "serial" terminal

3 votes
1 answer
191 views
Broader context, I'm using QEMU+KVM to virtualize an ubuntu machine like this:
qemu-system-x86_64 \
    -enable-kvm \
    -m 2048 \
    -nic none \
    -vnc :5 \
    -hda test-vm.raw \
    -device vfio-pci,host=01:00.0 \
    -serial unix:/tmp/console.sock,server,nowait
I'm using /tmp/console.sock to login into the virtual machine via "serial": socat stdin,raw,echo=0,escape=0x11 "unix-connect:/tmp/console.sock" This works without any major problems. However, when I'm entering sudo su the prompt for the password appears on the terminal that has started the agetty process (not the serial console). I know that starting agetty from a terminal isn't how you would start it normally. However, I'm very curious as to how this happens and how I can start agetty from the terminal without it having _any_ connection (sudo asking for the password on the terminal that has started agetty leads me to believe that there _is_ some connection) to the terminal that has started it. I already tried:
$ nohup agetty ttyS0 9600 &
$ disown
Without success. Would love to know the underlying mechanic that is at play here and how I can possibly remedy the issue*. *As said, I know that starting agetty from a normal terminal isn't how you would use the program. I'm still interested in how this happens and how you could prevent agetty from acting this way.
Asked by Marco (158 rep)
Oct 30, 2023, 06:51 PM
Last activity: Oct 31, 2023, 12:59 PM