SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
3.03k stars 1.23k forks source link

Can't install borg behind a proxy #5204

Closed icrc-fdeniger closed 2 years ago

icrc-fdeniger commented 2 years ago

Is this a new Bug?

Package Name

borgbackup

Package Version

1.2.0-10

Device Model

NAS Synology

Device Architecture

x86_64

Firmware Version

DSM 7.0.1

What happened?

Try to install Borg from an installation behind a proxy the proxy is correctly configured in Control Panel > Network > Proxy the application is downloaded correctly But the installation takes time in the log /var/log/packages/borgbackup.log we can see this error:

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6aac50>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/

I tried to add HTTP_PROXY and HTTPS_PROXY variables in /root/.profile and to configure pip with:

pip3 config set global.proxy http://myproxy

but no changes.

Reproduction steps

1. Install the NAS behind a proxy
2. Configure the NAS to use this proxy
3. Try to install Borg
4. Failure

Install Log

2022/04/11 16:08:22     Begin service_postinst
2022/04/11 16:08:22     Python 3.10.4
2022/04/11 16:08:49     Requirement already satisfied: pip in /volume1/@appstore/borgbackup/env/lib/python3.10/site-packages (22.0.4)
2022/04/11 16:09:49     WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f88f9fcd0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
2022/04/11 16:10:49     WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f88f9fee0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
2022/04/11 16:11:50     WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f88fec130>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
2022/04/11 16:12:52     WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f88fec2e0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
2022/04/11 16:13:57     WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f88fec490>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/pip/
2022/04/11 16:15:17     Install packages from wheels
2022/04/11 16:15:17     Install packages from wheels [/volume1/@appstore/borgbackup/share/wheelhouse/requirements.txt]
2022/04/11 16:15:20     Looking in links: /volume1/@appstore/borgbackup/share/wheelhouse
2022/04/11 16:16:20     WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6a98a0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/
2022/04/11 16:17:21     WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6aa740>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/
2022/04/11 16:18:22     WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6aa8f0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/
2022/04/11 16:19:24     WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6aaaa0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/
2022/04/11 16:20:28     WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7faa6aac50>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/attrs/

Service Log

No response

Other Logs

No response

th0ma7 commented 2 years ago

I believe that at installation time it uses the sc-borgbackup account. As such you may need to put the argument in a .profile within the user account's $HOME directory.

ymartin59 commented 2 years ago

I fear that this application service account like sc-borgbackup has no $HOME In my opinion the proper fix should be in python3 package where install script has to retrieve DSM system proxy settings and configure pip3 so that any application package benefits from it. This behavior is a consequence of the change to move out of package archive the portable wheels that does not require cross-compilation to reduce packages' size. Notice it also prevents to do a complete offline installation.

th0ma7 commented 2 years ago

I'll be publishing an updated version of this package that will include the pure python wheels. This should allow you to have a working install without needing a working proxy.

adren commented 2 years ago

Despite the newest version of the borgbackup package (v1.2.0-11) which supposedly should have solved the "installation behind a proxy" issue, the software still would not install

here is the error from the /var/log/packages/borgbackup.log file:

2022/05/23 08:02:45     WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))': /simple/setuptools/                    
2022/05/23 08:02:45     WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))': /simple/setuptools/                    
2022/05/23 08:02:46     WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))': /simple/setuptools/                    
2022/05/23 08:02:48     WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))': /simple/setuptools/                    
2022/05/23 08:02:53     WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))': /simple/setuptools/                    
2022/05/23 08:02:53     INFO: pip is looking at multiple versions of borgbackup to determine which version is compatible with other requirements. This could take a while.                                                                                                      
2022/05/23 08:02:53     INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.                                                                                   
2022/05/23 08:02:53     INFO: pip is looking at multiple versions of attrs to determine which version is compatible with other requirements. This could take a while.                                                                                                           
2022/05/23 08:02:53     ERROR: Could not find a version that satisfies the requirement setuptools (from borgmatic) (from versions: none)                                                                                                                                        
2022/05/23 08:02:53     ERROR: No matching distribution found for setuptools
2022/05/23 08:02:53     Installed modules:
2022/05/23 08:02:53     End service_postinst
2022/05/23 08:02:53     upgrade borgbackup 1.2.0-11 End postinst ret=[0]
2022/05/23 08:02:53     upgrade borgbackup 1.2.0-11 Begin postupgrade
2022/05/23 08:02:53     Begin reload_inst_variables
2022/05/23 08:02:53     End reload_inst_variables
2022/05/23 08:02:53     Begin initialize_variables
2022/05/23 08:02:53     End initialize_variables
2022/05/23 08:02:53     ===> Step postupgrade. USER=root GROUP= SHARE_PATH=
2022/05/23 08:02:53     Begin syno_sync_var_folder
2022/05/23 08:02:53     End syno_sync_var_folder
2022/05/23 08:02:53     upgrade borgbackup 1.2.0-11 End postupgrade ret=[0]
2022/05/23 08:02:53     upgrade borgbackup 1.2.0-11 Begin start-stop-status start
2022/05/23 08:02:53     upgrade borgbackup 1.2.0-11 End start-stop-status start ret=[0]

FYI, I had to create a /root/.cache/ directory with mode 1777 for pip to write it's cache because of the following error:

2022/05/23 07:57:56 WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.