How to install snap packages behind web proxy on Ubuntu 16.04












20















I know how to configure APT to use a web proxy. But what about snap?










share|improve this question



























    20















    I know how to configure APT to use a web proxy. But what about snap?










    share|improve this question

























      20












      20








      20


      5






      I know how to configure APT to use a web proxy. But what about snap?










      share|improve this question














      I know how to configure APT to use a web proxy. But what about snap?







      16.04 proxy snap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 28 '16 at 22:42









      Carlos EstradaCarlos Estrada

      2022311




      2022311






















          6 Answers
          6






          active

          oldest

          votes


















          17














          snapd reads /etc/environment, so setting the usual proxy environment variables there works. On Ubuntu, that's done automatically for you by Settings → Network → Network proxy, so as long as you restart snapd after changing that file you should be set.






          share|improve this answer





















          • 1





            Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

            – julian-alarcon
            May 26 '16 at 13:28











          • @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

            – muru
            Jun 7 '16 at 13:57






          • 1





            Well what if one wants to automate this configuration?

            – pmatulis
            Dec 19 '16 at 16:18






          • 1





            Remember, you will need to restart the snapd service before these changes take effect.

            – Seth
            Jan 11 '17 at 22:07











          • The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

            – Teque5
            Jan 31 at 17:31



















          5














          There is another way to add environment variables to systemd services:



          Create a folder for the snap daemon and create configuration files for the environment variables:



          $ sudo mkdir -p /etc/systemd/system/snapd.service.d/
          $ echo -e '[Service]nEnvironment="http_proxy=http://1.2.3.4:3128/"'
          | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
          $ echo -e '[Service]nEnvironment="https_proxy=http://1.2.3.4:3128/"'
          | sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
          $ sudo systemctl daemon-reload
          $ sudo systemctl restart snapd


          After that you can check if the environment variables are set for snapd:



          $ systemctl show snapd | grep proxy
          Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
          DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf





          share|improve this answer

































            4














            Snap uses snapd daemon. You only need to define http_proxy and https_proxy in /etc/environment and restart the service: systemctl restart snapd.






            share|improve this answer

































              1














              There is a reported bug:



              https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652



              Please subscribe to check changes on it.






              share|improve this answer































                1














                Be careful, because the snapd reads the /etc/environment file instead of get the ENV variable.
                This example below doesn't work:



                export https_proxy=http://<your.ip.here>:3128


                you have to use:



                http://<your.ip.here>:3128





                share|improve this answer































                  0














                  Snap service is configured to use special environment file, so you can just add http_proxy variable to it if your current environment variables are not picked up by the snap.



                  Open file:



                  sudo vim /etc/sysconfig/snapd


                  Add:



                  http_proxy=http://127.0.0.1:3128
                  https_proxy=http://127.0.0.1:3128





                  share|improve this answer























                    Your Answer








                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "89"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f764610%2fhow-to-install-snap-packages-behind-web-proxy-on-ubuntu-16-04%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    6 Answers
                    6






                    active

                    oldest

                    votes








                    6 Answers
                    6






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    17














                    snapd reads /etc/environment, so setting the usual proxy environment variables there works. On Ubuntu, that's done automatically for you by Settings → Network → Network proxy, so as long as you restart snapd after changing that file you should be set.






                    share|improve this answer





















                    • 1





                      Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                      – julian-alarcon
                      May 26 '16 at 13:28











                    • @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                      – muru
                      Jun 7 '16 at 13:57






                    • 1





                      Well what if one wants to automate this configuration?

                      – pmatulis
                      Dec 19 '16 at 16:18






                    • 1





                      Remember, you will need to restart the snapd service before these changes take effect.

                      – Seth
                      Jan 11 '17 at 22:07











                    • The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                      – Teque5
                      Jan 31 at 17:31
















                    17














                    snapd reads /etc/environment, so setting the usual proxy environment variables there works. On Ubuntu, that's done automatically for you by Settings → Network → Network proxy, so as long as you restart snapd after changing that file you should be set.






                    share|improve this answer





















                    • 1





                      Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                      – julian-alarcon
                      May 26 '16 at 13:28











                    • @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                      – muru
                      Jun 7 '16 at 13:57






                    • 1





                      Well what if one wants to automate this configuration?

                      – pmatulis
                      Dec 19 '16 at 16:18






                    • 1





                      Remember, you will need to restart the snapd service before these changes take effect.

                      – Seth
                      Jan 11 '17 at 22:07











                    • The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                      – Teque5
                      Jan 31 at 17:31














                    17












                    17








                    17







                    snapd reads /etc/environment, so setting the usual proxy environment variables there works. On Ubuntu, that's done automatically for you by Settings → Network → Network proxy, so as long as you restart snapd after changing that file you should be set.






                    share|improve this answer















                    snapd reads /etc/environment, so setting the usual proxy environment variables there works. On Ubuntu, that's done automatically for you by Settings → Network → Network proxy, so as long as you restart snapd after changing that file you should be set.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jun 20 '17 at 17:08

























                    answered May 16 '16 at 13:00









                    ChipacaChipaca

                    8,6742244




                    8,6742244








                    • 1





                      Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                      – julian-alarcon
                      May 26 '16 at 13:28











                    • @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                      – muru
                      Jun 7 '16 at 13:57






                    • 1





                      Well what if one wants to automate this configuration?

                      – pmatulis
                      Dec 19 '16 at 16:18






                    • 1





                      Remember, you will need to restart the snapd service before these changes take effect.

                      – Seth
                      Jan 11 '17 at 22:07











                    • The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                      – Teque5
                      Jan 31 at 17:31














                    • 1





                      Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                      – julian-alarcon
                      May 26 '16 at 13:28











                    • @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                      – muru
                      Jun 7 '16 at 13:57






                    • 1





                      Well what if one wants to automate this configuration?

                      – pmatulis
                      Dec 19 '16 at 16:18






                    • 1





                      Remember, you will need to restart the snapd service before these changes take effect.

                      – Seth
                      Jan 11 '17 at 22:07











                    • The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                      – Teque5
                      Jan 31 at 17:31








                    1




                    1





                    Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                    – julian-alarcon
                    May 26 '16 at 13:28





                    Being more specific, the snapd.service file is located here: /lib/systemd/system/snapd.service

                    – julian-alarcon
                    May 26 '16 at 13:28













                    @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                    – muru
                    Jun 7 '16 at 13:57





                    @darkhole one shouldn't edit /lib/systemd/system/snapd.service, but use systemctl edit snapd.service. See my answer: askubuntu.com/questions/659267/…

                    – muru
                    Jun 7 '16 at 13:57




                    1




                    1





                    Well what if one wants to automate this configuration?

                    – pmatulis
                    Dec 19 '16 at 16:18





                    Well what if one wants to automate this configuration?

                    – pmatulis
                    Dec 19 '16 at 16:18




                    1




                    1





                    Remember, you will need to restart the snapd service before these changes take effect.

                    – Seth
                    Jan 11 '17 at 22:07





                    Remember, you will need to restart the snapd service before these changes take effect.

                    – Seth
                    Jan 11 '17 at 22:07













                    The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                    – Teque5
                    Jan 31 at 17:31





                    The method you posted here also doesn't work with authentication. Snap should just use the normal $http_proxy and $https_proxy env vars like everyone else. Here is the ubuntu bug tracker link for this problem.

                    – Teque5
                    Jan 31 at 17:31













                    5














                    There is another way to add environment variables to systemd services:



                    Create a folder for the snap daemon and create configuration files for the environment variables:



                    $ sudo mkdir -p /etc/systemd/system/snapd.service.d/
                    $ echo -e '[Service]nEnvironment="http_proxy=http://1.2.3.4:3128/"'
                    | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
                    $ echo -e '[Service]nEnvironment="https_proxy=http://1.2.3.4:3128/"'
                    | sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
                    $ sudo systemctl daemon-reload
                    $ sudo systemctl restart snapd


                    After that you can check if the environment variables are set for snapd:



                    $ systemctl show snapd | grep proxy
                    Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
                    DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf





                    share|improve this answer






























                      5














                      There is another way to add environment variables to systemd services:



                      Create a folder for the snap daemon and create configuration files for the environment variables:



                      $ sudo mkdir -p /etc/systemd/system/snapd.service.d/
                      $ echo -e '[Service]nEnvironment="http_proxy=http://1.2.3.4:3128/"'
                      | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
                      $ echo -e '[Service]nEnvironment="https_proxy=http://1.2.3.4:3128/"'
                      | sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
                      $ sudo systemctl daemon-reload
                      $ sudo systemctl restart snapd


                      After that you can check if the environment variables are set for snapd:



                      $ systemctl show snapd | grep proxy
                      Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
                      DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf





                      share|improve this answer




























                        5












                        5








                        5







                        There is another way to add environment variables to systemd services:



                        Create a folder for the snap daemon and create configuration files for the environment variables:



                        $ sudo mkdir -p /etc/systemd/system/snapd.service.d/
                        $ echo -e '[Service]nEnvironment="http_proxy=http://1.2.3.4:3128/"'
                        | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
                        $ echo -e '[Service]nEnvironment="https_proxy=http://1.2.3.4:3128/"'
                        | sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
                        $ sudo systemctl daemon-reload
                        $ sudo systemctl restart snapd


                        After that you can check if the environment variables are set for snapd:



                        $ systemctl show snapd | grep proxy
                        Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
                        DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf





                        share|improve this answer















                        There is another way to add environment variables to systemd services:



                        Create a folder for the snap daemon and create configuration files for the environment variables:



                        $ sudo mkdir -p /etc/systemd/system/snapd.service.d/
                        $ echo -e '[Service]nEnvironment="http_proxy=http://1.2.3.4:3128/"'
                        | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
                        $ echo -e '[Service]nEnvironment="https_proxy=http://1.2.3.4:3128/"'
                        | sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
                        $ sudo systemctl daemon-reload
                        $ sudo systemctl restart snapd


                        After that you can check if the environment variables are set for snapd:



                        $ systemctl show snapd | grep proxy
                        Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
                        DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Oct 26 '18 at 14:43

























                        answered Oct 18 '18 at 11:39









                        Simon SudlerSimon Sudler

                        1,483314




                        1,483314























                            4














                            Snap uses snapd daemon. You only need to define http_proxy and https_proxy in /etc/environment and restart the service: systemctl restart snapd.






                            share|improve this answer






























                              4














                              Snap uses snapd daemon. You only need to define http_proxy and https_proxy in /etc/environment and restart the service: systemctl restart snapd.






                              share|improve this answer




























                                4












                                4








                                4







                                Snap uses snapd daemon. You only need to define http_proxy and https_proxy in /etc/environment and restart the service: systemctl restart snapd.






                                share|improve this answer















                                Snap uses snapd daemon. You only need to define http_proxy and https_proxy in /etc/environment and restart the service: systemctl restart snapd.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Apr 2 '18 at 22:35









                                user.dz

                                34.9k1194177




                                34.9k1194177










                                answered Apr 2 '18 at 21:42









                                mmartinmmartin

                                411




                                411























                                    1














                                    There is a reported bug:



                                    https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652



                                    Please subscribe to check changes on it.






                                    share|improve this answer




























                                      1














                                      There is a reported bug:



                                      https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652



                                      Please subscribe to check changes on it.






                                      share|improve this answer


























                                        1












                                        1








                                        1







                                        There is a reported bug:



                                        https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652



                                        Please subscribe to check changes on it.






                                        share|improve this answer













                                        There is a reported bug:



                                        https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652



                                        Please subscribe to check changes on it.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered May 26 '16 at 13:31









                                        julian-alarconjulian-alarcon

                                        34927




                                        34927























                                            1














                                            Be careful, because the snapd reads the /etc/environment file instead of get the ENV variable.
                                            This example below doesn't work:



                                            export https_proxy=http://<your.ip.here>:3128


                                            you have to use:



                                            http://<your.ip.here>:3128





                                            share|improve this answer




























                                              1














                                              Be careful, because the snapd reads the /etc/environment file instead of get the ENV variable.
                                              This example below doesn't work:



                                              export https_proxy=http://<your.ip.here>:3128


                                              you have to use:



                                              http://<your.ip.here>:3128





                                              share|improve this answer


























                                                1












                                                1








                                                1







                                                Be careful, because the snapd reads the /etc/environment file instead of get the ENV variable.
                                                This example below doesn't work:



                                                export https_proxy=http://<your.ip.here>:3128


                                                you have to use:



                                                http://<your.ip.here>:3128





                                                share|improve this answer













                                                Be careful, because the snapd reads the /etc/environment file instead of get the ENV variable.
                                                This example below doesn't work:



                                                export https_proxy=http://<your.ip.here>:3128


                                                you have to use:



                                                http://<your.ip.here>:3128






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jul 1 '18 at 22:15









                                                Zoltan SzaboZoltan Szabo

                                                111




                                                111























                                                    0














                                                    Snap service is configured to use special environment file, so you can just add http_proxy variable to it if your current environment variables are not picked up by the snap.



                                                    Open file:



                                                    sudo vim /etc/sysconfig/snapd


                                                    Add:



                                                    http_proxy=http://127.0.0.1:3128
                                                    https_proxy=http://127.0.0.1:3128





                                                    share|improve this answer




























                                                      0














                                                      Snap service is configured to use special environment file, so you can just add http_proxy variable to it if your current environment variables are not picked up by the snap.



                                                      Open file:



                                                      sudo vim /etc/sysconfig/snapd


                                                      Add:



                                                      http_proxy=http://127.0.0.1:3128
                                                      https_proxy=http://127.0.0.1:3128





                                                      share|improve this answer


























                                                        0












                                                        0








                                                        0







                                                        Snap service is configured to use special environment file, so you can just add http_proxy variable to it if your current environment variables are not picked up by the snap.



                                                        Open file:



                                                        sudo vim /etc/sysconfig/snapd


                                                        Add:



                                                        http_proxy=http://127.0.0.1:3128
                                                        https_proxy=http://127.0.0.1:3128





                                                        share|improve this answer













                                                        Snap service is configured to use special environment file, so you can just add http_proxy variable to it if your current environment variables are not picked up by the snap.



                                                        Open file:



                                                        sudo vim /etc/sysconfig/snapd


                                                        Add:



                                                        http_proxy=http://127.0.0.1:3128
                                                        https_proxy=http://127.0.0.1:3128






                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Jan 15 at 19:30









                                                        AlexanderAlexander

                                                        99




                                                        99






























                                                            draft saved

                                                            draft discarded




















































                                                            Thanks for contributing an answer to Ask Ubuntu!


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.




                                                            draft saved


                                                            draft discarded














                                                            StackExchange.ready(
                                                            function () {
                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f764610%2fhow-to-install-snap-packages-behind-web-proxy-on-ubuntu-16-04%23new-answer', 'question_page');
                                                            }
                                                            );

                                                            Post as a guest















                                                            Required, but never shown





















































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown

































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown







                                                            Popular posts from this blog

                                                            How to change which sound is reproduced for terminal bell?

                                                            Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                                            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents