Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #261884

Re: apt-get aborts in subshell with redirections on Debian 12

From John Crawley <john@bunsenlabs.org>
Newsgroups linux.debian.user
Subject Re: apt-get aborts in subshell with redirections on Debian 12
Date 2023-09-25 06:40 +0200
Message-ID <HhLy1-bmTS-1@gated-at.bofh.it> (permalink)
References (2 earlier) <HhwyZ-bdIW-5@gated-at.bofh.it> <HhHup-bkoN-1@gated-at.bofh.it> <HhHNM-bkuD-3@gated-at.bofh.it> <HhJZf-blOm-3@gated-at.bofh.it> <HhKLD-bmjt-1@gated-at.bofh.it>
Organization BunsenLabs

Show all headers | View raw


On 25/09/2023 12:42, Greg Wooledge wrote:
> On Mon, Sep 25, 2023 at 11:58:13AM +0900, John Crawley wrote:
>> adduser tmp
>> adduser tmp sudo
>>
>> Log in to tmp (no graphical session set up), and the results are the same: behaviour in a bash shell is wrong, everything else works.
> 
> I simply can't reproduce your results at all.

This is so weird. There's probably some simple explanation somewhere...

I have a freshly installed Bookworm netinstall CLI system among my VMs. Only "standard system utilities" added during the install process. Restored the just-after-install snapshot, did an apt update/upgrade, and:

$ id
uid=1000(john) gid=1000(john) groups=1000(john),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),106(netdev)

Is there a hint here? Those are the default groups I was put in by the Debian Installer, but it's a much longer list than yours.

Anyway 'errors=$(sudo apt-get install mirage 2>&1 1>/dev/tty)' wrote a long list of dependencies (of course) but then aborted as usual.

> This leaves me very confused.  There's something different about your
> systems compared to mine (and the other person who also could not
> reproduce your results), but damned if I can guess *what*.
> 
> The only other experiment I can think of at this time would be:
> 
> 4) In a bash shell as root (e.g. "su" or "sudo -s"), do:
> 
>     errors=$(apt-get install mirage 2>&1 1>/dev/tty)

-bash: syntax error near unexpected token `2'

So bash as root has a problem with the redirection.

But this worked OK in the same root shell:

exec 3>1
errors=$( apt-get install mirage 2>&1 1>&3 )
exec 3>&-

If 'mirage' is replaced with 'mirag' then $errors holds the error message.

So at least something is working!

Maybe it is an issue with sudo?

> I can generate the *message* that you get by redirecting stdin:
> 
> But there's nothing you've shown that's redirecting stdin, so I don't
> know whether this is what's causing your problem or not.  If it *is*
> what's causing your problem, I still don't have a clue what's *doing*
> it.
> 
> Is there any unusual configuration of sudo on your system?  Sudo
> configuration is utterly baffling, and about 2 orders of magnitude more
> stupidly complex than it should be, so I don't even know what kind of
> atrocities are *possible* in sudoers, let alone which of them might be
> capable of doing something insane like closing stdin on commands run
> via sudo.  But if you've changed anything in sudoers or sudoers.d you
> might want to report on those changes.

No. Those last tests were done on a freshly installed Bookworm netinstall VM, no changes apart from apt updating.

> (But why would this only happen when sudo's parent is bash?  None of
> this makes *any* sense.)

I just hope I haven't been making an awful stupid mistake all along...

-- 
John

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-24 09:40 +0200
  Re: apt-get aborts in subshell with redirections on Debian 12 Michel Verdier <mv524@free.fr> - 2023-09-24 12:10 +0200
    Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-24 14:40 +0200
      Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 02:20 +0200
        Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 02:40 +0200
          Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:00 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 05:20 +0200
            Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 05:50 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-25 06:40 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 04:40 +0200
              Re: apt-get aborts in subshell with redirections on Debian 12 Michael <ml@hemathor.de> - 2023-09-25 11:20 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-25 13:30 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:00 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 Greg Wooledge <greg@wooledge.org> - 2023-09-26 05:10 +0200
                Re: apt-get aborts in subshell with redirections on Debian 12 John Crawley <john@bunsenlabs.org> - 2023-09-26 05:20 +0200
                sudo+use_pty+urxvt+pipe [WAS: apt-get aborts in subshell with  redirections on Debian 12] John Crawley <john@bunsenlabs.org> - 2023-12-24 09:50 +0100

csiph-web