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


Groups > linux.debian.user > #167096 > unrolled thread

Installation of openssh-client stops with error in groupadd

Started byMichael Luecke <ml2016@mluecke.eu>
First post2016-04-25 22:00 +0200
Last post2016-04-27 20:40 +0200
Articles 10 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  Installation of openssh-client stops with error in groupadd Michael Luecke <ml2016@mluecke.eu> - 2016-04-25 22:00 +0200
    Re: Installation of openssh-client stops with error in groupadd <tomas@tuxteam.de> - 2016-04-25 22:10 +0200
    Re: Installation of openssh-client stops with error in groupadd Reco <recoverym4n@gmail.com> - 2016-04-25 22:10 +0200
      Re: Installation of openssh-client stops with error in groupadd Reco <recoverym4n@gmail.com> - 2016-04-25 23:00 +0200
        Re: Installation of openssh-client stops with error in groupadd Michael Luecke <ml@mluecke.eu> - 2016-04-26 19:50 +0200
          Re: Installation of openssh-client stops with error in groupadd Reco <recoverym4n@gmail.com> - 2016-04-26 20:10 +0200
            Re: Installation of openssh-client stops with error in groupadd Michael Luecke <ml@mluecke.eu> - 2016-04-26 20:40 +0200
              Re: Installation of openssh-client stops with error in groupadd Reco <recoverym4n@gmail.com> - 2016-04-26 21:00 +0200
                Re: Installation of openssh-client stops with error in groupadd Michael Luecke <lists-2016@mluecke.eu> - 2016-04-26 21:10 +0200
                  Re: Installation of openssh-client stops with error in groupadd Michael Luecke <ml@mluecke.eu> - 2016-04-27 20:40 +0200

#167096 — Installation of openssh-client stops with error in groupadd

FromMichael Luecke <ml2016@mluecke.eu>
Date2016-04-25 22:00 +0200
SubjectInstallation of openssh-client stops with error in groupadd
Message-ID<rrUPM-2VC-11@gated-at.bofh.it>
Hello,

I have a fresh installation of Debian jessie. As I wanted to install 
'openssh-client' it stops with an error in groupadd. It seems that I 
cannot add any groups, because I get the error also when I try to add 
the group manually. In /etc there are two files, group and group+. Their 
difference is the ssh group I and apt tried to add before.

++++++++++++++++++++++++++++++
michael@michael-wst:~$ sudo apt-get install openssh-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
   ssh-askpass libpam-ssh keychain monkeysphere
The following NEW packages will be installed:
   openssh-client
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 691 kB of archives.
After this operation, 3,765 kB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main openssh-client 
amd64 1:6.7p1-5+deb8u2 [691 kB]
Fetched 691 kB in 0s (2,823 kB/s)
Selecting previously unselected package openssh-client.
(Reading database ... 57582 files and directories currently installed.)
Preparing to unpack .../openssh-client_1%3a6.7p1-5+deb8u2_amd64.deb ...
Unpacking openssh-client (1:6.7p1-5+deb8u2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up openssh-client (1:6.7p1-5+deb8u2) ...
groupadd: failure while writing changes to /etc/group
addgroup: `/usr/sbin/groupadd -g 117 ssh' returned error code 10. Exiting.
dpkg: error processing package openssh-client (--configure):
  subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
  openssh-client
E: Sub-process /usr/bin/dpkg returned an error code (1)
++++++++++++++++++++++++++++++
root@michael-wst:/etc# /usr/sbin/groupadd -g 117 ssh
groupadd: failure while writing changes to /etc/group
++++++++++++++++++++++++++++++
root@michael-wst:/etc# ls -lh group*
-rw-r--r-- 1 root root 813 Apr 25 20:45 group
-rw------- 1 root root 813 Apr 25 20:45 group-
-rw-r--r-- 1 root root 824 Apr 25 21:27 group+
++++++++++++++++++++++++++++++
root@michael-wst:/etc# diff group group+
56a57
 > ssh:x:117:
++++++++++++++++++++++++++++++

//Michael

[toc] | [next] | [standalone]


#167097

From<tomas@tuxteam.de>
Date2016-04-25 22:10 +0200
Message-ID<rrUZs-3iQ-11@gated-at.bofh.it>
In reply to#167096
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Apr 25, 2016 at 09:33:45PM +0200, Michael Luecke wrote:
> Hello,
> 
> I have a fresh installation of Debian jessie. As I wanted to install
> 'openssh-client' it stops with an error in groupadd [...]
[...]
> groupadd: failure while writing changes to /etc/group
> addgroup: `/usr/sbin/groupadd -g 117 ssh' returned error code 10. Exiting.
> dpkg: error processing package openssh-client (--configure):

Three things come to mind:

  - the file system might be mounted read-only (perhaps as a consequence
    of errors). Mount -a would give the answer

  - the file(s) might have the immutable attribute set. You can find that
    out by doing an "lsattr /etc/group*"

  - some SELinux policy is playing games on you. On this, I must defer to
    more knowledgeable folks

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlceeJ8ACgkQBcgs9XrR2kbe2QCcD6E4sIBJ+3hetjQ+9QvyWoqb
tEcAnApAXFq7ffey4QBiPJahlOyCUZMg
=2OUd
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#167098

FromReco <recoverym4n@gmail.com>
Date2016-04-25 22:10 +0200
Message-ID<rrUZu-3iQ-63@gated-at.bofh.it>
In reply to#167096
	Hi.

On Mon, 25 Apr 2016 21:33:45 +0200
Michael Luecke <ml2016@mluecke.eu> wrote:

> Hello,
> 
> I have a fresh installation of Debian jessie. As I wanted to install 
> 'openssh-client' it stops with an error in groupadd. It seems that I 
> cannot add any groups, because I get the error also when I try to add 
> the group manually. In /etc there are two files, group and group+. Their 
> difference is the ssh group I and apt tried to add before.
...
> groupadd: failure while writing changes to /etc/group
> addgroup: `/usr/sbin/groupadd -g 117 ssh' returned error code 10. Exiting.

Please post the output of:

strace /usr/sbin/groupadd -g 117 ssh

mount

dmesg | tail

lsattr /etc/group

Reco

[toc] | [prev] | [next] | [standalone]


#167099

FromReco <recoverym4n@gmail.com>
Date2016-04-25 23:00 +0200
Message-ID<rrVLR-3EY-25@gated-at.bofh.it>
In reply to#167098
	Hi.

On Mon, 25 Apr 2016 22:38:47 +0200
Michael Luecke <ml2016@mluecke.eu> wrote:

So, it all goes well, until it hits the wall:

>  > Please post the output of:
> ...
> 
> rename("/etc/group+", "/etc/group")     = -1 EBUSY (Device or resource busy)

And this is another thing that could be useful to the future searches
of the archives:

> # mount
...
> /dev/sda3 on / type btrfs (rw,noatime,ssd,space_cache)


> ++++++++++++++++++++++++++++++
> # dmesg | tail
...

Does not have any scary 'force mounting / read-only', so it should be
all good.


> # lsattr /etc/group
> ---------------- /etc/group

And no extended attributes (or SELinux, which is confirmed by strace
output) come into play.


So it all boils down to one failing syscall - rename(2). The manpage
does not cover such case - it talks about returning EBUSY if the source
or the target of rename are mountpoints (clearly not the case here).

So, let's start with something simple:

/bin/fuser /etc/group

/usr/bin/lsof /etc/group

Reco

[toc] | [prev] | [next] | [standalone]


#167119

FromMichael Luecke <ml@mluecke.eu>
Date2016-04-26 19:50 +0200
Message-ID<rsfhw-3db-9@gated-at.bofh.it>
In reply to#167099
Hi,

as I restarted my computer today. I wanted to install lsof via apt-get 
and at least it configured openssh-client without failure. So I thought 
that problem fixed itself, but it didn't.

I tried to add another group manually so I typed as root:

# groupadd -g 1234 test
groupadd: failure while writing changes to /etc/group

and

# strace groupadd -g 1234 test
showed the known error:
...
rename("/etc/group+", "/etc/group") = -1 EBUSY (Device or resource busy)

On 04/25/2016 10:57 PM, Reco wrote:
 > /bin/fuser /etc/group
# fuser /etc/group
[ no output ]

 > /usr/bin/lsof /etc/group
# lsof /etc/group
[ no output ]

//Michael

[toc] | [prev] | [next] | [standalone]


#167121

FromReco <recoverym4n@gmail.com>
Date2016-04-26 20:10 +0200
Message-ID<rsfAS-3CZ-21@gated-at.bofh.it>
In reply to#167119
	Hi.

On Tue, 26 Apr 2016 19:25:48 +0200
Michael Luecke <ml@mluecke.eu> wrote:

> Hi,
> 
> as I restarted my computer today. I wanted to install lsof via apt-get 
> and at least it configured openssh-client without failure. So I thought 
> that problem fixed itself, but it didn't.
> 
> I tried to add another group manually so I typed as root:
> 
> # groupadd -g 1234 test
> groupadd: failure while writing changes to /etc/group
> 
> and
> 
> # strace groupadd -g 1234 test
> showed the known error:
> ...
> rename("/etc/group+", "/etc/group") = -1 EBUSY (Device or resource busy)
> 
> On 04/25/2016 10:57 PM, Reco wrote:
>  > /bin/fuser /etc/group
> # fuser /etc/group
> [ no output ]
> 
>  > /usr/bin/lsof /etc/group
> # lsof /etc/group
> [ no output ]

Ok, then we'll have to do it hard way. Basically I want to make sure
that it's btrfs fault, not some mount output anomaly that hides
bind-mounted /etc/group.

unshare -m /bin/bash
mount -o bind / /mnt
mount -o bind /proc /mnt/proc
mount -o bind /dev /mnt/dev
chroot /mnt
strace groupadd -g 1234 test
exit
exit

'exit' should be done twice, first time to exit chroot, second time to
exit detached mount namespace.

Reco

[toc] | [prev] | [next] | [standalone]


#167123

FromMichael Luecke <ml@mluecke.eu>
Date2016-04-26 20:40 +0200
Message-ID<rsg3V-3Yf-35@gated-at.bofh.it>
In reply to#167121

[Multipart message — attachments visible in raw view] — view raw

Hi,

I've done your commands:

On 04/26/2016 08:04 PM, Reco wrote:
 > unshare -m /bin/bash
 > mount -o bind / /mnt
 > mount -o bind /proc /mnt/proc
 > mount -o bind /dev /mnt/dev
 > chroot /mnt
Without failure until here.

 > strace groupadd -g 1234 test
The known failure again:
rename("/etc/group+", "/etc/group") = -1 EBUSY (Device or resource busy)

 > exit
 > exit

Thank you for your patient help. I attached the complete strace output.

//Michael

[toc] | [prev] | [next] | [standalone]


#167126

FromReco <recoverym4n@gmail.com>
Date2016-04-26 21:00 +0200
Message-ID<rsgnh-46z-37@gated-at.bofh.it>
In reply to#167123
	Hi.

On Tue, 26 Apr 2016 20:14:38 +0200
Michael Luecke <ml@mluecke.eu> wrote:

> Hi,
> 
> I've done your commands:
> 
> On 04/26/2016 08:04 PM, Reco wrote:
>  > unshare -m /bin/bash
>  > mount -o bind / /mnt
>  > mount -o bind /proc /mnt/proc
>  > mount -o bind /dev /mnt/dev
>  > chroot /mnt
> Without failure until here.

Just as planned :)

>  > strace groupadd -g 1234 test
> The known failure again:
> rename("/etc/group+", "/etc/group") = -1 EBUSY (Device or resource busy)
> 
>  > exit
>  > exit
> 
> Thank you for your patient help. I attached the complete strace output.

Looks more-or-less the same as previous attempt. Moreover,

open("/etc/group+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
umask(022)                              = 0777
fchown(5, 0, 0)                         = 0
fchmod(5, 0644)                         = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
...
lstat("/etc/group", {st_mode=S_IFREG|0644, st_size=824, ...}) = 0
rename("/etc/group+", "/etc/group")     = -1 EBUSY

lstat shows that both /etc/group and /etc/group+ are regular files.

For the sake of the purity of the experiment, it would be nice to reboot
the system with "init=/bin/sh" added to kernel commandline (to exclude
systemd interference), but I foresee that the result would be the same.


So, to sum it up. Your current kernel + root filesystem combo prevents
you to overwrite /etc/group (and I suspect any existing file) with
another file by means of conventional rename(2) syscall, which returns
anomalous return code.
My gut feeling tells me that one should blame filesystem (btrfs)
implementation in cases such as this.
This behavior justifies a bug report with severity 'serious' against
'linux-image' package as I don't see any easy way to fix this short of
kernel patch or replacing the filesystem with something more
conventional (ext4 comes to mind).

Reco

[toc] | [prev] | [next] | [standalone]


#167127

FromMichael Luecke <lists-2016@mluecke.eu>
Date2016-04-26 21:10 +0200
Message-ID<rsgwW-4xy-21@gated-at.bofh.it>
In reply to#167126
Hello,

On 04/26/2016 08:54 PM, Reco wrote:
> For the sake of the purity of the experiment, it would be nice to reboot
> the system with "init=/bin/sh" added to kernel commandline (to exclude
> systemd interference), but I foresee that the result would be the same.
I'll try this if I have a little bit time and come back to this topic then.

> So, to sum it up. Your current kernel + root filesystem combo prevents
> you to overwrite /etc/group (and I suspect any existing file) with
> another file by means of conventional rename(2) syscall, which returns
> anomalous return code.
> My gut feeling tells me that one should blame filesystem (btrfs)
> implementation in cases such as this.
> This behavior justifies a bug report with severity 'serious' against
> 'linux-image' package as I don't see any easy way to fix this short of
> kernel patch or replacing the filesystem with something more
> conventional (ext4 comes to mind).
I'll prepare a bug-report also. As this is a freshly set-up computer, 
I'll also try to reinstall it with ext4.

So thank you for your help until here.

Best regards
Michael

[toc] | [prev] | [next] | [standalone]


#167158

FromMichael Luecke <ml@mluecke.eu>
Date2016-04-27 20:40 +0200
Message-ID<rsCxu-5Ye-59@gated-at.bofh.it>
In reply to#167127
Hi,

On 04/26/2016 09:03 PM, Michael Luecke wrote:
>> My gut feeling tells me that one should blame filesystem (btrfs)
>> implementation in cases such as this.

It's nothing to blame btrfs for, the same thing happens at this system 
with ext4.

Sent a bug-report. Bug#822808

Best regards
Michael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web