Thanks Bryce for the PPA. I can confirm it does work:

# reproduce the problem:
root@sudo-sru-lp1857036-test:~# sudo true
sudo: setrlimit(RLIMIT_CORE): Operation not permitted

# get the fix from the PPA:
root@sudo-sru-lp1857036-test:~# apt-add-repository -yus 
Get:1 focal-security InRelease [107 kB]
focal InRelease [17.6 kB]                   
Hit:3 focal InRelease                          
Get:4 focal-updates InRelease [111 kB]
focal/main Sources [864 B]
focal/main amd64 Packages [756 B]   
focal/main Translation-en [528 B]
Get:8 focal-updates/main amd64 Packages [261 
Get:9 focal-updates/main Translation-en [102 
Get:10 focal-updates/restricted amd64 Packages 
[28.4 kB]
Get:11 focal-updates/restricted Translation-en 
[7,560 B]
Fetched 637 kB in 2s (389 kB/s)                                    
Reading package lists... Done
root@sudo-sru-lp1857036-test:~# apt-get install -V sudo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
   sudo (1.8.31-1ubuntu1 => 1.8.31-1ubuntu2~focal1)
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,320 kB of archives.
After this operation, 1,849 kB of additional disk space will be used.
focal/main amd64 sudo amd64 1.8.31-1ubuntu2~focal1 [1,320 kB]
Fetched 1,320 kB in 3s (495 kB/s)
(Reading database ... 16712 files and directories currently installed.)
Preparing to unpack .../sudo_1.8.31-1ubuntu2~focal1_amd64.deb ...
Unpacking sudo (1.8.31-1ubuntu2~focal1) over (1.8.31-1ubuntu1) ...
Setting up sudo (1.8.31-1ubuntu2~focal1) ...

# confirm the fix:
root@sudo-sru-lp1857036-test:~# sudo true

You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to sudo in Ubuntu.

  `sudo --login --user USERNAME` throws `setrlimit(RLIMIT_CORE):
  Operation not permitted` error when run inside a container.

Status in sudo package in Ubuntu:
  Fix Released
Status in sudo source package in Focal:
  Fix Committed
Status in sudo source package in Groovy:
  Fix Released

Bug description:
  Logging in as a sudo user in a Ubuntu Focal Linux container displays a

    sudo: setrlimit(RLIMIT_CORE): Operation not permitted

  The warning is entirely unnecessary - the container is trying to adjust
  RLIMIT_CORE, but this isn't allowed inside a container anyway.

  While this is "just" a warning, logging into a container as sudo is a
  very common practice, so this warning risks creating confusion for LTS

  [Test Case]
  $ lxc launch ubuntu:20.04/amd64 sudo-sru-lp1857036-test
  $ lxc shell sudo-sru-lp1857036-test

  # sudo --login --user ubuntu
  sudo: setrlimit(RLIMIT_CORE): Operation not permitted
  To run a command as administrator (user "root"), use "sudo <command>".
  See "man sudo_root" for details.
  $ logout

  Install the PPA
  # apt-add-repository -yus ppa:bryce/sudo-sru-lp1857036-setrlimit-in-lxc
  # apt-get install sudo

  # sudo --login --user ubuntu

  [Regression Potential]
  As this only affects printing of a couple warnings, the only behavioral
  change is in stderr output.

  This changes a couple warnings into equivalent debug printfs, which
  brings the sudo behavior in-line with the behavior in groovy, bionic,
  etc. and should cause no troubles.

  This patch originates from upstream, and is already in groovy's sudo
  package (which thus can be seen not to exhibit the issue).

  The upstream patch includes some new debug prints which should be
  harmless but are unnecessary to the fix so they've been removed.

  [Original Report]
  When using `sudo --login --user USERNAME` with Ubuntu Focal currently, it 
will correctly operate but it will also throw the following error before 
continuing with the logon process (which completes successfully except for the 
stated error):

  sudo: setrlimit(RLIMIT_CORE): Operation not permitted

  A full run of this was tested in a Focal LXD container after dropping
  to a root shell to reproduce (arstotzka is the host system, focal-test
  is the test container):

  teward@arstotzka:~$ lxc shell focal-test
  root@focal-test:~# sudo --login --user ubuntu
  sudo: setrlimit(RLIMIT_CORE): Operation not permitted
  To run a command as administrator (user "root"), use "sudo <command>".
  See "man sudo_root" for details.


  This appears to be similar to this issue identified on RedHat's

  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: sudo 1.8.29-1ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18
  Uname: Linux 4.15.0-72-generic x86_64
  ApportVersion: 2.20.11-0ubuntu14
  Architecture: amd64
  Date: Thu Dec 19 17:16:31 2019
   PATH=(custom, no user)
  SourcePackage: sudo
  UpgradeStatus: No upgrade log present (probably fresh install)
   /etc/sudoers: parsed OK
   /etc/sudoers.d/90-cloud-init-users: parsed OK
   /etc/sudoers.d/README: parsed OK

To manage notifications about this bug go to:

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to