2

I'm trying to install coreutils on NetBSD 6.1.5 using the pkgsrc system.

This is on the default install of 6.1.5. The only change made has been to install zsh and set it as my default shell for users root and any local users.

As is the pkgsrc way, I change to the directory with the pkgsrc heirachy containing the package I want to install. In this case it is /usr/pkgsrc/sysutils/coreutils

When I enter this directory as root I type

make

and then get an error:

configure: error: you should not run configure as root (set
FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
*** Error code 1

This is not typical when using pkgsrc as root, and seems to be specific to gnu packages, as I have not experienced it with any other package in pkgsrc.

When I do make as a normal user in the same directory I don't have permission to write to any directory under /usr/pkgsrc and make fails due to a bunch of permission denied errors. For example:

sh: Cannot create configure.override: permission denied.

Copying the package directory to somewhere a local user has write permission and compiling would not seem to be in line with using pkgsrc.

Does the user have to be part of a special group to use pkgsrc?

Sonny Ordell
  • 179
  • 1
  • 10
  • Could you show the exact error messages and how are you trying to install them? – Braiam Oct 12 '14 at 20:25
  • Exact error message is permission denied. I can't copy and paste but a screen shot is at http://imgur.com/EimIoxU . I'm going into the directory above and typing make and pressing enter. – Sonny Ordell Oct 12 '14 at 20:30
  • Instead of screnshots just copy and paste your terminal output and [edit] it into your question – Braiam Oct 12 '14 at 20:32
  • @Braiam I can't copy and paste. I'm using NetBSD in a virtual machine and don't have vmware tools setup. Screenshots are the best I can provide. – Sonny Ordell Oct 12 '14 at 20:33
  • mmm... `command > file` then copy the file somewhere? – Braiam Oct 12 '14 at 20:39
  • @Braiam not really possible. Anyway, I would think any user could reproduce the problem easily, as it is something unique to coreutils. I'm doing this on the default install of 6.1.5, no changes have been made. – Sonny Ordell Oct 12 '14 at 21:40
  • Could you edit your question and write the exact steps. I'm following the documentation and I'm not seeing any problem anywhere. – Braiam Oct 12 '14 at 21:59
  • @braiam sure I will edit. I'm just changing to the directory listed in my question and typing 'make'. It fails as both root and a normal user. – Sonny Ordell Oct 12 '14 at 22:02
  • @braiam kind of ridiculous this is on hold, given the question included all the steps needed to reproduce. NetBSD 6.1.5. Default install. Change to /usr/pkgsrc/sysutils and type make as root. Get an error about running as root. Same directory make as a normal user - get permission denied errors. – Sonny Ordell Oct 13 '14 at 05:56
  • @Amphiteót I'm new to NetBSD. What I had read indicated that to use pkgsrc, I should make and make install within the pkgsrc directory. Is this incorrect? – Sonny Ordell Oct 13 '14 at 07:02
  • @Amphiteót I know that, it's just that pkgsrc seems to require making within the /usr/pkgsrc hierarchy, which I don't want to grant a user write access to. – Sonny Ordell Oct 13 '14 at 12:52
  • The answer is that the coreutils and gnuls packages (gnuls is a subset of coreutils) seem to have bugs when trying to install with pkgsrc. The answer is to set the appropriate override and install as root. Of course I can't set this as the answer, because the question has been marked as on hold without merit. – Sonny Ordell Oct 13 '14 at 18:27
  • @Braiam I don't know if you are a moderator here or not, but I would like to see about getting this questioned reopened. You may not have understood the question, but it is clear enough and I have an answer I would like to post to help others. – Sonny Ordell Oct 16 '14 at 05:35
  • Thanks for editing; I remember this Unix I once tried and it had _pkgadd_ and also some unique way of dealing with the sources etc. –  Oct 18 '14 at 09:35

2 Answers2

5

Try the command indicated in the error message:

export FORCE_UNSAFE_CONFIGURE=1 && make

This being said, it is true the "unsafe configure" requirement seems a bit strange. Double-check the log (config.log) and see if there is something more explicit in there.

Fn0rd
  • 66
  • 1
  • I've marked your answer as correct, as it is the only way to get around it. pkgsrc requires being root and I'm sure the pkgsrc maintainers take that into account. The behaviour of the GNU software in pkgsrc is a bug, which I've reported. – Sonny Ordell Oct 16 '14 at 17:43
2

Alternately, read doc/pkgsrc.txt, and look at for WRKOBJDIR. Set it (in /etc/mk.conf) to a directory that is writable as the non-priviledged user you're wishing to build as.

The pkgsrc infrastructure will prompt for the root users password when it comes time to install the package you built.

HalosGhost
  • 4,732
  • 10
  • 33
  • 41