nodesource/distributions

Can't populate Ubuntu repos via script

ogonkov opened this issue · 12 comments

What is the problem here?

I already have nodejs installed via Ubuntu repos

$ curl -sL https://deb.nodesource.com/setup | sudo bash -
[sudo] password for myUser: 

## Populating apt-get cache...

# my repos list

## Confirming "trusty" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node/dists/trusty/Release'

## Your distribution, identified as "trusty", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

The issue also affect Linux Mint qiana:

## You seem to be using Linux Mint version qiana.
## This maps to Ubuntu "trusty"... Adjusting for you...

## Confirming "trusty" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node/dists/trusty/Release'

## Your distribution, identified as "trusty", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

@ogonkov @jaundavid could you both run this for me please:

curl -sL 'https://deb.nodesource.com/node/dists/trusty/Release'

And let me know if you get text back from that.

I'm suspecting a temporary hiccup here given that there's been some work on there today.

@rvagg yes I get text back, but until today the error persist:

curl -sL 'https://deb.nodesource.com/node/dists/trusty/Release'
Origin: Node Source
Label: Node Source
Codename: trusty
Date: Wed, 17 Sep 2014 05:11:22 UTC
Architectures: i386 amd64 armhf
Components: main
Description: Apt Repository for Node.JS
MD5Sum:
 51fb19e7249fd86881da6abe97047d41 2202 main/binary-i386/Packages
 08ecdc1b7784ddcc3fdb537454e1e5c7 920 main/binary-i386/Packages.gz
 858bcc6f092bf9a62b95ec25133a16fc 114 main/binary-i386/Release
 dfe1fd13c11a805d26ce3fd53db283a6 2206 main/binary-amd64/Packages
 bce44ed505dd320518b780c543f28b0b 918 main/binary-amd64/Packages.gz
 ebcbc5a586d54ca7a0899d0cbc5cdab5 115 main/binary-amd64/Release
 3e6095d9138eb8ba6a8273f19cb9f254 2206 main/binary-armhf/Packages
 af113bb86907ef2f81e1ad003b696fb9 924 main/binary-armhf/Packages.gz
 721cd7a3a302487ca2b1dca9e74258c3 115 main/binary-armhf/Release
 5350311578bc0a368f26858b74889126 1326 main/source/Sources
 6d1700638c7ef6462e711c528010d6b1 676 main/source/Sources.gz
 c1ddc3434e3b1071bb4049689446e8a8 116 main/source/Release
SHA1:
 e71dec5affc130dc154d9f29776b170d7142b34f 2202 main/binary-i386/Packages
 ab1e59b27183ca266d4d7d7dee47ace799484279 920 main/binary-i386/Packages.gz
 babad9e9ef91e8e9f25072469cb3cacf37c1eeb2 114 main/binary-i386/Release
 9a117acee35bcca9e320fe33e13a347bb7fe3d74 2206 main/binary-amd64/Packages
 2dd3a3724906595a08e32a61a8df4d918e8acead 918 main/binary-amd64/Packages.gz
 034ed7854f4ef3fe3bba8a19c2a8e0a735312580 115 main/binary-amd64/Release
 f8027c32f92453f4a50607dd5054e6e79e25e136 2206 main/binary-armhf/Packages
 8d557d6eca17742c949a6562566f32adc2d9a08e 924 main/binary-armhf/Packages.gz
 e1a4368c7c97d93c775eb481da4f975ff00ca98b 115 main/binary-armhf/Release
 74942bf6c19202220cd518f92cfc80f2d4f5f806 1326 main/source/Sources
 0fd1c6a3b8987cec3b0c1e13ec5db3cec74709a3 676 main/source/Sources.gz
 a722052b58db6ccc3213b13f5c854cd7a7f4ab4d 116 main/source/Release
SHA256:
 dddd6ad0748a8fc936826ab644018687d6191968e3ddc18d01720843f8214d6b 2202 main/binary-i386/Packages
 eee397f5b0a79afe5d61e4ba91bba09d59d977df64b92cb1499faff9b6ccda4c 920 main/binary-i386/Packages.gz
 f7cb044aad412645efd0863f196d77112315034f96097fa4649dfeaffc975882 114 main/binary-i386/Release
 7c5f00a089086c89eaa472e619894514155f62812b085035dd1678c94e36a737 2206 main/binary-amd64/Packages
 6035e52877018f226017b29f8c03fa10441e77516020bf0d5d0274cd0b7f439f 918 main/binary-amd64/Packages.gz
 94b5ac1474328b250dda1f9c2d3c6faef49be577e2d040a3bf82539416b7e590 115 main/binary-amd64/Release
 e41371aa8239306aad81c76a83eab0633490ba27b9fd18d53334a1476f16784d 2206 main/binary-armhf/Packages
 5558c0511133aaffa3a16a064465dea673479e4c6aa34932744c9de0632a1c74 924 main/binary-armhf/Packages.gz
 f506560ef59c0cfe16e7c22f6cfd5e97d1e522878b9713eb9e64b201f26caed0 115 main/binary-armhf/Release
 4343c4a9d46e00d6fb0f737bebc4b53af23b9ddb2333521ecc8bce11b439ba5e 1326 main/source/Sources
 b39a08dd32866113c7a37f05792125e0e8fdcaa331e02143f57ab880cdc907ff 676 main/source/Sources.gz
 d22c7052b7fed518c59760fc426ce1cccc44ec595a8d91aa544f3acd623f2297 116 main/source/Release

Hm. I just run again

curl -sL https://deb.nodesource.com/setup | sudo bash -

And seems it's worked. I will try it tomorrow at my work, but at my personal laptop, with already installed node v0.10.25, with same Ubuntu version it's worked perfectly.

I notice that script run faster this time. At my previous try it stuck a lot, before i get

## Your distribution, identified as "trusty", is not currently supported

So may be it was some network problem?

I just ran into this myself when behind a proxy. The http_proxy and https_proxy environment variables are not retained in the first sudo session makes the curl call inside the downloaded script fail.
You could add them to "sudo visudo" like instructed in https://help.ubuntu.com/community/EnvironmentVariables#sudo_caveat

Defaults env_keep += "http_proxy https_proxy"

worked for me

Very interesting solution @terkiterje, thanks!

I think we could achieve same effect running sudo -E bash -. Will test it tomorrow.

sudo does understand env vars as arguments. To get around messing with sudoers you can also do something like sudo [http_proxy=...] [https_proxy=...] bash -

Another approach might be to rewrite the script to do sudo only where needed, instead of relying on having a working curl as root obtained through sudo. Seems like best practice to run the least amount of shellscript as root anyway.

For me the @terkiterje solution has worked ;)

@jaundavid, adding the sudo -E option is the simpler solution I guess, but I believe it is better to move the sudo operations inside the script where they are needed. I have created a pull request that also make any curl errors visible to the user: #22

The "only run as root when required" is a nice aim and I'm happy to shoot for that, it's just non-trivial given the involvement of Debian and situations where sudo may not exist or be wired up properly.

I quite like the way the Docker guys do it, see https://get.docker.io/ and look for the sh_c env var they set up and use.

rvagg commented

instructions on the README now have sudo -E listed