Macports/rvm/svn connection issue behind a proxy and firewall - proxy

I am behind a corporate firewall that won't let me rsync out, and requires a proxy for HTTP/HTTPS. I'm having trouble with rvm breaking at the macports step in this environment.
To summarise:
I am trying to do rvm install ruby-1.9.3-p286
rvm wants to use macports.
macports wants to update using rsync, but I can't rsync out.
I set up a local macports source repo, but it doesn't seem to help - macports still wants to use rsync.
A suggestion on a similar question suggested changing port selfupdate to port sync in rvm's scripts. But that didn't help - macports then dies trying to do an svn update
But I can do the svn update manually fine, so I don't understand where the problem is.
Here are the details:
I followed this guide for using macports behind a firewall, by checking out the repo locally, and setting the following in /opt/local/etc/macports/sources.conf.
#rsync://rsync.macports.org/release/tarballs/ports.tar [default]
file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]
The only place I differed from the guide was I installed macports for 10.8 rather than 10.5.
However, rvm's macports seems to still use rsync for some reason:
$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to
/opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location:
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs ---> Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Connection refused (61)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
This is very similar to this question, where the answer suggested the following change:
$ diff -u .rvm/scripts/functions/requirements/osx_port.org .rvm/scripts/functions/requirements/osx_port
--- .rvm/scripts/functions/requirements/osx_port.org 2013-05-28 16:58:37.000000000 +0900
+++ .rvm/scripts/functions/requirements/osx_port 2013-05-28 16:58:50.000000000 +0900
## -82,7 +82,7 ##
requirements_osx_port_update_system()
{
- __rvm_try_sudo port -dv selfupdate || return $?
+ __rvm_try_sudo port -dv sync || return $?
}
requirements_osx_port_define()
Unfortunately, that results in the following:
$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
---> Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed
Trying directly with macports:
$ port -d sync
---> Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed
This is strange, because I can run that svn command fine:
$ /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
At revision 107532.
It's not a user permissions/profile issue, because root can run that svn command fine too:
$ sudo /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
At revision 107532.
I assume something in the chain isn't seeing the proxy correctly. However:
My proxy is correctly set in the http_proxy and https_proxy environment variables
It is also set in ~/.subversion/servers (as the variables http-proxy-host and http-proxy-port in the [global] section)
And it is also set in /opt/local/etc/macports/macports.conf (as the variables proxy_http and proxy_https)
Other information:
ruby 1.8.7
rvm 1.21.4
OSX 10.8.3
MacPorts 2.1.3
Let me know if there's any other information that could be useful.
My question is How can I get port sync to work in this environment? (Which I am hoping will also fix rvm)

As a workaround to get you going try:
rvm autolbs read-fail
It will not install packages automatically - it will fail in case any packages are missing and will let you know names of this packages, just install them manually with macports and it should be fine.
Other solution would be switching to:
rvm autolibs homebrew
to use homebrew instead of macports, or:
rvm autolibs rvm_pkg
to detect what is already installed with pkg-config and try to install rest with the old rvm pkg install ....
More details on autolibs: http://rvm.io/rvm/autolibs

Related

After system upgrade from ubuntu 20.04 LTS to ubuntu 22.04.1 LTS firefox error when doing `sudo apt --fix-broken install`

After upgrade from ubuntu 20.04 LTS to 22.04.1 LTS, I got a very persistent error:
(Reading database ... 350976 files and directories currently installed.)
Preparing to unpack .../firefox_1%3a1snap1-0ubuntu2_amd64.deb ...
=> Installing the firefox snap
==> Checking connectivity with the snap store
==> Installing the firefox snap
error: cannot perform the following tasks:
- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)
dpkg: error processing archive /var/cache/apt/archives/firefox_1%3a1snap1-0ubunt
u2_amd64.deb (--unpack):
new firefox package pre-installation script subprocess returned error exit stat
us 1
Please restart all running instances of firefox, or you will experience problems
.
Errors were encountered while processing:
/var/cache/apt/archives/firefox_1%3a1snap1-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
This
- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)
was very persistent and was hindering any apt-involved installations.
Thus, no apt install nor apt upgrade was working.
After long search and trying around,
where I did:
sudo apt --fix-broken install
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a
And then, cave(!) this removes firefox from your installed package list
and thus after this command you cannot use firefox any more on your computer
until you install it - so I did that - but I had a second computer
where I could google around while I had no firefox on that machine.
I couldn't install chromium browser or other browsers, because apt was not working! So run this command only when you have a second computer or at least your mobile to surf for instructions!
sudo dpkg --force depends -P firefox
I found a hint in
https://forums.mozillazine.org/viewtopic.php?f=38&t=3097766
My solution was:
# Add Mozilla Team PPA
sudo add-apt-repository ppa:mozillateam/ppa
# Set PPA priority
sudo gedit /etc/apt/preferences.d/mozillateamppa
# The command creates and opens empty config file in Gedit text editor.
# When it opens, add the lines below and save it:
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
save and close that file.
after that, I could do finally:
sudo apt --fix-broken install
# and then:
sudo apt update && sudo apt upgrade
and then, all apt or snap commands were working again flawlessly.
note:
Now, I encounter
sudo apt install chromium-browser
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
chromium-browser
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/48,4 kB of archives.
After this operation, 164 kB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 313313 files and directories currently installed.)
Preparing to unpack .../chromium-browser_1%3a85.0.4183.83-0ubuntu2_amd64.deb ...
=> Installing the chromium snap
==> Checking connectivity with the snap store
==> Installing the chromium snap
error: cannot perform the following tasks:
- Run configure hook of "chromium" snap if present (run hook "configure": cannot perform operation: mount --rbind /var/log /
tmp/snap.rootfs_Gg42mE//var/log: Permission denied)
dpkg: error processing archive /var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu2_amd64.deb (--unpack):
new chromium-browser package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried:
sudo add-apt-repository ppa:xtradeb/apps
sudo gedit /etc/apt/preferences.d/xtradebppa
# content:
Package: chromium*
Pin: release o=LP-PPA-xtradeb
Pin-Priority: 501
But this didn't help.
Finally, I found out the solution!
In former days, when my / containing system partition was too full, I sym-linked /var/log. I linked it to somehwere in my home folder. But then, I moved snap back.
- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)
The permission was denied, because it tried to mount to a symlink.
All I had to do was:
sudo rm /var/log
sudo mkdir -p /var/log
Now, it is not a symlink any more. So it can actually mount to it.

opam init failure upon attempted OCaml installation on MacOS 10.14.16

I am attempting to install OCaml via the OCaml opam package manager on MacOs. I have successfully installed opam via homebrew. Initiating the package manager with opam init yields the following error:
[ERROR] Could not update repository "default":
OpamDownload.Download_fail(_, "Curl failed: \"/usr/bin/curl
--write-out %{http_code}\\\\n --retry 3 --retry-delay 2
--user-agent opam/2.1.0 -L -o
/private/var/folders/c_/6splkz692w16x82lzgnsxgfr0000gn/T/opam-57814-6b2069/index.tar.gz.part
-- https://opam.ocaml.org/index.tar.gz\" exited with code 60")
[ERROR] Initial download of repository failed.
What can I do to facilitate successful connection to the repository and initialise opam?
This error message indicates that curl is unable to establish the authenticity of the peer, i.e., https://opam.ocaml.org
This could happen because the certificates on either side are outdated. We can easily check if opam.ocaml.org is up-to-date, using one of the available online SSL checkers, e.g., this one says that they are OK. So it looks like that the problem is on your side.
First of all, you should try using your operating system upgrading options to get everything up-to-date.
If it is not an option, then you can use the --insecure option that you can pass using the OPAMFETCH environment variables. Or you can download the corresponding certificates and store a path to them in the ~/.curlrc, look here for more information.
I had the same problem and solved it by first running brew install wget and then opam init, which suddenly worked.
I ran into the same issue and I found a workaround on the OCaml forum: here. (Credits to UnixJunkie)
You can run:
opam init github git+https://github.com/ocaml/opam-repository.git
This should avoid the certificate issues.
I tried to use ivg's solution but must have made a mistake in moving the .pem files, so I couldn't get that solution to work. The workaround was quick.
Update
The reason opam init failed for me was because curl was installed with snap on my system.
Try to run opam init -verbose and that could reveal more about why you ran into an error.
In my case I needed to install other things with opam and it kept failing every time. So snap uninstall curl and then sudo apt install curl fixed things. (Was only able to figure this out with help from my professor)
Install curl first.
On MacOS: brew install curl
On Debian/Ubuntu Linux (and derivations): sudo apt-get install curl

Homebrew: Pre-downloading a file for a formula

I was trying to install gtk via Homebrew, and one of the steps was to install glib. Due to the poor internet environment, the files cannot be accessed by Homebrew. As told in https://docs.brew.sh/Tips-N%27-Tricks#pre-downloading-a-file-for-a-formula, I downloaded glib-2.62.3.tar.xz manually, and renamed it to /Users/username/Library/Caches/Homebrew/downloads/1ceb5460421ff37cf2c270573cd81d23a3fc0629114ebe78eee705acbd80c9e7--glib-2.62.3.tar.xz, which is the output of brew --cache -s glib.
However, as I run brew install glib again, the message was:
==> Downloading https://download.gnome.org/sources/glib/2.62/glib-2.62.3.tar.xz
Already downloaded: /Users/xwm/Library/Caches/Homebrew/downloads/1ceb5460421ff37cf2c270573cd81d23a3fc0629114ebe78eee705acbd80c9e7--glib-2.62.3.tar.xz
==> Downloading https://raw.githubusercontent.com/Homebrew/formula-patches/61642
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "glib--patch"
Download failed: https://raw.githubusercontent.com/Homebrew/formula-patches/6164294a7/glib/hardcoded-paths.diff
Although this file can be retrived manually, by this time I have no idea how to reaname it so as to be recongnized by Homebrew. How should I proceed?

Getting an error, Port gmake not found, while trying to setup for AOSP build environment

I'm following an instruction from https://source.android.com/setup/build/initializing to build the environment.
I'm at the section Installing the JDK where I have to install gmake, libsdl, git, and gnupg using MacPort.
POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg
But I'm getting an error, Error: Port gmake not found.
I'm using macOS Sierra.
Any solution to this?
I assume you followed the installation instructions from:
https://www.macports.org/install.php
Note that you ought to have run sudo port -v selfupdate to update your local copy of the port tree.
Try the port diagnose command to see if it detects any of the more commonly encountered problems.

How to install php-redis extension on mac os 10.13?

For a few days I'm trying to install php-redis extension.
Try use brew and getting this...
$ brew install php71-redis
Error: No available formula with the name "php71-redis"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Trying to install with PECL and getting this...
$ sudo pecl install redis
downloading redis-4.1.0.tgz ...
Starting to download redis-4.1.0.tgz (220,774 bytes)
..............................................done: 220,774 bytes
25 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
************
************
checking whether to enable igbinary serializer support... yes
checking whether to enable lzf compression... yes
checking use system liblzf... no
checking for igbinary includes... configure: error: Cannot find igbinary.h
ERROR: `/private/tmp/pear/install/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=нуы --enable-redis-lzf=yes' failed
and finally trying to install igbinary.h ....
$ sudo pecl install igbinary
downloading igbinary-2.0.7.tgz ...
Starting to download igbinary-2.0.7.tgz (73,523 bytes)
************
************
Build process completed successfully
Installing '/usr/include/php/ext/igbinary/igbinary.h'
ERROR: failed to mkdir /usr/include/php/ext/igbinary
I just did this on Mac OS 10.13 (I'm still using High Sierra).
With homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis 5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
Did this in September 2019 and it works for me.
For this, try to disable the csrutil on OSx (Mac):
Reboot your Mac
When the Mac starts, typo Command + R until you get into recovery mode
In the recovery mode, go to utilities and select terminal
in the terminal type csrutil disable
Reboot your mac and redo the redis install by pecl
Should work.

Resources