cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.56k stars 259 forks source link

Curl seem not to be able to download Packages while composer install ( curl error 23 while downloading ) #1185

Closed SGrimmel closed 1 week ago

SGrimmel commented 2 weeks ago

Describe the bug

In some of our buildScripts we need to install phpPackages via composer. Same error via $ devenv shell composer install

I updated the host System on MacOs Sonoma 14.4.1 and as well Devenv to vers 1.0.5.

After upgrading the hostSystem and reinstalling everything, following error appears in composer install:

curl error 23 while downloading https://packages.shopware.com/packages.json: Failed writing received data to disk/application

Upgrade/downgrading curl did not work as well.

To reproduce https://gist.github.com/SGrimmel/d40fad0a03537f5fe4d6c69bb58707a3

Version

Paste the output of $ devenv version here or tell us if you're using flakes.

devenv 1.0.5 (aarch64-darwin)

(devenv) bash-5.2$ df -h Filesystem Size Used Avail Use% Mounted on /dev/disk3s1s1 927G 202G 725G 22% / /dev/disk3s6 927G 202G 725G 22% /System/Volumes/VM /dev/disk3s2 927G 202G 725G 22% /System/Volumes/Preboot /dev/disk3s4 927G 202G 725G 22% /System/Volumes/Update /dev/disk1s2 500M 20M 481M 4% /System/Volumes/xarts /dev/disk1s1 500M 20M 481M 4% /System/Volumes/iSCPreboot /dev/disk1s3 500M 20M 481M 4% /System/Volumes/Hardware /dev/disk3s7 927G 202G 725G 22% /nix

Seem to be as well no diskProblem

sandydoo commented 2 weeks ago

Can you still write to the /nix directory after the upgrade? Maybe it's become read-only.

SGrimmel commented 2 weeks ago

Was as well my fist guess. It is not working even if i chmod 777 the whole directory.

ls -al /nix/ total 0 drwxrwxrwx 5 root nixbld 160 Mar 5 13:51 . drwxr-xr-x 20 root wheel 640 Mar 21 07:13 .. d-wx--x--t 3 root wheel 96 Aug 18 2023 .Trashes drwxrwxrwx 13303 root nixbld 425696 May 3 15:47 store drwxrwxrwx 4 root nixbld 128 Mar 5 13:51 var

have as well inserted me as trusted user and tried to run commands as root.

sandydoo commented 2 weeks ago

By write access I meant whether you can run successfully run sudo touch /nix/hello, but this all looks fine (minus the new permissions).

(devenv) bash-5.2$ composer install No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information. Loading composer repositories with package information Cannot create cache directory /Users/xxx.xxx/Library/Caches/composer/repo/https---packages.shopware.com/, or directory is not writable. Proceeding without cache. See also cache-read-only config if your filesystem is read-only.

In CurlDownloader.php line 364:

curl error 23 while downloading https://packages.shopware.com/packages.json: Failed writing received data to disk/application

I misread the issue. I initially thought you were getting this error from Nix itself (it also uses libcurl). But this clearly an error with composer itself. https://github.com/composer/composer/issues/11913

If the fix is to upgrade/downgrade curl, then you have two options:

  1. Roll back to an older version of nixpkgs in devenv.yaml where curl+composer work.
  2. Override the library used by composer. You might be able to do something like:
    {
      languages.php.packages.composer = languages.php.package.packages.composer.override { curl = ... };
    }
SGrimmel commented 1 week ago

Fixed with the latest nixpkgs release on 05.06.2024. After devenv update the packages are updated an Error is not reproducable anymore. Thx for your engagement @sandydoo !