Recent

Author Topic: Is it possible to run "mount /proc" from FPC  (Read 535 times)

cdbc

  • Hero Member
  • *****
  • Posts: 2561
    • http://www.cdbc.dk
Is it possible to run "mount /proc" from FPC
« on: December 13, 2025, 02:31:30 pm »
Hi
Well as the title says -- is it?!?
...and more to the point HOW  %)
tried:
· if RunCommand('mount',['/proc'],aResult) then ...
· if RunCommand('/bin/sh',['mount','/proc'],aResult) then ...

Both to no avail...  :(
N.b.: Yes I'm running the app as root ~ su
TIA
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Thausand

  • Sr. Member
  • ****
  • Posts: 454
Re: Is it possible to run "mount /proc" from FPC
« Reply #1 on: December 13, 2025, 02:42:56 pm »
· if RunCommand('mount',['/proc'],aResult) then ...
There no path then have use full path mount. also have one parameter (have need 2) ? https://www.geeksforgeeks.org/linux-unix/how-to-mount-and-unmount-drives-on-linux/

Quote
· if RunCommand('/bin/sh',['mount','/proc'],aResult) then ...
man sh

Have option -c, then have single parameter but have combine all argument for -c.

Have look aResult and have error.

PS: https://wiki.freepascal.org/Executing_External_Programs#(Process.)RunCommand example first, make replace bash and have use sh (and mount and no echo but echo good for test)
« Last Edit: December 13, 2025, 02:47:23 pm by Thausand »

Kays

  • Hero Member
  • *****
  • Posts: 632
  • Whasup!?
    • KaiBurghardt.de
Re: Is it possible to run “mount /proc” from FP?
« Reply #2 on: December 17, 2025, 07:35:58 pm »
I suppose you don’t just want to mount /proc and that’s your entire program. You probably want to access some files. Beside the issue that a plain mount /proc refers to /etc/fstab (which may or may not contain an appropriate entry), have you looked into whether e. g. the baseUNIX unit already contains a function exposing the information you seek in a structured format? This would eliminate the design flaw that your program needs elevated/mount privileges (unless you’re doing other root stuff, too).
Yours Sincerely
Kai Burghardt

dbannon

  • Hero Member
  • *****
  • Posts: 3647
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Is it possible to run "mount /proc" from FPC
« Reply #3 on: December 24, 2025, 06:16:06 am »
Are you on an (linux) OS that does not automatically mount /proc ?  I have not come across one to be honest.

Hmm, PC Linux ....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

cdbc

  • Hero Member
  • *****
  • Posts: 2561
    • http://www.cdbc.dk
Re: Is it possible to run "mount /proc" from FPC
« Reply #4 on: December 24, 2025, 09:43:30 am »
Hi Davo
We've had a slight /glitch/ in 'grub2' that managed to somehow suddenly 'unmount /proc', so we've had to step back a version of 'grub2'... %)

But it's a lengthy process to debug / test an app, when you don't know when the condition that should trigger it, actually happens  ...if it does happen at all  :P :D

Happy holidays mate, to you and you family \o/
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

 

TinyPortal © 2005-2018