pkg icon indicating copy to clipboard operation
pkg copied to clipboard

`pkg -c` is broken: Cannot open /dev/null

Open emersion opened this issue 6 years ago • 6 comments

Using pkg -c results in:

pkg: Cannot open /dev/null:No such file or directory

/dev/null is not available inside the chroot.

Full logs: https://builds.sr.ht/~sircmpwn/job/70073 (list of all failures: https://builds.sr.ht/~sircmpwn/freebsd)

I believe this is the commit that has introduced the regression: https://github.com/freebsd/pkg/commit/4cbe4573c8f5534e402651828f7140d39a315066

What would be the best way to fix this?

emersion avatar Jun 16 '19 18:06 emersion

this is not a bug, this is expected, poudriere has been patched to add the proper mounting, any other script should mount devfs before callign pkg -c then unmount it

bapt avatar Jun 17 '19 08:06 bapt

All right. Is there anything else to mount?

emersion avatar Jun 17 '19 18:06 emersion

nope, just devfs

bapt avatar Jun 18 '19 08:06 bapt

@bapt , I disagree and I think that it is, maybe not a bug, but certainly a problem. The same problem also exists with pkg -r. I think that it is easy to open /dev/null in the host environment and then use that file descriptor whenever pkg wants to spawn a child with one of its standard file descriptors redirected to /dev/null. Maybe pkg -c was created specifically for poudriere but there can be other reasonable uses and installing into a chroot does not imply that the chroot must have devfs mounted (unlike a jail).

avg-I avatar Dec 11 '19 09:12 avg-I

By the way, Panzura build process uses both pkg -c and pkg -r.

avg-I avatar Dec 11 '19 09:12 avg-I

after making some thought we could open /dev/null at the very beginning (before chroot) and then use that each time we need /dev/null. Any patch in that direction would be accepted

bapt avatar Dec 12 '19 20:12 bapt