Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault error with Docker on Apple silicon/Arm64 #162

Closed
SamuelMwangiW opened this issue Jun 17, 2021 · 8 comments
Closed

Segmentation fault error with Docker on Apple silicon/Arm64 #162

SamuelMwangiW opened this issue Jun 17, 2021 · 8 comments

Comments

@SamuelMwangiW
Copy link
Contributor

SamuelMwangiW commented Jun 17, 2021

  • Sail Version: v1.8.1
  • Laravel Version: v8.47.0
  • PHP Version: 8.0.7
  • OS: macOS 11.4 on M1

Description:

I am documenting a notorious error specific to docker on Arm that results to apt-key failing with the error below:

#7 167.8 The following NEW packages will be installed:
#7 167.8   nodejs
#7 169.6 0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
#7 169.6 Need to get 25.3 MB of archives.
#7 169.6 After this operation, 119 MB of additional disk space will be used.
#7 169.6 Get:1 https://deb.nodesource.com/node_16.x focal/main arm64 nodejs arm64 16.3.0-deb-1nodesource1 [25.3 MB]
#7 194.1 debconf: delaying package configuration, since apt-utils is not installed
#7 194.1 Fetched 25.3 MB in 26s (968 kB/s)
#7 194.2 Selecting previously unselected package nodejs.
(Reading database ... 21562 files and directories currently installed.)
#7 194.2 Preparing to unpack .../nodejs_16.3.0-deb-1nodesource1_arm64.deb ...
#7 194.2 Unpacking nodejs (16.3.0-deb-1nodesource1) ...
#7 195.8 Setting up nodejs (16.3.0-deb-1nodesource1) ...
#7 195.8 Processing triggers for man-db (2.9.1-1) ...
#7 195.8 Warning: apt-key output should not be parsed (stdout is not a terminal)
#7 197.3 gpg: no valid OpenPGP data found.
#7 197.3 Segmentation fault
------
executor failed running [/bin/sh -c apt-get update     && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2     && mkdir -p ~/.gnupg     && chmod 600 ~/.gnupg     && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C     && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list     && apt-get update     && apt-get install -y php8.0-cli php8.0-dev        php8.0-pgsql php8.0-sqlite3 php8.0-gd        php8.0-curl php8.0-memcached        php8.0-imap php8.0-mysql php8.0-mbstring        php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap        php8.0-intl php8.0-readline        php8.0-msgpack php8.0-igbinary php8.0-ldap        php8.0-redis     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && curl -sL https://deb.nodesource.com/setup_16.x | bash -     && apt-get install -y nodejs     && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -     && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list     && apt-get update     && apt-get install -y yarn     && apt-get install -y mysql-client     && apt-get install -y postgresql-client     && apt-get -y autoremove     && apt-get clean     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*]: exit code: 2
ERROR: Service 'laravel.test' failed to build : Build failed

The failure occurs at the following line in the Dockerfile:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 

My Solution

Publish the sail assets by running php artisan sail:publish and delete the following lines the published Dockerfile:

&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
    && apt-get update \
    && apt-get install -y yarn \

As a consequence, you will loose access to running yarn via the sail container but as an alternative you can always access npm that comes bundled with nodejs and you can verify this by running sail npm --v

I understand that the issue is not specific to Laravel Sail and will close it immediately but are posting it here hoping to assist a future user who may discover it via an issue search or good old Google

Steps To Reproduce:

On an M1 iMac, run the following:

curl https://laravel.build/laravel | sh
cd laravel
./vendor/bin/sail up -d --build 
@DougThwaites
Copy link

Thanks @SamuelMwangiW helped me :)

@SamuelMwangiW
Copy link
Contributor Author

@DougThwaites awesome!! Hope as support for Docker on arm64 improves, these kinks get worked out. Glad to have helped

@driesvints
Copy link
Member

Hey @SamuelMwangiW. Would appreciate a PR to the docs if you're willing. Thanks!

@SamuelMwangiW
Copy link
Contributor Author

Will gladly do so. Thanks

@dannpl
Copy link

dannpl commented Jun 19, 2021

Thanks 😊

@supermavster
Copy link

supermavster commented Sep 16, 2022

Thanks @SamuelMwangiW, only a note:

If you already have a project just do this:

cd YOU_PROJECT
curl https://laravel.build/laravel | sh
cd laravel
./vendor/bin/sail up -d --build 
./vendor/bin/sail down
cd ..
rm -rf vendor 
cp -r laravel/vendor vendor
./vendor/bin/sail up --build

The same commands, only copy the vendor folder at your project. 🚀

@SamuelMwangiW
Copy link
Contributor Author

@supermavster this has since been fixed in #169 and haven't experienced it in a long time.

Thanks for your offer to assist, much appreciated

@supermavster
Copy link

@supermavster this has since been fixed in #169 and haven't experienced it in a long time.

Thanks for your offer to assist, much appreciated

Ah okey sorry I don't know about that, thanks again :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants