Recent

Author Topic: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...  (Read 1033 times)

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« on: October 05, 2024, 04:56:36 pm »
Hi

Unfortunately I need to ask some advice now. I had many months ago installed the Lazarus on my new laptop, which I decided to run Ubuntu Mate dirsto after long time using again Win only machines. Had issues some issues on old versions on repo and installed from some step by step guide on here ... anyway now I have a small issue.

It seems the Dwarf dialog on "Run" process is a new feature and there is no issue on there.

My issue is that if I eg. try to Run the "Image Viewer" example project Lazarus creates and error message dialog box informing:
Unable to write "\usr\share\lazarus\2.2.6\examples\imgviewer\imgview.res"

If I run new project it seems to compile and run the (empty) project.

What I'm doing wrong here?  :-[
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

cdbc

  • Hero Member
  • *****
  • Posts: 1569
    • http://www.cdbc.dk
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #1 on: October 05, 2024, 05:31:41 pm »
Hi
On unix & Linux this:
Quote
"\usr\share\lazarus\2.2.6\examples\imgviewer\imgview.res"
is located in "root"-land, hence it's 'off-limits' to you(or normal users), this includes lazarus/fpc run by your user...
You can try to copy the folder containing the example project to your home folder and open it as a project with lazarus there, then you should be able to compile and run it...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #2 on: October 05, 2024, 06:04:15 pm »
Thank you, I was afraid of that kind of answer of issue on security / privileges in OS side.

Does anyone know if this lack of privileges will cause further issues using Lazarus outside example projects? ...and if there is workaround. It seems some are given up and rolled back to Ubuntu 16.xx

Should I install whole Lazarus tool chain to desktop or something.  ...or is this something that is solved now on latest Laz versions?
« Last Edit: October 05, 2024, 06:06:15 pm by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7859
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #3 on: October 05, 2024, 06:14:27 pm »
Thank you, I was afraid of that kind of answer of issue on security / privileges in OS side.

Does anyone know if this lack of privileges will cause further issues using Lazarus outside example projects? ...and if there is workaround. It seems some are given up and rolled back to Ubuntu 16.xx

Should I install whole Lazarus tool chain to desktop or something.  ...or is this something that is solved now on latest Laz versions?

There's two things I'd say here. The first is that I habitually (on Debian) build my own versions of Lazarus, and I accumulate those in /usr/local/share.lazarus to avoid cluttering /usr/local/share. Since I am a member of the staff group, I make /usr/local/share.lazarus rwe to staff, so that I don't need to do an IDE build as root.

Second, while that would probably fix the problem because the examples directory is now owned by you, a better way would be if you copied example project directories into either your ~ (home) directory, or into /usr/local/src and then gave yourself rwe access which would allow you to build things.

The overall rationale is that /in/ /principle/ a unix (i.e. including Linux etc.) box is multiuser, and while you might be the user who has installed a development tool "for the common good" there might be other people accessing it, and it would be inappropriate for them to write over each others' working copies.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #4 on: October 05, 2024, 06:49:52 pm »
So this is more a feature how (and where) the example projects manager is implemented at Lazarus project? Assuming "\share\" in linux/unix lingo means (read & execute, but NO write for mere mortals) ...?
« Last Edit: October 05, 2024, 07:04:28 pm by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

cdbc

  • Hero Member
  • *****
  • Posts: 1569
    • http://www.cdbc.dk
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #5 on: October 05, 2024, 07:00:19 pm »
Hi
So you're fairly new to linux... No worries, it's 'learnable'  :D
You can rely on this: You can /read-write-execute/ to your heart's content in /home/yo(u)ser/* a.k.a ~ ...and I think /tmp/*
Basically everything else is off-limits, only accessible if 'su'/'sudo' to become 'root'-user.
You can however *read* from e.g.: /usr/share/lazarus/examples/*
Thus copy the directory you want to /home/yo(u)ser/examples/your-project/
HTH
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #6 on: October 05, 2024, 07:06:11 pm »
Hi
So you're fairly new to linux... No worries, it's 'learnable'  :D
You can rely on this: You can /read-write-execute/ to your heart's content in /home/yo(u)ser/* a.k.a ~ ...and I think /tmp/*
Basically everything else is off-limits, only accessible if 'su'/'sudo' to become 'root'-user.
You can however *read* from e.g.: /usr/share/lazarus/examples/*
Thus copy the directory you want to /home/yo(u)ser/examples/your-project/
HTH
Regards Benny
I would not say new, I have had my hate love relationship ongoing since about -98 ... but use hours are at noob level  :D

My edit at the same time of your helpfull answer :)
.. but this is a bit confusing since Lazarus directory is /usr/share/lazarus/2.2.6/ and the options window claims it is shared to all projects... -> I do make assumption that I did create it with installer with superuser privileges so it is locked from all normal users ... -> New projects do not go to write anything on there .. -> so it should be enough to "Save As" the project to my own user space ... let me try out.

edit. would -> would not
« Last Edit: October 05, 2024, 08:17:47 pm by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

cdbc

  • Hero Member
  • *****
  • Posts: 1569
    • http://www.cdbc.dk
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #7 on: October 05, 2024, 07:28:42 pm »
Hi
If that doesn't work, then here's a zipped version for you - attached
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #8 on: October 05, 2024, 07:41:14 pm »
Hi
If that doesn't work, then here's a zipped version for you - attached
Regards Benny
Thank you, it seems it doesn't behave as I thought it will, this time the Lazarus itself not the OS this time... The "Save As" saves only individual Pas-source, and it seems the "Save project As" doesn't include the sources.  ..So counter intuitive for a newbie, anyway publishing seems to be the way, with seemingly working solution (gives two /usr/share/... related errors to "backup"), but published project seems to at least compile and run [edit. publish project do not include all files no matter of options in this situation -> use copy paste]. Copy pasting is easier tbh. :)
« Last Edit: October 05, 2024, 08:16:13 pm by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7859
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #9 on: October 05, 2024, 07:50:47 pm »
So this is more a feature how (and where) the example projects manager is implemented at Lazarus project? Assuming "\share\" in linux/unix lingo means (read & execute, but NO write for mere mortals) ...?

Not quite. Let's start off by assuming that the executable files ("binaries" or "shell scripts") are in /usr/bin and /usr/local/bin, then the /usr/share and /usr/local/share directories are broadly there for the corresponding non-executable files.

Your distro (I think you said you're using Ubuntu, I use Debian which is related) will install binaries from packages (.apt etc.) in /usr/bin and /usr/share. As an aside, some non-Linux unices would put stuff which was optional rather than essential in /usr/opt/bin and /usr/opt/share, and some Berkeley derivatives would use /usr/ucb/bin and /usr/ucb/share... I think you probably get the idea. There's also sometimes binary libraries (i.e. not executable in their own right) put in /usr/lib, /usr/local/lib and so on.

If you build something locally, it's generally good practice to put it in /usr/local with executables in ...bin, library files in ...lib, supporting data in ...share and so on. If it were from a third-party archive and had a complex history starting off with SunOS/Solaris or one of the Berkeleys then it might go in /usr/opt or /usr/ucb, but hopefully by now you get the idea.

The twist here is that even if you put the executable for the main Lazarus IDE in /usr/local/bin, on occasion it wants to rebuild itself e.g. if a support package is added. So for that reason alone it's better practice to have a symlink (qv) or shell script in /usr/local/bin, which transfers control to the IDE binary elsewhere. In addition, there's a great deal of stuff associated with the IDE (loosely speaking, resources) which naturally fits into /usr/local/share (although as I said, I use /usr/local/share.lazarus to keep my standard /usr/share uncluttered).

Each user will have configuration and state files in (by default) ~/.lazarus, where ~ is shorthand for the name of his home directory. But you don't necessarily want each individual user to be able to update and rebuild the IDE: it's better to either designate one user who is then the owner of the entire /usr/local/share/lazarus (or, in my case, /usr/local/share.lazarus/...) tree, or to allow it to be done by any member of a trusted group (i.e. "staff" in my earlier example).

But going back to your original question: an example program being tinkered with is very much the domain of one specific user, so should generally be copied out of /usr/local/lazarus etc. into that user's working area.

Bit rambling, I'm afraid, but hopefully answers whatever it was you asked :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TRon

  • Hero Member
  • *****
  • Posts: 3453
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #10 on: October 05, 2024, 10:20:14 pm »
Pardon the intrusion but I wondered about something.

If I start lazarus and open an example from the examples dialog then for me it uses the lazarus configuration directory. That is exactly where I would expect the examples to be be located and should be able to work no matter what rights you have.

Are we perhaps talking about two different things here ?
This tagline is powered by AI

ArtLogi

  • Full Member
  • ***
  • Posts: 194
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #11 on: October 05, 2024, 10:35:20 pm »
Pardon the intrusion but I wondered about something.

If I start lazarus and open an example from the examples dialog then for me it uses the lazarus configuration directory. That is exactly where I would expect the examples to be be located and should be able to work no matter what rights you have.

Are we perhaps talking about two different things here ?
...Same thing I was polite.  8)
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

TRon

  • Hero Member
  • *****
  • Posts: 3453
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #12 on: October 05, 2024, 10:37:06 pm »
I can see it now for myself. 2.2.6 seems to exhibit this behaviour. I Initially tested with 3.0

edit: A small side note though, I never use the package manager to do my lazarus installation. and do it manually instead (if that sound too complicated for you in case wanting to try yourself then you might want to consider using fpcupdeluxe instead).
« Last Edit: October 05, 2024, 10:43:28 pm by TRon »
This tagline is powered by AI

MarkMLl

  • Hero Member
  • *****
  • Posts: 7859
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #13 on: October 05, 2024, 10:46:46 pm »
Pardon the intrusion but I wondered about something.

If I start lazarus and open an example from the examples dialog then for me it uses the lazarus configuration directory. That is exactly where I would expect the examples to be be located and should be able to work no matter what rights you have.

Are we perhaps talking about two different things here ?

You're not intruding old chap, and it's a very good point. I'm pretty sure that he's talking about going directly to the .lpi (etc.) via the filesystem (BTDT), and discussion of the examples /does/ usually refer to them by their position in the tree of files rather than via the IDE's... ... um, example dialog(ue)? Just where /is/ that??

I agree that the "right" way is by having the IDE sort things out to that the files are r/w. But in that case, and assuming that an installed package can add its examples to the IDE, shouldn't the IDE be able to take a peek at a project file and warn the user that opening it directly (by position in the filesystem rather than via the IDE) will be problematic?

Updated after postings crossed: yes, I install manually as well and rebuild manually if I want to add packages since otherwise things will get out of step if trying to run e.g. both GTK and Qt. And I'm still on 2.x for various reasons.

MarkMLl
« Last Edit: October 05, 2024, 10:49:43 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

TRon

  • Hero Member
  • *****
  • Posts: 3453
Re: Ubuntu Mate / Laz 2.2.6 / FPC 3.2.2 - unable to write \usr\...
« Reply #14 on: October 05, 2024, 10:54:07 pm »
Yeah sorry for the cross MarkMLI.

I had the same thoughts as you wrote/replied when reading the initial question and thought to myself there must have been far more reports if this wasn't addressed and indeed it seem to have been solved (we all know about the sporadic rebuilt issues mentioned on the forums).

Although I do have 2.2.4 and 2.2.6 installed I rarely use them anymore and only when required (I initially missed the reference from TS to the version number)
This tagline is powered by AI

 

TinyPortal © 2005-2018