ubuntu-make
ubuntu-make copied to clipboard
Install with sudo (to write in /opt) isn't supported
Following the instructions on http://www.webupd8.org/2014/12/ubuntu-developer-tools-center-renamed.html, I tried to install Eclipse Luna 4.4 on an Ubuntu 14.04 box, using umake as follows:
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt-get update
sudo apt-get install ubuntu-make
umake ide eclipse
When asked for the target directory, I type in this location:
/opt/eclipse/eclipse_4_4
Reason: I do not want separate installations in each user directory (which appears to be the default).
Before installing, I created an alias for python=python3 in ~/.bash_aliases, and sourced the file. This enables the umake scripts to use Python version 3.4.
The install script ends with the exceptions indicated below, copied from a Gnome terminal. The permissions on /opt are the typical 755. I tried tests where I created the target subdirectories beforehand, but that didn't work. I also tried using sudo (sudo umake ide eclipse), but I get the same result.
TERMINAL OUTPUT:
~$ umake ide eclipse Choose installation path: /opt/eclipse/eclipse_4_4 Downloading and installing requirements | 100% |########################################################################| Installing Eclipse ERROR: A decompression to /opt/eclipse/eclipse_4_4 failed: [Errno 8] Exec format error | Traceback (most recent call last): File "/usr/lib/python3/dist-packages/umake/decompressor.py", line 95, in _decompress archive.extractall(dest) File "/usr/lib/python3.4/tarfile.py", line 1979, in extractall self.extract(tarinfo, path, set_attrs=not tarinfo.isdir()) File "/usr/lib/python3.4/tarfile.py", line 2018, in extract set_attrs=set_attrs) File "/usr/lib/python3.4/tarfile.py", line 2079, in _extract_member os.makedirs(upperdirs) File "/usr/lib/python3.4/os.py", line 227, in makedirs makedirs(head, mode, exist_ok) File "/usr/lib/python3.4/os.py", line 237, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/opt/eclipse'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(_self.args, *_self.kwargs) File "/usr/lib/python3/dist-packages/umake/decompressor.py", line 104, in _decompress archive = subprocess.Popen([name, "-o{}".format(dest)], stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/usr/lib/python3.4/subprocess.py", line 848, in init restore_signals, start_new_session) File "/usr/lib/python3.4/subprocess.py", line 1446, in _execute_child raise child_exception_type(errno_num, err_msg) OSError: [Errno 8] Exec format error ERROR: [Errno 8] Exec format error |##########################################################################################|
Thanks for filing this bug, nice catch!
I can reproduce those issues, I guess you triggered two bugs with your use case. The first one is that we reexec ourself (with sudo), only if there are some packages to install (the common use case is for a personal user installation in ~). I'm going to patch so that the destination path is as well taken into account for this decision.
Now, the question is why it's not working if you are running it manually with sudo… if I define some path with parent dirs not existing (like /tmp/foo/bar/baz), this works well, so parents are created. I need to dig a little bit to understand why in the /opt/foo, this fails in this particular way.
Note that ubuntu make is python3 only, you don't need to have python=python3 defined, as it's what is used.
Actually, just found out why the second case is failing: we are switching to the current user after the reexec once the packages are installed to not have all files owned by root, but by the current user.
This is going to be a little bit more complex as anticipated. I'm keeping it on my mind, for now, you should probably use your ~. However, it's a valid use case, but I need to think about it a bit more to get it working reliably.
I just tested a workaround for your use case as well: sudo -s unset SUDO_UID unset SUDO_GID umake ide eclipse …
Of course no launcher icon will be added (as it's a system installation), but it's still available in your dash. Seems there are some minor issues to fix on getting the right user attribution to eclipse files, but that would be a way. Basically, we need ubuntu-make to support system installation.
Another way is to create as well /opt/eclipse/, make it writable for your user (temporarly), and just run umake ide eclipse + your installation path, which should work as well.
Nice use case though, thanks again for raising it :)
At this time it is working with sudo
, but it still needed even as user root
.
root@localhost:# umake ide phpstorm /opt/phpstorm
-> Permission Denied