Installing snap packages with Tor

I have successfully installed snap. However, I get the following error when trying to install packages. I am connected through Tor with Linux.

sudo snap install hello-world

error: cannot install “hello-world”: Post
https://api.snapcraft.io/v2/snaps/refresh: dial tcp: lookup
api.snapcraft.io on 127.0.0.1:53: write udp
127.0.0.1:36259->127.0.0.1:53: write: operation not permitted

I think the problem is that it’s being routed through port 53. I tried creating proxies and editing the environment folder to use 127.0.0.1:9050, but that hasn’t been working.

Any ideas?

did you set the http/https proxies for snapd ?

$ sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
$ sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"

Yes, I entered the following 4 lines:

sudo snap set system proxy.http=http://127.0.0.1:9050

sudo snap set system proxy.https=http://127.0.0.1:9050

sudo systemctl restart snapd

sudo snap install hello-world

And the received the output:

error: cannot install “hello-world”: Post
https://api.snapcraft.io/v2/snaps/refresh: proxyconnect tcp: dial tcp
127.0.0.1:9050: connect: connection refused

Do you think this solution could be useful?

https://tor.stackexchange.com/questions/9857/cant-reach-port-9050

it might, i’m not a tor expert but the error you get now looks pretty much like no proxy is running on port 9050 …

Hmm. Can you clarify what you mean? Also, going forward, where do you think is a good forum where I could ask someone else for help?

@jiwjiemmqes @jiwjiemmw If you’re trying to install snap packages in Tails, you have to add an iptables rule to allow the root user to use the SOCKS proxy. Here are the steps which worked for me:

sudo snap set system proxy.http=socks5://127.0.0.1:9050
sudo snap set system proxy.https=socks5://127.0.0.1:9050
sudo iptables -I OUTPUT 3 -d 127.0.0.1/32 -o lo -p tcp -m tcp --dport 9050 --tcp-flags FIN,SYN,RST,ACK SYN -m owner --uid-owner 0 -j ACCEPT
2 Likes