lxc-gentoo icon indicating copy to clipboard operation
lxc-gentoo copied to clipboard

OSX missing flock

Open globalcitizen opened this issue 8 years ago • 5 comments

Because flock is unavailable, weird errors occur when executing on OSX. This could probably be resolved with a fallback, either to some alternative locking mechanism such as something dodgy and built-in, or no locking at all.

Attempting to obtain an exclusive lock (timeout: 30 min) named "amd64_amd64_rootfs"...
./lxc-gentoo: line 87: printf: `(': invalid format character
./lxc-gentoo: line 88: flock: command not found
./lxc-gentoo: line 91: printf: `(': invalid format character
./lxc-gentoo: line 91: - : syntax error: operand expected (error token is " ")

globalcitizen avatar Feb 01 '16 12:02 globalcitizen

I wonder if it would be possible to, if flock is not found, alias flock to something emulating its behavior (possibly somewhat dangerously) as well as outputting a big bold warning, in order to avoid the problem of complicating the code for the normal, flock-present case. Possibly even an alias to a special execution mode of the script itself.

globalcitizen avatar Feb 01 '16 13:02 globalcitizen

Linux containers on OS X? What.

specing avatar Feb 01 '16 13:02 specing

Yes, it sounds weird. Let me explain.

  • We already aim to be portable beyond Gentoo Linux to other Linuxes as the LXC host
  • Some kind of BSD will probably have some form of Linux emulation and/or container emulation that makes Gentoo images useful there soon (if not already)
  • The bulk of the code (just not the generated lxc.conf output) is very useful for other cases such as docker image generation, which is basically just running docker (a go binary) on any platform with a couple of arguments, docker import - or similar (IIRC). Which can happen on OSX.

globalcitizen avatar Feb 01 '16 14:02 globalcitizen

Docker directly depends on features of Linux kernel, the same as LXC and others. How can it natively run on Darwin kernel that doesn’t support these features? The only way I know about is booting Linux VM on VirtualBox or other paravirtualization technology and running Docker inside it.

jirutka avatar Feb 01 '16 15:02 jirutka

@jirutka Docker is normally run on OSX exactly as you just described.

globalcitizen avatar Feb 02 '16 02:02 globalcitizen