Recent

Author Topic: SOLVED: The program does not start from a normal user from /usr/bin/  (Read 1620 times)

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Is there a valid Debian packaging structure for ordinary user programs? I made .deb packages for system daemons that needed root access. And I followed the same path for an ordinary GUI application and placed the program in the /usr/bin/ folder (the settings are created in the ~/.config/MY_PROGRAM folder - Pascal GetConfigApp(False) function). So: the program is expected to be launched only using sudo (root access) (access denied for normal Ubuntu user). But I don't need it.
How to do it correctly? I have heard that some people place them in the /usr/local/bin/ folder, but according to lintian these are all invalid methods, since they are for self-building applications.

Question: where do I store the binary in a deb package?
« Last Edit: September 11, 2021, 08:09:05 pm by Renat.Su »

MarkMLl

  • Hero Member
  • *****
  • Posts: 3535
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #1 on: September 11, 2021, 09:45:22 am »
I think this is something I ought to be getting to grips with as well, but my initial comment is that few things in /usr/bin need root, daemons etc. would usually go into /usr/sbin.

I've always used /usr/local/bin etc. for locally-generated programs, the other alternative being /opt/bin but it's very rarely used these days (I might have seen SunOS/Solaris putting GNU utilities into that tree). I'd suggest that a good starting point is https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard, together with the references from its first para.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

devEric69

  • Hero Member
  • *****
  • Posts: 644
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #2 on: September 11, 2021, 10:12:07 am »
Hello,

a lot of third party softwares (not compiled locally via source code, a.k.a named "source package", i.e. often not referenceable \ referenced in the official Debian repositories) are installed through their "binary package" *.deb into opt/vendorName.
And their configuration files are created in /{(root)|(home/user1)}/.config/vendorName.
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #3 on: September 11, 2021, 10:43:26 am »
I think this is something I ought to be getting to grips with as well, but my initial comment is that few things in /usr/bin need root, daemons etc. would usually go into /usr/sbin.
Thanks. Perhaps. I'll think about it. But I'm more concerned now about where to store the binary of my GUI program
I've always used /usr/local/bin etc. for locally-generated programs, the other alternative being /opt/bin but it's very rarely used these days (I might have seen SunOS/Solaris putting GNU utilities into that tree).
Yes, I know that some people post there, but it confuses me that this is not recommended
I'd suggest that a good starting point is https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard, together with the references from its first para.
It is not recommended while install as a deb package. For example, linitian inform about this. And look at https://wiki.freepascal.org/Debian_package_structure#usr.2Fbin_directory


Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #4 on: September 11, 2021, 10:46:54 am »
Hello,
a lot of third party softwares (not compiled locally via source code, a.k.a named "source package", i.e. often not referenceable \ referenced in the official Debian repositories) are installed through their "binary package" *.deb into opt/vendorName.
And their configuration files are created in /{(root)|(home/user1)}/.config/vendorName.
Thanks. Yes, I'm aware of that. But I am confused by the fact that lintian does not recommend this. I would just like to understand where it is recommended to store the binary in this case.
P.S. I keep the settings files there, where you wrote

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #5 on: September 11, 2021, 11:15:54 am »
So that my statement does not seem unfounded. Output of the lintian utility:
Code: Bash  [Select][+][-]
  1. user@DESKTOP-RENAT:~$ lintian "myapp-full_2.5.3.15-3_amd64.deb" --info
  2. E: myapp: dir-or-file-in-opt opt/myapp/
  3. N:
  4. N:    Debian packages should not install into /opt, because it is reserved for
  5. N:    add-on software.
  6. N:
  7. N:    Refer to Filesystem Hierarchy Standard (/opt : Add-on application
  8. N:    software packages) for details.
  9. N:
  10. N:    Severity: error
  11. N:
  12. N:    Check: files/hierarchy-standard
  13. N:
  14. E: myapp: dir-or-file-in-opt opt/myapp/myapp

MarkMLl

  • Hero Member
  • *****
  • Posts: 3535
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #6 on: September 11, 2021, 11:49:09 am »
I'd suggest that that applies to stuff which has been accepted by Debian (or some other distro), i.e. distribution is hosted by them and (potentially) their own signing keys are being used.

I'd also suggest that stuff available as a .deb from e.g. Sourceforge would reasonably go into /usr/opt, and stuff that you've built locally into /usr/local.

I'd conclude by suggesting that that guidance is /particularly/ relevant if you have both a distro's version of some piece of software, and have a more recent copy from the software's author and/or have built your own copy locally.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Alextp

  • Hero Member
  • *****
  • Posts: 1489
    • UVviewsoft
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #7 on: September 11, 2021, 02:57:14 pm »
In the Github repo https://github.com/Alexey-T/CudaText
you will find the script z_linux_x64_gtk_deb.sh which makes the DEB file.

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #8 on: September 11, 2021, 03:24:00 pm »
In the Github repo https://github.com/Alexey-T/CudaText
you will find the script z_linux_x64_gtk_deb.sh which makes the DEB file.
Thank you, I use your editor by the way. But, if on the topic: there are no problems in creating a deb archive at me. I wanted to find out where I should store binaries if they are not build by the make locally (e.i. proprietary). In your case, the program is open source and it can be installed in /usr/local/bin/. In my particular case, this will not valid. In any case, thank you for the script too

Alextp

  • Hero Member
  • *****
  • Posts: 1489
    • UVviewsoft
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #9 on: September 11, 2021, 03:27:11 pm »
Sorry then, I mis-read the topic then.

dbannon

  • Hero Member
  • *****
  • Posts: 1679
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #10 on: September 11, 2021, 03:31:28 pm »
I believe that binaries such as Renat.Su mentions definitely should go into /usr/bin on debian based systems.  Some other flavours use /usr/local/bin.

And, yes, as Mark says, things expected to be used by root only should be in */sbin

Its not a good idea to put binaries that users are expected to be looking for in the /opt directory, if nothing else, the default user settings don't set a PATH there and the user will not find it.  And its not intended for "general purpose" binaries, more for specific ones that the user, typically a not a real person, will know the full path to.

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #11 on: September 11, 2021, 04:11:40 pm »
As I came to the conclusion in one of the telegram groups. Add-on application is my GUI application, which does not need root rights and any system capabilities and which is not built by make, i.e. proprietary.
Therefore, I can not look at the lintian warning https://forum.lazarus.freepascal.org/index.php/topic,56240.msg417889.html#msg417889

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #12 on: September 11, 2021, 04:16:32 pm »
I believe that binaries such as Renat.Su mentions definitely should go into /usr/bin on debian based systems.  Some other flavours use /usr/local/bin.

And, yes, as Mark says, things expected to be used by root only should be in */sbin

Its not a good idea to put binaries that users are expected to be looking for in the /opt directory, if nothing else, the default user settings don't set a PATH there and the user will not find it.  And its not intended for "general purpose" binaries, more for specific ones that the user, typically a not a real person, will know the full path to.

Davo
Unlike the daemon that I placed in /usr/bin (or maybe) /usr/sbin, another GUI application, I decided to put it in /opt, because I thought it was intended for this after all:
Quote
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html

/opt is reserved for the installation of add-on application software packages.

In this context, “add-on” means software that is not part of the system; for example, any external or third-party software.

Renat.Su

  • Full Member
  • ***
  • Posts: 208
    • Renat.Su
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #13 on: September 11, 2021, 07:59:09 pm »
I apologize to everyone. There was a bug in the program. Previously, it was only portable and I refactored it so that the configs were stored in the appropriate folders, but I missed one place and the program tried to create a file right where it was launched. The bug has been fixed and now the program is freely run from /usr/bin/ from under a regular user without root access.

The problem is solved

devEric69

  • Hero Member
  • *****
  • Posts: 644
Re: Is there a valid .deb package structure for ordinary user programs?
« Reply #14 on: September 12, 2021, 10:46:12 am »
Its not a good idea to put binaries that users are expected to be looking for in the /opt directory, if nothing else, the default user settings don't set a PATH there and the user will not find it.  And its not intended for "general purpose" binaries, more for specific ones that the user, typically a not a real person, will know the full path to.

Hello @dbannon,

I've read a lot about where to install software on Linux distributions. I've come to the conclusion that there is a fuzzy boundary in the installation paths, like a ridge between two mountainsides which are, roughly speaking:
↗ any software that claims to be close to a "Debian server" installation must not go under /opt. And you have to respect lintian's warning, declare variables in PATH, etc ("old school: canonical, framing, strict").
→ mix (ridge).
↘ any software that claims to be very specific and\or very commercial (wanting to be in the bootstrap of a large distribution, like Ubuntu-snap for example) must be installed entirely in /opt (there's patchelf to get rid of PATH). The lintian warnings are, here, inappropriate ("new way: inventive, testing, pioneering").

« Last Edit: September 12, 2021, 11:23:45 am by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

 

TinyPortal © 2005-2018