This articles was published on 2025-01-06

Using Omakub in China

Recently, I was contacted by someone who had been struggling to install Omakub on his machine. Omakub is a tool to setup a Linux desktop environment from scratch and it appears to instal A LOT of different software from all over the world. For developers in China it is common to struggle with access to certain endpoints (e.g. Google when downloading Chrome). As people stumbled over the issue before and as it seems that a proxy option request for Omakub is not accepted by DHH, here the details to make it work nevertheless.

First of all Omakub is optimized for Ubuntu and like many other Linux distributions the system-wide proxy is actually not system-wide. Android seems to suffer under the same issue and I would love to find a person who tells me that I'm stupid and in reality it is actually possible to set a system-wide proxy. I was never able to figure it out in the past, so here come the few places you have to configure to enforce all different toolings (and special users) to use the same proxy:

Everyone knows the default proxy variables. They come in lower and upper case, because of cause they do:

export HTTP_PROXY=http://192.168.1.1:9090
export HTTPS_PROXY=http://192.168.1.1:9090
export http_proxy=http://192.168.1.1:9090
export https_proxy=http://192.168.1.1:9090

Then we have apt and apt doesn't care about these standard variables so you create a config file in the apt directory (e.g. /etc/apt/apt.conf) and set: apt respects the standard proxy variables but it would require to have the environment variables set for root, as apt is called via sudo the local variables are not set at the time when apt is being executed (thanks to Felix for the hint). So we either would need to change the Omakub scripts to call apt with sudo -E or we add the proxy to /etc/apt/apt.conf:

Acquire::http::Proxy "http://192.168.1.1:9090";
Acquire::https::Proxy "http://192.168.1.1:9090";

Omakub is also cloning repositories from Github. And as Github is also from time to time blocked we need to set the proxy for git too:

git config --global http.proxy http://192.168.1.1:9090
git config --global https.proxy http://192.168.1.1:9090

wget is used to download certificates (e.g. from Docker) and usually this shouldn't be an issue as the default proxy variables are used. Yet Omakub is calling wget with sudo and let it write directly to the keyring (instead of piping it via tee). So we need root to also use the correct proxy settings. This can be done via a global environment variable or by just creating /root/.wgetrc with the following content:

use_proxy=on
http_proxy=http://192.168.1.1:9090
https_proxy=http://192.168.1.1:9090

With this setup Omakub seems to install just fine.

After thinking a bit more about the setup and based on the feedback from Felix I think adding the proxy variables to /etc/environment is the simpler way forward. Considering that in this way you can skip the modification of /etc/apt/apt.conf and /root/.wgetrc