Programmers Partitioning Scheme

I want to install programs installed either through an aur helper (use pamac mainly) or manually into /opt.
But a problem arises with certain programs cannot do certain operations (i.e: if flutter needs to delete cache files) as it needs root permission. I want programs the ability to do what they need but I am aware of security risks.

I was thinking setting up:

  • a root partition mounted / to store the OS
  • a partition mounted to /home to keep the files separate
  • a partition mounted on /opt to keep programs manually/aur installed separate by doing this I was hoping this would resolve the permissions issue seeing as it would same partition.

Another reason for multiple partions is so that I could easily swap distros and my programming tools would be intact. Is worth installing into /opt or just install home directory where I can get the permissions I need

Any sort of advice I can get would be helpful I am still very much newbie and learning the file system

This is good practice. :slight_smile:

Whether it’s the same partition or not has nothing to do with (and does not change) the permissions issue.

Also, whether something goes under /opt or not is up to the packagers of the software. The Filesystem Hierarchy Standard states that /opt is intended for software which is installed in a binary form — i.e. not locally compiled from sources — outside of the scope of the package manager.

An example of this would for instance be if you install something like Firefox or LibreOffice by way of the installing mechanism provided on the websites of their respective developers. Commonly, those will then come as a self-extracting archive — e.g. a .run file — and then they will be installed under /opt instead of under the /usr hierarchy.

Anything installed by way of the distribution’s own package manager will follow what the packager has specified, but will commonly go under /usr, and this includes stuff from the AUR, given that once built and installed, it becomes part of the main system and can be removed again by the system’s package manager — in the case of Manjaro and other Arch-based distributions, this means pacman.

Things that you manually build from source code on the local system — i.e. by way of make — should normally go under /usr/local.

I suspect that your permissions problem would be related to the fact that you are clearly demonstrating a Windows mindset, rather than a UNIX mindset. :wink:

Again, the partitioning layout has nothing to do with the permissions — they will remain the same no matter how many partitions you split off the system onto. However, it used to be common practice in UNIX systems to split off a lot more than /home, in order to…

  • minimize potential filesystem damage in case of a system crash; and

  • minimize potential fragmentation and increase security by segregating the shareable and non-shareable data on the one hand, and static and dynamic data on the other hand.

Although nobody here at the forum does things this way anymore, I myself still do. As such, my partitioning scheme is rather complicated by comparison. :wink: :arrow_down:

NAME    FSTYPE FSVER       FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                            
├─sda1  vfat   FAT32       510.5M   0%     /boot/efi
├─sda2  ext4   1.0         392.6M  12%     /boot
├─sda3  btrfs              881.8M   2%     /
├─sda4  btrfs              13.3G   36%     /usr
├─sda5  btrfs              499M     1%     /usr/local
├─sda6  btrfs              1.6G     7%     /opt
├─sda7  btrfs              
├─sda8  btrfs              298.4G  25%     /srv
├─sda9  btrfs              445.9G   1%     /home
├─sda10 swap   1                      
└─sda11 btrfs              17.7G   10%     /var

I don’t know whether you will be able to deduct the logic from that overview, but /boot/efi, /boot, /usr, /usr/local and /opt are all explicitly static directories during normal system operation — we’re not talking of the update process here.

/srv on my system is semi-static, because among other things, it contains my multimedia storage, and considering that I want that content to be available to all user accounts, I’ve put it under /srv as opposed to under my home directory.

/var is a dynamic and non-shareable filesystem — the term “shareable” mainly pertains to whether the directory can safely be exported over the network. In that context, / and /usr are commonly shareable, because they are often made available for booting diskless nodes.

/ is shareable but semi-static — it is being written to at boot time, and during normal operation, the root account’s history file (/root/.bash_history) is also being written to whenever I use the shell as root, but other than that, it is pretty static.

8 Likes

There is a lot of articles to be found here covering various sides of your question.

You cannot control where the applications install to and you should not mess with permissions on system folder structures. You may cause irreparable problems.

Create your own dedicated structure - if you - as I do - hate long paths - you can shorten your names - just be consistent.

I am a developer and a breaker - I break my systems to learn their limits - at the same time I am deeply addicted to be able to use my computer - so long time ago I developed my own routines.

I keep all my stuff - on separate partitions on separate devices.

I have shared the idea , the principles behind.

And some required low-level setup

I have also shared what I call common pitfalls for a developer on Arch based systems

Utility scripts

I could have shared the complete setup - but then, where’s the readers learning process - and I would only put myself in a position where I have to explain my logic instead of the reader creating his/her own logic.

3 Likes