1

Is there any possibility to use a different directory than /usr as the standard directory to install things? I am asking, since I got an Endless OS system where /usr is read-only, thus not being able to do things the "standard" way.

In other words: Is there a way to create another folder, say in my home directory (let's call it "user"), and "share" all commands and dependencies between /usr and /home/user? So, for example, when I want to install perl-tk in the /home/user - directory, I can make use of the perl packages already installed in the /usr/whatever folder during make install?

I cannot change /usr (there is a way with an overlay, however by system update, these changes are gone), so I need to somehow "work outside" it, but somehow "link" to it still.

Changing system would be an obvious option, but also just eluding the challenge ;)

  • What are you trying to install? – Mikel Apr 6 '18 at 18:12
  • If you have root access then that won't be an issue. If not, you can install to a subdirectory of your home with a name of your choosing and export it to your path. – Nasir Riley Apr 6 '18 at 18:20
  • For the most part you can install things in any directory you have write permissions to so long as it has enough free space. Is there a particular issue you are encountering? – Jesse_b Apr 6 '18 at 18:20
  • 2
    Virtually any software can be install under $HOME, but the way that this is done depends on the software. – Kusalananda Apr 6 '18 at 18:20
  • The issue is that in Endless OS, the /usr directory is read-only. In particular, this means that things under /usr cannot be modified or extended. The problem is then that, even if it is possible to install it outside /usr, there are programs which have dependencies, and look for those in the /usr folder (as far as I have understood). For example, the package aptitude somehow cannot be installed, it tells me that I need some apt-get dev-module, and trying to install that, this also doesn't work. Also, I have issues with texlive. It is not about specific examples, but rather a general issue. – Osmium_Dresden Apr 8 '18 at 8:43
5

It may be that Endless OS is not the right tool to be able to accomplish what you want. From the Endless OS Developer page,

Endless OS

Not your typical Linux distribution. We don’t use rpm, apt, or any other packaging system. We use a read-only root file system managed by OSTree with application bundles overlaid on top. We have a different target user. Most desktop Linux distributions are oriented towards tech-savvy users and developers. Simplicity is the key, so we carefully pick and choose the best applications available for our users. A number of core technologies underlie our OS, in particular the Linux kernel, OSTree, systemd, GNU, X, GNOME, and Xapian.

  • Thanks, however, I have already read all of this information from the Endless OS, which is why I am asking my question here - so, to find a workaround for this. – Osmium_Dresden Apr 8 '18 at 8:44
2

Yes, it is possible to install software to directories other than /usr.

One example (system-wide) is /usr/local. (Which might still not help you directly, since your /usr is read-only.) The /usr/local directory matches /usr in its layout (it has a /bin, /lib etc.) In most cases, it is used to distinguish packages shipped as part of your base OS (which will go into /usr) from those installed from source by the systemd administrator (which will go into /usr/local.)

There is also /opt which is meant to install packages into separate per-package directories. So, for instance, you could install Perl 6 there under /opt/perl6 and that would only contain Perl and nothing else. You would keep separate directories for the separate packages, which usually makes it easy to "uninstall" a package by just removing its directory. You usually need to set $PATH appropriately to access the programs installed there, or create symlinks in some other bin directory that's already in $PATH to access those. Management of /opt is usually meant for the administrator, and considering you need to update $PATH for every package you install, it might not be the best option...

For installing software under your $HOME directory, one possible approach is to create a .local subdirectory at the top of it and match the /usr or /usr/local hierarchy.

So maybe try this:

mkdir ~/.local

And then use it as --prefix when you're installing a new package. For instance, if the package uses an autoconf-style configure script, you can build and install it using:

./configure --prefix="$HOME/.local"
make
make install

You need to add ~/.local to your $PATH so you can access programs there. So do that in your ~/.bashrc:

PATH=$HOME/.local:$PATH
export PATH

Open a new shell (new terminal, or log out and log in again) for the change to take effect. Or just run that same command on your existing shell. You should be able to execute the programs from ~/.local/bin direcly now.

  • Thanks for this answer, this looks like a promising road to go. I will try it, however, I guess there will be problems again when I already have a package, say perl, installed in /usr, and want to add, e.g., perl-tk, since it will try to modify /usr, which it can't. But I'll see. – Osmium_Dresden Apr 8 '18 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.