Cygwin: Your group is currently…

I just updated my cygwin environment and started receiving following errors upon login to console:

Your group is currently "mkpasswd".  This indicates that your
gid is not in /etc/group and your uid is not in /etc/passwd.

The /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run

mkpasswd -l [-d] > /etc/passwd
mkgroup  -l [-d] > /etc/group

Note that the -d switch is necessary for domain users.

There are actually three variations here – group is mkpasswd, passwd/group_GID_clash(gid/pgsid), or mkgroup

The test causing this is in your .profile:

# If this message keeps appearing and you are sure it's a mistake (ie, don't
#   email about it!), comment out the test below.
case "$(id -ng)" in
mkpasswd )
  echo "Your group is currently \"mkpasswd\".  This indicates that your"
  echo "gid is not in /etc/group and your uid is not in /etc/passwd."
  echo
  echo "The /etc/passwd (and possibly /etc/group) files should be rebuilt."
  echo "See the man pages for mkpasswd and mkgroup then, for example, run"
  echo
  echo "mkpasswd -l [-d] > /etc/passwd"
  echo "mkgroup  -l [-d] > /etc/group"
  echo
  echo "Note that the -d switch is necessary for domain users."
  ;;
passwd/group_GID_clash* )
  echo "Your group is currently \"passwd/group_GID_clash(gid/pgsid)\".  This"
  echo "indicates that your gid is not in /etc/group, but the pgsid (primary "
  echo "group associated with your SID) is in /etc/group."
  echo
  echo "The /etc/passwd (and possibly /etc/group) files should be rebuilt."
  echo "See the man pages for mkpasswd and mkgroup then, for example, run"
  echo
  echo "mkpasswd -l [-d] > /etc/passwd"
  echo "mkgroup  -l [-d] > /etc/group"
  echo
  echo "Note that the -d switch is necessary for domain users."
  ;;
mkgroup )
  echo "Your group is currently \"mkgroup\".  This indicates that neither"
  echo "your gid nor your pgsid (primary group associated with your SID)"
  echo "is in /etc/group."
  echo
  echo "The /etc/group (and possibly /etc/passwd) files should be rebuilt."
  echo "See the man pages for mkpasswd and mkgroup then, for example, run"
  echo
  echo "mkpasswd -l [-d] > /etc/passwd"
  echo "mkgroup  -l [-d] > /etc/group"
  echo
  echo "Note that the -d switch is necessary for domain users."
  ;;
esac

First, note the comments that start this block. Figure that out ;) But to resolve the problem, most will just need to follow the directions by:

$ mkpasswd -l > /etc/passwd
$ mkgroup -l > /etc/group

However, this won’t work if you are in a domain. What the instructions would have you do is use the -d switch (print domain accounts with uid offset offset)
and dump however many groups are defined for your company. This could be dozens or hundreds or thousands, though. Nasty.

So rather than saying what you don’t want, say what you want with -c (print current user).

mkpasswd -c > /etc/passwd
mkgroup -c > /etc/group

That simply takes your own information and puts it in those files.

12 thoughts on “Cygwin: Your group is currently…

  1. The solution using the -c switch worked perfect. It turns out the actual script that does the group check is in /etc/profile on my installation and not and file in my homedir.

  2. I get this:

    $ mkgroup -c > /etc/group
    mkgroup (165): [1789] The trust relationship between this workstation and the primary domain failed.

    Also, FYI, we started receiving the “your group is currently” message without having made any updates.

  3. As said already, but worth repeating… Thanks! I’ve had this problem for years and had just learned to live with it. My files should now be created with the correct user. Awesome.

  4. This is helping people since 2012!!!! Great!!!! Got rid of the annoying message

    one note though:
    $ mkgroup -c > /etc/group
    mkgroup (165): [1789] The trust relationship between this workstation and the primary domain failed.

    It is ’cause you need to be connected to your “office” network for it to work.

  5. Using the -c switch would replace the whole /etc/passwd by just one line, containing information about your own user id. If Cygwin is installed for several users, this would wipe out all the other user data.

What say you?