Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kirkhadden's avatar

Laravel Sail Fails to Build

Hello friends, I'm hoping someone can help out a Laravel beginner here. I've got my Laravel App installed and configured, but when I run sail up, the script fails when it gets to RUN apt-get update. It keeps reporting File has unexpected size as it tries to download ubuntu files. The only thing I've been able to find online about this is that occasionally you may run into this error as a mirror updates, but this has been going on for a week now. Is there a way around this?

 => ERROR [ 4/12] RUN 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  4.6s
------                                                                                                                                                                                                                                                         
 > [ 4/12] RUN 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/*:
#7 1.119 Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
#7 1.499 Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
#7 1.648 Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
#7 1.800 Get:4 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
#7 1.807 Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
#7 1.808 Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
#7 2.003 Get:7 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [328 kB]
#7 2.003 Err:7 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages
#7 2.003   File has unexpected size (13211 != 327835). Mirror sync in progress? [IP: 91.189.91.38 80]
#7 2.003   Hashes of expected file:
#7 2.003    - Filesize:327835 [weak]
#7 2.003    - SHA256:272a26f7fac9bb8428b57f5fad3eaa8257c18e4b3297156a8557e611055f4ddd
#7 2.003    - SHA1:3b280605a2925472191cc10033e9bb3f36c12403 [weak]
#7 2.003    - MD5Sum:05ecd233535590f76fbe9f1cc6b8ba36 [weak]
#7 2.003   Release file created at: Tue, 15 Jun 2021 15:15:22 +0000
#7 2.270 Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [879 kB]
#7 2.271 Err:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
#7 2.271   
#7 2.569 Get:9 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.6 kB]
#7 2.569 Err:9 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages
#7 2.569   
#7 2.803 Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [729 kB]
#7 3.016 Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
#7 3.073 Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
#7 3.100 Get:13 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [32.0 kB]
#7 3.103 Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [355 kB]
#7 3.123 Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1299 kB]
#7 3.205 Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [979 kB]
#7 3.274 Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [4305 B]
#7 3.830 Fetched 16.8 MB in 3s (5119 kB/s)
#7 3.830 Reading package lists...
#7 4.481 E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/restricted/binary-amd64/by-hash/SHA256/272a26f7fac9bb8428b57f5fad3eaa8257c18e4b3297156a8557e611055f4ddd  File has unexpected size (13211 != 327835). Mirror sync in progress? [IP: 91.189.91.38 80]
#7 4.481    Hashes of expected file:
#7 4.481     - Filesize:327835 [weak]
#7 4.481     - SHA256:272a26f7fac9bb8428b57f5fad3eaa8257c18e4b3297156a8557e611055f4ddd
#7 4.481     - SHA1:3b280605a2925472191cc10033e9bb3f36c12403 [weak]
#7 4.481     - MD5Sum:05ecd233535590f76fbe9f1cc6b8ba36 [weak]
#7 4.481    Release file created at: Tue, 15 Jun 2021 15:15:22 +0000
#7 4.481 E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/main/binary-amd64/by-hash/SHA256/f7dbc9c126d447342363358fe9d297940e5a558cad93d1e4783f9fa4976e68f2  
#7 4.481 E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/multiverse/binary-amd64/by-hash/SHA256/0a2e329f9b4ebc73b384d0d820c61ae00953c599c5c15cdd91ec451fa42a4a93  
#7 4.481 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
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: 100
ERROR: Service 'laravel.test' failed to build
0 likes
4 replies
kirkhadden's avatar

Turns out, my Mac had random screen time restrictions against ubuntu. With those restrictions turned off I was able to get passed this issue, only to run straight into another. Now, when I run sail up, I'm getting Hash Sum mismatch errors. What is strange is that it isn't always the same files.

#7 53.89 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb  Hash Sum mismatch
#7 53.89    Hashes of expected file:
#7 53.89     - SHA256:4e624c616de0fa1dea3571291b05b3d6fe5f75d8667b278f9503b1eca36ffbcf
#7 53.89     - SHA1:9fdbb019a3acae4e7975467e5c62522c99360f27 [weak]
#7 53.89     - MD5Sum:f476458937adb11f22614e2ec6a2b79b [weak]
#7 53.89     - Filesize:81132 [weak]
#7 53.89    Hashes of received file:
#7 53.89     - SHA256:1a4b7231ae2ca12b1cb49440303d861d10aa4e8cc012c0e18075932c1bdc5def
#7 53.89     - SHA1:492f78d07be068d2d6c08e034e0dad908becc318 [weak]
#7 53.89     - MD5Sum:97ed9c563afe26c570fd26a761685f1b [weak]
#7 53.89     - Filesize:81132 [weak]
#7 53.89    Last modification reported: Wed, 26 Feb 2020 08:58:26 +0000
#7 53.89 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/readline/readline-common_8.0-4_all.deb  Bad header line Bad header data [IP: 91.189.88.142 80]
#7 53.89 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/libpython2.7-stdlib_2.7.18-1~20.04.1_amd64.deb  Hash Sum mismatch
#7 53.89    Hashes of expected file:
#7 53.89     - SHA512:b8fcecd1df2759164345f6029c38e74b6e4cbc519c9ce9d8a1224f00c67f7fb96bc07962b7537080db4f8fec32f231f7338935e946e77df1f6ebf78c95aeec19
#7 53.89     - SHA256:c99d14ce605083af02df15a22c0edae667e34f16c9eff98b863d49832bb3dc53
#7 53.89     - SHA1:15240c976f1441be39b5ca46978708238b4862f2 [weak]
#7 53.89     - MD5Sum:4d17e5a7ab2517d919e4f69d827d36c7 [weak]
#7 53.89     - Filesize:1886764 [weak]
#7 53.89    Hashes of received file:
#7 53.89     - SHA512:ba0810a6bcd1145d1498957a431dd911b9741a95a9f34008f6a107993ab191ccee1320be24ffe958666832cd352534e8cd4cb8c7425b13f5b447c0191fca9910
#7 53.89     - SHA256:1d121d887b15cb8e51139674e9947f5a8491650fbc1b6c691b11ae67a2625c8b
#7 53.89     - SHA1:88db305a5511366b3257931a233b493a5fae124d [weak]
#7 53.89     - MD5Sum:1f53e4f3aeeb87aed602ed500b6a58be [weak]
#7 53.89     - Filesize:1886764 [weak]
#7 53.89    Last modification reported: Thu, 11 Mar 2021 20:18:47 +0000
1 like
kirkhadden's avatar

I'm still stuck here. The internet seems to suggest it can be a local network issue, but I've tried at my house, I've tried at the office, and I've tried on my phone's hotspot.

Based on this thread from Ask Ubuntu (https://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error), I added apt-get clean and rm -rf /var/lib/apt/lists/* to the docker file, and tried using a different release of Ubuntu, but I'm not getting passed this hang up.

I'm really hoping someone out there can at least point me in the right direction.

codyrigg's avatar
codyrigg
Best Answer
Level 1

I had this issue. I was able to solve it by restarting after turning off content restriction in screen time.

2 likes

Please or to participate in this conversation.