1

I compiled coreutils with --sysconfdir=/test/etc instead of default /etc, moved /etc/group to /test/etc/group, and chgrp failed with

chgrp: invalid group: $groupname.

How can I fix that and make chgrp work with new sysconfdir?

John Militer
  • 773
  • 4
  • 14
  • 29

1 Answers1

1

Recompiling coreutils to look for /etc/group and other files in a different place won't change the fact that most of the system still expects to find those files in the standard places. In your case, you are noticing that the part of libc responsible for looking up groups and other objects in system database, which is nss_files, continues to look for groups in the standard place.

If you want to change the location where /etc/group and a lot of other very basic configuration files live, you'll have to recompile libc6 and probably a lot of other things. Almost certainly, many parts of the system (init scripts come to mind) are hardcoded to use /etc, and none of this has been tested so you are likely to find bugs even if you succeed in this ambitious task.

Celada
  • 43,173
  • 5
  • 96
  • 105
  • I am compiling linux from scratch, so I am ready to compile all packages. Can you tell me what exactly I should recompile and with which options to make chgrp work? Is it only glibc? – Vsh Fbvsfvs Mar 27 '16 at 20:22
  • It is almost certainly not just glibc. As I already pointed out, you are likely to find that this is such a non-standard thing to do that, if you try to do this, there are doing to be hardcoded references to `/etc` everywhere and plenty of bugs. Just.... don't. – Celada Mar 27 '16 at 20:24