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

Ubuntu Global Update Failure #8455

Closed
malic0 opened this issue Nov 29, 2019 · 10 comments
Labels

Comments

@malic0
Copy link

@malic0 malic0 commented Nov 29, 2019

Hello.

Am currently running composer on Ubuntu

When I run this command:

composer global update

I get the following output:

Changed current directory to /home/user/.composer
Composer could not find a composer.json file in /home/user/.composer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

Since, I'm working Ubuntu (Linux), I expected composer to change directory ~/user/.config/composer but instead its tries to use ~/user/.composer which is the default path in MacOS.

@s3b4stian

This comment has been minimized.

Copy link

@s3b4stian s3b4stian commented Nov 29, 2019

Hello, same problem, with all types of update (global update, update, selfupdate)

I tried with echo "{}" > ~/.composer/composer.json for create new global composer.json and error message disappears but composer still doesn't work :(

After using -vvv I saw that there is a problem (no more feedback, composer seems freezed) during the download of packages information:

sebastian@ubuntu_virtual18_04:~/html/framework$ composer global update -vvv
Changed current directory to /home/sebastian/.composer
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/sebastian/.composer): git branch --no-color --no-abbrev -v
Executing command (/home/sebastian/.composer): git describe --exact-match --tags
Executing command (/home/sebastian/.composer): git log --pretty="%H" -n1 HEAD
Executing command (/home/sebastian/.composer): hg branch
Executing command (/home/sebastian/.composer): fossil branch list
Executing command (/home/sebastian/.composer): fossil tag list
Executing command (/home/sebastian/.composer): svn info --xml
Running 1.9.1 (2019-11-01 17:20:17) with PHP 7.4.0 on Linux / 4.15.0-70-generic
Loading composer repositories with package information
Downloading https://repo.packagist.org/packages.json

same problem with composer diagnose -vvv but an exception appear:

sebastian@ubuntu_virtual18_04:~/html/framework$ composer diagnose -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/sebastian/html/framework): git branch --no-color --no-abbrev -v
Reading /home/sebastian/.composer/composer.json
Loading config file /home/sebastian/.composer/composer.json
Reading /home/sebastian/html/framework/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Running 1.9.1 (2019-11-01 17:20:17) with PHP 7.4.0 on Linux / 4.15.0-70-generic
Checking composer.json: Reading ./composer.json
OK
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
OK
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[Composer\Downloader\TransportException] The "http://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json

I tried to download manually packages.json, with wget doesn't download, with browser and curl works. I already saw with curl in verbose mode that TLS version for https://repo.packagist.org is 1.3.

Could TLS 1.3 create problems to download?

@s3b4stian

This comment has been minimized.

Copy link

@s3b4stian s3b4stian commented Nov 29, 2019

Problem isn't TLS version because with self-update composer try to connect to https://getcomposer.org/versions and behavior is the same.

@malic0

This comment has been minimized.

Copy link
Author

@malic0 malic0 commented Nov 30, 2019

Hello, same problem, with all types of update (global update, update, selfupdate)

I tried with echo "{}" > ~/.composer/composer.json for create new global composer.json and error message disappears but composer still doesn't work :(

After using -vvv I saw that there is a problem (no more feedback, composer seems freezed) during the download of packages information:

sebastian@ubuntu_virtual18_04:~/html/framework$ composer global update -vvv
Changed current directory to /home/sebastian/.composer
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/sebastian/.composer): git branch --no-color --no-abbrev -v
Executing command (/home/sebastian/.composer): git describe --exact-match --tags
Executing command (/home/sebastian/.composer): git log --pretty="%H" -n1 HEAD
Executing command (/home/sebastian/.composer): hg branch
Executing command (/home/sebastian/.composer): fossil branch list
Executing command (/home/sebastian/.composer): fossil tag list
Executing command (/home/sebastian/.composer): svn info --xml
Running 1.9.1 (2019-11-01 17:20:17) with PHP 7.4.0 on Linux / 4.15.0-70-generic
Loading composer repositories with package information
Downloading https://repo.packagist.org/packages.json

same problem with composer diagnose -vvv but an exception appear:

sebastian@ubuntu_virtual18_04:~/html/framework$ composer diagnose -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/sebastian/html/framework): git branch --no-color --no-abbrev -v
Reading /home/sebastian/.composer/composer.json
Loading config file /home/sebastian/.composer/composer.json
Reading /home/sebastian/html/framework/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Running 1.9.1 (2019-11-01 17:20:17) with PHP 7.4.0 on Linux / 4.15.0-70-generic
Checking composer.json: Reading ./composer.json
OK
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
OK
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[Composer\Downloader\TransportException] The "http://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json

I tried to download manually packages.json, with wget doesn't download, with browser and curl works. I already saw with curl in verbose mode that TLS version for https://repo.packagist.org is 1.3.

Could TLS 1.3 create problems to download?

NO I don't think so. I think its just a bug with Linux version of composer

@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Dec 2, 2019

@malic0 can you provide the output of env from your shell?

@alcohol alcohol added the Support label Dec 2, 2019
@malic0

This comment has been minimized.

Copy link
Author

@malic0 malic0 commented Dec 2, 2019

@alcohol
Here you go

GJS_DEBUG_TOPICS=JS ERROR;JS LOG
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SESSION_MANAGER=local/malico:@/tmp/.ICE-unix/1366,unix/malico:/tmp/.ICE-unix/1366
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/c0c3aa0d_1c65_495b_8703_6fcfbb41f62e
SSH_AGENT_PID=1486
XDG_CURRENT_DESKTOP=ubuntu:GNOME
LANG=en_US.UTF-8
DISPLAY=:0
PWD=/home/malico/code
QT_IM_MODULE=xim
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
USER=malico
GJS_DEBUG_OUTPUT=stderr
XDG_MENU_PREFIX=gnome-
DESKTOP_SESSION=ubuntu
HOME=/home/malico
QT4_IM_MODULE=xim
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_VTNR=2
XDG_SEAT=seat0
GTK_MODULES=gail:atk-bridge
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
GTK_IM_MODULE=ibus
XDG_SESSION_DESKTOP=ubuntu
WINDOWPATH=2
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
CLUTTER_IM_MODULE=xim
LOGNAME=malico
GNOME_TERMINAL_SERVICE=:1.185
VTE_VERSION=5602
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/malico/.config/composer/vendor/bin
XDG_RUNTIME_DIR=/run/user/1000
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XMODIFIERS=@im=ibus
SHELL=/usr/bin/zsh
XDG_SESSION_TYPE=x11
XDG_SESSION_ID=2
QT_ACCESSIBILITY=1
USERNAME=malico
GNOME_SHELL_SESSION_MODE=ubuntu
SHLVL=1
XAUTHORITY=/run/user/1000/gdm/Xauthority
COLORTERM=truecolor
IM_CONFIG_PHASE=2
TERM=xterm-256color
GDMSESSION=ubuntu
XDG_SESSION_CLASS=user
OLDPWD=/home/malico/code/malico
ZSH=/home/malico/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
SPACESHIP_VERSION=3.11.2
SPACESHIP_ROOT=/home/malico/.oh-my-zsh/custom/themes/spaceship-prompt
_=/usr/bin/env
@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Dec 3, 2019

You have all the XDG_ variables except the ones we rely on:

  • XDG_CONFIG_HOME
  • XDG_CACHE_HOME
  • XDG_DATA_HOME

See also https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Since you do not have the required XDG_ variables in your environment, we default to our old-style $HOME/.composer directory.

@alcohol alcohol closed this Dec 3, 2019
@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Dec 3, 2019

Though on the other hand,

/**
* @return bool
*/
private static function useXdg()
{
foreach (array_keys($_SERVER) as $key) {
if (substr($key, 0, 4) === 'XDG_') {
return true;
}
}
return false;
}
returns true in your scenario.

@alcohol alcohol reopened this Dec 3, 2019
@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Dec 3, 2019

Ah, but if $HOME/.composer actually exists, this takes precedence over the aforementioned, according to line 69-72 here:

/**
* @throws \RuntimeException
* @return string
*/
protected static function getHomeDir()
{
$home = getenv('COMPOSER_HOME');
if ($home) {
return $home;
}
if (Platform::isWindows()) {
if (!getenv('APPDATA')) {
throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
}
return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
}
$userDir = self::getUserDir();
if (is_dir($userDir . '/.composer')) {
return $userDir . '/.composer';
}
if (self::useXdg()) {
// XDG Base Directory Specifications
$xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
return $xdgConfig . '/composer';
}
return $userDir . '/.composer';
}

@alcohol alcohol closed this Dec 3, 2019
@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Dec 3, 2019

I recommend you remove $HOME/.composer, this should resolve your issue.

@malic0

This comment has been minimized.

Copy link
Author

@malic0 malic0 commented Dec 4, 2019

I recommend you remove $HOME/.composer, this should resolve your issue.

Thanks @alcohol.
This worked.

Another work around I used, you can just move to $HOME/.config/composer and run composer update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.