[Bug 2150073] Re: sudo‑rs causes apt-get (install or upgrade)to be stopped (T+) in a non‑interactive SSH session

KJ LAU 2150073 at bugs.launchpad.net
Mon Apr 27 03:23:37 UTC 2026


download u26.04 image script
  -> called boot_image_via_qemu script
       -> called expect script to launch installer script in guest with sudo priveledge
            -> installer script running in guest


HI Johnsson,  i will start with boot_image_via_qemu script

boot_image_via_qemu.sh:

if [[ -f $1 ]]
then
    if [[ -f OVMF.fd ]] 
    then
	echo "OVMF.fd file present. Continue Launching IMG image"
    else
        echo "Copying OVMF.fd file"
	cp /usr/share/ovmf/OVMF.fd .
	echo "Continue Launching IMG image"
    fi
    sudo qemu-system-x86_64 \
    -enable-kvm \
    -smp $SMP \
    -m $MEMORY \
    -vnc :11 \
    -name test-vm \
    -cpu host \
    -drive if=virtio,format=raw,file=./$1,cache=none \
    -drive file=./OVMF.fd,format=raw,if=pflash \
    -device e1000,netdev=net0,mac=<dummy_mac_address> \
    -netdev user,id=net0,ipv6=off,hostfwd=tcp::4444-:22 \
    -monitor tcp:127.0.0.1:55555,server,nowait \
    -rtc base=localtime -usb & \

    id=`jobs -p`
    echo "Process id for qemu vm $id"

    echo "Sleeping 30 seconds before checking the VM is up"
    sleep 30

    if [[ "$id" != ""  ]]
    then
        echo "Checking whether the localhost with port 4444 is open"
        cmd=`nc -zv localhost 4444 2>&1`
        echo "$cmd"
        if [[ "$cmd" == *"succeeded"* ]]
        then
            echo "VM is launched and port 4444 is open to connect"
	    
        echo "Generate installer script  and initiate the run using sshpass "

	    if [[ -f installer.sh ]]
            then
	        chmod +x installer.sh

		sshpass -vvv -p <Replace with Your Ubuntu 26.04 Guest Password> scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 4444 installer.sh user at localhost:/home/user/
		if [[ -f launch_installer_script.sh ]]
		then
		    ./launch_installer_script.sh $PLATFORM $PROFILE
		else
		    echo "ERROR: launch_installer_script.sh is missing in Host"
		    exit 1
		fi

launch_installer_script.sh a expect script where it executed the sudo
command in u26.04 guest:

launch_installer_script.sh:

if {[llength $argv] != 2} {
    puts "Usage: ./launch_installer_script.sh <platform> <profile>"
    exit 1
}

# Extract arguments
set platform [lindex $argv 0]
set profile [lindex $argv 1]

set prompt "$"
set timeout 4800
set retrycount 10

spawn ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 4444 user at localhost
expect "*?assword" { 
    send "<Replace with Your Ubuntu 26.04 guest password>\r" 
}
expect "*$*" {
    send "ls -la\r"
}
expect "*$*" {
    if {[file exists installer.sh]} { 
	puts "Triggering the installer.sh script"
	send " uname -r > previous_kernel_version.txt \r";
        expect "*$*" {
            send "sudo ./installer.sh $platform $profile 2>&1  | tee installer_logs.txt \r"
        }
    }
}


installer.sh is the script executed in Guest and try install the packages , we can disregard the arguments installer.sh for this issue

installer.sh

function performUpdateNUpgrade()
{
        apt-get update && apt-get upgrade -y
        apt-get install ethtool libbpf1 lm-sensors -y
}

performUpdateNUpgrade

Do note that out the ubuntu image here  is converted from ubuntu iso
from canonical to img with auto installation file where we customized
the user is added to the adm and sudo groups, has an unlocked password
for login, and is allowed to run all commands with sudo without being
prompted for a password.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-sudo-rs in Ubuntu.
https://bugs.launchpad.net/bugs/2150073

Title:
  sudo‑rs causes apt-get (install or upgrade)to be stopped (T+) in a
  non‑interactive SSH session

Status in rust-sudo-rs package in Ubuntu:
  Incomplete

Bug description:
  On Ubuntu 26.04 (where /usr/bin/sudo is implemented via sudo-rs), running apt-get upgrade or install under sudo from a non‑interactive SSH + Expect‑driven environment causes the apt-get process to enter a T+ (stopped) state due to do_signal_stop(), causing the installation to hang indefinitely.
  This problem does not reproduce when replacing sudo-rs with classic sudo (sudo.ws) under identical conditions.

  High level flow:

  Host OS (launcher):
    Ubuntu 22.04 LTS

  Guest OS (QEMU VM):
    Ubuntu 26.04 (daily / pre‑release)

  user at localhost:~$ sudo --version
  sudo-rs 0.2.13-0ubuntu1

  sudo implementation:
    - Failing: sudo-rs (default sudo in Ubuntu 26.04)
    - Working: classic sudo (sudo.ws)

  Invocation context:
    SSH non‑interactive session
    Command chain driven via shell script + Expect
    No human‑attached TTY inside the guest

  Guest OS debug information:

  sudo ps -eo pid,ppid,stat,wchan:32,cmd | egrep 'apt|dpkg|ldconfig' | grep -v grep
     8809    7947 T+   do_signal_stop                   apt-get upgrade -y

  pstree -ap output:

    ├─sshd,3270
    │   ├─sshd-session,3757
    │   │   └─sshd-session,3793
    │   │       └─bash,3799
    │   │           ├─sudo,3960 ./installer.sh ASL default
    │   │           │   └─sudo,3964 ./installer.sh ASL default
    │   │           │       └─installer.sh,3966 /home/user/installer.sh ASL default
    │   │           │           ├─installer.sh,7947 /home/user/installer.sh ASL default
    │   │           │           │   └─apt-get,8809 upgrade -y
    │   │           │           └─tee,7948 -a /home/user/cbkc_output.log
    │   │           └─tee,3961 installer_logs.txt

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-sudo-rs/+bug/2150073/+subscriptions





More information about the foundations-bugs mailing list