elementary / os

The OS build system
https://elementary.io
GNU General Public License v3.0
991 stars 131 forks source link

Add MacOS support in docker build script [ Feature Request ] #431

Closed ijiki16 closed 3 years ago

ijiki16 commented 3 years ago

It would be nice to add support macOS to build elementary OS.

I get this error when I'm trying to build:

#------------------#
# LIVE-BUILD BUILD #
#------------------#

[2021-01-07 19:09:16] lb build 
P: live-build 1:20190311
P: Building config tree for a ubuntu/bionic/amd64 system
[2021-01-07 19:09:17] lb bootstrap 
P: Setting up cleanup function
[2021-01-07 19:09:17] lb bootstrap_cache restore
[2021-01-07 19:09:17] lb bootstrap_debootstrap 
P: Begin bootstrapping system...
P: If the following stage fails, the most likely cause of the problem is with your mirror configuration or a caching proxy.
P: Running debootstrap... 
mknod: /working_dir/tmp/amd64/chroot/test-dev-null: Operation not permitted
E: Cannot install into target '/working_dir/tmp/amd64/chroot' mounted with noexec or nodev
P: Begin unmounting filesystems...
P: Saving caches...

Docker can't mount tmp folder from MacOS.

It would be nice if someone added support for macOS or help me to fix this error.

My System

Program

ibnesayeed commented 3 years ago

I think this is a known limitation of Docker for Mac and I found someone else facing similar issues. You can perhaps add a custom Dockerfile in this repo and build it, then copy the artifacts out from that image. This way, you can avoid volume mounting.

davidmhewitt commented 3 years ago

These build scripts are provided as-is and are used to build the released .iso images found on the website and at https://builds.elementary.io .

They are working fine for this purpose, so we have no intention to change them to work around docker limitations on other platforms.

If someone wanted to contribute some changes that fixed this without breaking the rest of the workflow or adding too much complexity, I don't think we'd object. But for now, I'll close this issue as there's no intention to do anything about it.

AwlsomeAlex commented 2 years ago

Hi! The issue you were running into was because of a limitation between the macOS APFS filesystem and Linux (Case sensitiveness). Its pretty easy to workaround by moving your working_dir into a Docker volume, then running the command with that new volume attached. I'm exploring this more on a branch along with two other issues macOS Docker carries.

One of them has to do with networking timeouts when Docker is in bridged mode, and another is general RW speeds when Docker uses Hypervisor.framework instead of Virtualization.framework.

It doesn't require any workflow changes, just alternative commands the user can run. I have it working with ARM64 builds, but need to get my hands on an x86 Mac to see if it carries the same issues.

yozachar commented 8 months ago

Rootless podman build

etc/auto/config

-    --debootstrap-options="--extractor=ar --keyring=/etc/apt/trusted.gpg" \
+    --debootstrap-options="--variant=fakechroot --extractor=ar --keyring=/etc/apt/trusted.gpg" \

build.sh

- apt-get update
- apt-get install -y live-build patch gnupg2 binutils zstd
+ apt-get update && apt-get upgrade -y
+ apt-get install -y --no-install-recommends live-build patch gnupg2 binutils zstd fakechroot fakeroot

...

-   lb build
+   fakechroot fakeroot /bin/bash -c "apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends libpcre3 systemd xz-utils && lb build"

compose.yaml

name: elementaryos

services:
  iso:
    container_name: horus
    image: debian:latest
    volumes:
      - work_dir:/work_dir
      - /proc:/proc
    working_dir: /work_dir
    command: ./build.sh etc/terraform.conf

volumes:
  work_dir:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}
      o: bind

Build

$ podman-compose -f compose.yaml up

Hmm, there's an error:

Setting up libidn2-0:amd64 (2.3.2-2build1) ...
Setting up libgnutls30:amd64 (3.7.3-4ubuntu1) ...
Setting up systemd (249.11-0ubuntu3) ...
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service -> /lib/systemd/system/getty@.service.
Created symlink /etc/systemd/system/multi-user.target.wants/remote-fs.target -> /lib/systemd/system/remote-fs.target.
Created symlink /etc/systemd/system/dbus-org.freedesktop.resolve1.service -> /lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service -> /lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-pstore.service -> /lib/systemd/system/systemd-pstore.service.
systemd-machine-id-setup: error while loading shared libraries: libsystemd-shared-249.so: cannot open shared object file: No such file or directory
dpkg: error processing package systemd (--install):
 installed systemd package post-installation script subprocess returned error exit status 127
Processing triggers for libc-bin (2.35-0ubuntu3) ...

Warning: Fake ldconfig called, doing nothing
Errors were encountered while processing:
 systemd