fusioninventory / fusioninventory-agent

FusionInventory Agent
http://fusioninventory.org/
GNU General Public License v2.0
251 stars 125 forks source link

Can't install Agent 2.5.1 on Mac Os 10.15 Catalina #736

Closed osapsai closed 4 years ago

osapsai commented 4 years ago

When I try to install Agent 2.5.1 on MacOs 10.15 Catalina gui installer and cli show error: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)

I have tried to install to different target( /; /System/Volumes/Data; /Users/administrator/Documents) from cli but I have got same error

administrator@administrators-Mac-mini Documents % sudo installer -pkg FusionInventory-Agent-2.5.1-1.pkg -target /System/Volumes/Data -lang en Password: installer: Package name is FusionInventory-Agent installer: Installing at base path / installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)

administrator@administrators-Mac-mini Documents % sudo installer -pkg FusionInventory-Agent-2.5.1-1.pkg -target / -lang en installer: Package name is FusionInventory-Agent installer: Installing at base path / installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)

administrator@administrators-Mac-mini Documents % sudo installer -pkg FusionInventory-Agent-2.5.1-1.pkg -target /Users/administrator/Documents -lang en installer: Package name is FusionInventory-Agent installer: Installing at base path / installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)

g-bougard commented 4 years ago

Hi @osapsai the Mac Installer was designed to install agent under /opt/fusioninventory-agent. Why are you trying to install it under another place ? Did you try without the -target option ?

osapsai commented 4 years ago

Hi I tried to install in diferent place because new macOS system change permision to "/". Now system volume accessible only for read. You can write only to "/System/Volumes/Data" or user home dir. Default installer can't install agent.

osapsai commented 4 years ago

Without -target I got error -target parameter required

laszlokertesz commented 4 years ago

See https://github.com/fusioninventory/fusioninventory-agent/issues/716 It still does not work with currently available installers (up to and including 2.5.1). I tried it yesterday with a Catalina installation. I tried with -target "/System/Volumes/Data" but it seems that the installer ignores it. It is still saying that "Installing to target path /" and errors out. The app itself is working if the computer was upgraded from Mojave. But the installer needs to be modified to incorporate Catalina's read only root.

g-bougard commented 4 years ago

Hi there, I worked on the MacOS installer and I just uploaded a pre-release package: FusionInventory-Agent-2.5.2-teclib-2.pkg.tar.gz

I enhanced a little the package and it works on the iMac I uses for my tests (Mac OS X older than Catalina). I managed to make it relocatable and I hope this is enough to make the trick on Catalina... Can anyone test it other Catalina ? Maybe only install with installer command could work...

DeCastroTony commented 4 years ago

Hello, Still the same here with your package. sudo installer -pkg FusionInventory-Agent-2.5.2-teclib-2.pkg -target /System/Volumes/Data (Or User Home Directory) installer: Package name is FusionInventory-Agent installer: Installing at base path / installer: The install failed. (Le programme d’installation a rencontré une erreur qui a provoqué l’échec de l’installation. Contactez l’éditeur du logiciel pour obtenir de l’aide. Le paquet tente d’installer du contenu sur le volume système.)

g-bougard commented 4 years ago

Maybe a solution reported on the forum there: https://forum.fusioninventory.org/showthread.php?tid=4089&pid=22637#pid22637

  1. Create a /Applications folder in user folder
  2. Install agent in that path
laszlokertesz commented 4 years ago

Maybe a solution reported on the forum there: https://forum.fusioninventory.org/showthread.php?tid=4089&pid=22637#pid22637

1. Create a `/Applications` folder in user folder

2. Install agent in that path

How can i accomplish this from terminal? I need this to run from the root user. I tried:

installer -pkg FusionInventory-Agent-2.5.1-1.pkg -target "/var/root/Applications"

And it returned the same message:

root# installer -pkg FusionInventory-Agent-2.5.1-1.pkg -target "/var/root/Applications" -allowUntrusted
installer: Package name is FusionInventory-Agent
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)

How can i force the installation directory?

g-bougard commented 4 years ago

Firstly use this pre-release package: FusionInventory-Agent-2.5.2-teclib-2.pkg.tar.gz

DeCastroTony commented 4 years ago

Thx guy, Working fine now using the GUI and browsing to install the software into the directory /Users/Administrator/Applications. Don't know exactly why but using the cli the -target option still don't work for me.

Result : GUI = ok CLI = ko

laszlokertesz commented 4 years ago

Firstly use this pre-release package: FusionInventory-Agent-2.5.2-teclib-2.pkg.tar.gz

Doesn't seem to work. Same error:

installer: Package name is FusionInventory-Agent
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume.)
g-bougard commented 4 years ago

Did you see just previous comment from @DeCastroTony ? It seems only GUI installation works that way with the pre-release package. I agree that's a shame the installer seems not working, but in that case, can I suggest you to contact and claim Apple support to explain us how this is possible ?

Honestly Catalina is too young and it seems some serious editors are still advising to not upgrade to Catalina. I won't invest more time for the moment in the MacOS installer as at least a temporary solution still exists.

DeCastroTony commented 4 years ago

@g-bougard Just let me add an extra point to this issues, the GUI installer is now asking for 93,03 Go of the HDD. Sounds like a typo error in this pre-release package no ?

g-bougard commented 4 years ago

Oh! Yes that's huge ! Thank you for the report, I must fix that storage claiming before any official release.

laszlokertesz commented 4 years ago

I tried installing again with various switches. It seems that the corrcet one is:

installer -verbose -pkg FusionInventory-Agent-2.5.2-test.pkg -target CurrentUserHomeDirectory

But now i get another error:

2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: Referenced component packages (1) trustLevel=100
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: -[IFPKGDerivedDocument sortedPackageLocations]: result = (
        "file://localhost"
    )
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/private/var/root/FusionInventory-Agent-2.5.2-test.pkg
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: Set authorization level to none for session
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: Will use PK session
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: Using authorization level of none for IFPKInstallElement
2019-10-15 17:11:44+03 clj-mb-082 installer[19021]: PackageKit: Bypassing the enforcement checker since the destination is read/write
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Starting installation:
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Configuring volume "OS"
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Preparing disk for local booted install.
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Free space on "OS": 232,35 GB (232351092736 bytes).
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.19021JrUclO"
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: IFPKInstallElement (1 packages)
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: PackageKit: Service connection invalidated!
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: PackageKit: Received request to finish installation before PKInstallClient initialization was complete. Ignoring.
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Couldn't instantiate install client: (null)
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: PackageKit: Bypassing the enforcement checker since the destination is read/write
2019-10-15 17:11:45+03 clj-mb-082 installer[19021]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
g-bougard commented 4 years ago

Nice ! Thank you for this update.

DeCastroTony commented 4 years ago

Hum interesting... because it's working fine for me now using the CLI...

installer -verbose -pkg FusionInventory-Agent-2.5.2-teclib-2.pkg -target CurrentUserHomeDirectory
installer: Package name is FusionInventory-Agent
installer: Installing at base path /Users/tonydecastro
installer: Préparation à l’installation….....
installer: Préparation du disque….....
installer: Préparation de FusionInventory-Agent….....
installer: Attente de la fin des autres installations….....
installer: Configuration de l’installation….....
installer: Écriture des fichiers….....
installer: Exécution des scripts du paquet….....
installer:
installer: Fin de l’installation….....
installer:
installer: Le logiciel a été installé avec succès......
installer: The install was successful.
laszlokertesz commented 4 years ago

I can install it as a regular user but it will not install services or even agent.cfg. Does it even work that way? As root the installation fails in /var/root, maybe programs are not permitted in /var?

g-bougard commented 4 years ago

Did you try to install it with a user having admin privileges ? This is mandatory to have service installed.

laszlokertesz commented 4 years ago

Did you try to install it with a user having admin privileges ? This is mandatory to have service installed.

For me on Catalina the install works only if i install without sudo. It will create the opt folder but many things seem to be missing. No run.sh, uninstall scripts, no service etc. I know this is because the user has no permissions to write outside the home folder and tmp.

But if i try with sudo it fails as seen above (Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.). Tried with verbose output and all but nothing usable there.

g-bougard commented 4 years ago

But does your user have admin privileges ? (That was the question.)

I removed the run.sh script as it was only used for the service and I modified the service registration to not use it.

Can you try to run manually the postflight script from the Contents/Resources from a console like this:

cd ~/FusionInventory-Agent.pkg # or what ever is the installer folder
bash -x Content/Resources/postflight $PWD $HOME

This script tries to run some command with sudo and some may fails on Catalina. The output of bash -x Content/Resources/postflight $PWD $HOME may help to understand what we can't do under Catalina.

Can you also report the output of uname -r ? I may need this to adapt the script for Catalina if we found how to adapt the script.

laszlokertesz commented 4 years ago

The script ran directly from root seems to work.

bash -x Contents/Resources/postflight $PWD $HOME
+ PREFIX=/var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources
+ DEST=/var/root
+ INSTALL_PATH=/var/root/opt/fusioninventory-agent
+ echo 'Copying uninstall script to /var/root/opt/fusioninventory-agent'
Copying uninstall script to /var/root/opt/fusioninventory-agent
+ sudo chmod 700 /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/scripts/uninstaller.sh
+ sudo cp -af /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/scripts/uninstaller.sh /var/root/opt/fusioninventory-agent/
cp: directory /var/root/opt/fusioninventory-agent does not exist
+ sudo cp -af /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/agent.cfg /var/root/opt/fusioninventory-agent/etc/
cp: directory /var/root/opt/fusioninventory-agent/etc does not exist
+ '[' -d /var/root/opt/fusioninventory-agent/etc/conf.d ']'
+ sudo mkdir /var/root/opt/fusioninventory-agent/etc/conf.d
mkdir: /var/root/opt/fusioninventory-agent/etc: No such file or directory
+ '[' '!' -e /var/root/opt/fusioninventory-agent/etc/cacert.pem -o /var/root/opt/fusioninventory-agent/etc/cacert.pem -ot /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/cacert.pem ']'
+ sudo cp -af /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/cacert.pem /var/root/opt/fusioninventory-agent/etc/
cp: directory /var/root/opt/fusioninventory-agent/etc does not exist
+ sudo rm -f /usr/local/bin/dmidecode
+ sudo ln -s /var/root/opt/fusioninventory-agent/bin/dmidecode /usr/local/bin/dmidecode
ln: /usr/local/bin/dmidecode: No such file or directory
+ sudo chown -R root:wheel /var/root/opt/fusioninventory-agent
chown: /var/root/opt/fusioninventory-agent: No such file or directory
+ sudo chmod -R 755 /var/root/opt/fusioninventory-agent
chmod: /var/root/opt/fusioninventory-agent: No such file or directory
+ '[' /var/root '!=' / ']'
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/agent/setup.pm
sed: /var/root/opt/fusioninventory-agent/agent/setup.pm: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/agent/FusionInventory/Agent/Config.pm
sed: /var/root/opt/fusioninventory-agent/agent/FusionInventory/Agent/Config.pm: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/uninstaller.sh
sed: /var/root/opt/fusioninventory-agent/uninstaller.sh: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-agent
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-agent: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-esx
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-esx: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-injector
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-injector: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-inventory
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-inventory: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-netdiscovery
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-netdiscovery: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-netinventory
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-netinventory: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-remoteinventory
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-remoteinventory: No such file or directory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/var/root/opt/fusioninventory-agent|' /var/root/opt/fusioninventory-agent/bin/fusioninventory-wakeonlan
sed: /var/root/opt/fusioninventory-agent/bin/fusioninventory-wakeonlan: No such file or directory
+ echo 'Only Tiger or newer OS supported, using LaunchDaemons plists'
Only Tiger or newer OS supported, using LaunchDaemons plists
+ TPATH=/Library/LaunchDaemons/
+ cat
+ sudo mv -f /var/root/FusionInventory-Agent-2.5.2-teclib-2.pkg/Contents/Resources/org.fusioninventory.agent.plist /Library/LaunchDaemons/
+ sudo chown root:wheel /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ sudo chmod 644 /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ echo 'Loading Service'
Loading Service
+ sudo launchctl load /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ echo 'Starting Service'
Starting Service
+ sudo launchctl start org.fusioninventory.agent
+ sudo chflags -R hidden /var/root/opt
+ echo done
done
+ exit 0
g-bougard commented 4 years ago

@laszlokertesz This makes no sense to run the screen from another user than the one used for installation. In your output, you have many error like directory /var/root/opt/fusioninventory-agent/etc does not exist... This means you're telling the script the agent is installed in a not existing place... The service can't work so.

But did anyone tried to installed the agent as root with directly the installer command and with -target CurrentUserHomeDirectory option ?

laszlokertesz commented 4 years ago

But did anyone tried to installed the agent as root with directly the installer command and with -target CurrentUserHomeDirectory option ?

I tried running with '-target CurrentUserHomeDirectory':

g-bougard commented 4 years ago

And running the postflight script with bash -x Contents/Resources/postflight $PWD $HOME from the same admin account used to install the agent ?

laszlokertesz commented 4 years ago

Ok. After some trials i managed to get installation work in a few steps:

  1. First, unpacked the .pkg file (actually it is a directory).
  2. Installed the package with the user. This created $HOME/opt directory and subdirectories, but some scripts are missing. No issue, they will be created in the later steps. Command line (replace the package name with your actual package):
    installer -pkg ~/FusionInventory-Agent-2.5.2-test.pkg -target CurrentUserHomeDirectory
  3. cd to the pkg directory and run the preflight and postflight scripts from the /Contents/Resources directory"
    cd  ~/FusionInventory-Agent-2.5.2-test.pkg
    bash -x Contents/Resources/preflight $PWD $HOME
    bash -x Contents/Resources/postflight $PWD $HOME

    At a point a sudo password will be prompted, because some of the commands run with sudo to create services etc.

Here are the logs:

installer:

% installer -pkg ~/FusionInventory-Agent-2.5.2-test.pkg -target CurrentUserHomeDirectory 
installer: Package name is FusionInventory-Agent
installer: Upgrading at base path /Users/user
installer: The upgrade was successful.

preflight:

% bash -x Contents/Resources/preflight $PWD $HOME        
+ RES=/Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources
+ DEST=/Users/user
+ INSTALL_PATH=/Users/user/opt/fusioninventory-agent
+ '[' -e /Library/LaunchDaemons/org.fusioninventory.agent.plist ']'
+ read PID XXX
++ ps -ec -o pid,command
++ grep fusioninventory-agent
+ '[' '' '!=' '' ']'
+ SHA1=f58aab56ae82c7538e799e2ad585521fe16134d4
+ read SHA1CFG XXX
++ shasum /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/agent.cfg
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LC_ALL = (unset),
    LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
+ '[' f58aab56ae82c7538e799e2ad585521fe16134d4 == 649c5a0a248c42af85882c008d7dc12354b69d43 ']'
+ echo 'Will use new customized agent.cfg'
Will use new customized agent.cfg
+ exit 0

postflight:

% bash -x Contents/Resources/postflight $PWD $HOME
+ PREFIX=/Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources
+ DEST=/Users/user
+ INSTALL_PATH=/Users/user/opt/fusioninventory-agent
+ echo 'Copying uninstall script to /Users/user/opt/fusioninventory-agent'
Copying uninstall script to /Users/user/opt/fusioninventory-agent
+ sudo chmod 700 /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/scripts/uninstaller.sh
+ sudo cp -af /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/scripts/uninstaller.sh /Users/user/opt/fusioninventory-agent/
+ sudo cp -af /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/agent.cfg /Users/user/opt/fusioninventory-agent/etc/
+ '[' -d /Users/user/opt/fusioninventory-agent/etc/conf.d ']'
+ '[' '!' -e /Users/user/opt/fusioninventory-agent/etc/cacert.pem -o /Users/user/opt/fusioninventory-agent/etc/cacert.pem -ot /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/cacert.pem ']'
+ sudo cp -af /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/cacert.pem /Users/user/opt/fusioninventory-agent/etc/
+ sudo rm -f /usr/local/bin/dmidecode
+ sudo ln -s /Users/user/opt/fusioninventory-agent/bin/dmidecode /usr/local/bin/dmidecode
ln: /usr/local/bin/dmidecode: No such file or directory
+ sudo chown -R root:wheel /Users/user/opt/fusioninventory-agent
+ sudo chmod -R 755 /Users/user/opt/fusioninventory-agent
+ '[' /Users/user '!=' / ']'
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/agent/setup.pm
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/agent/FusionInventory/Agent/Config.pm
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/uninstaller.sh
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-agent
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-esx
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-injector
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-inventory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-netdiscovery
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-netinventory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-remoteinventory
+ for SCRIPT in agent/setup.pm agent/FusionInventory/Agent/Config.pm uninstaller.sh bin/fusioninventory-agent bin/fusioninventory-esx bin/fusioninventory-injector bin/fusioninventory-inventory bin/fusioninventory-netdiscovery bin/fusioninventory-netinventory bin/fusioninventory-remoteinventory bin/fusioninventory-wakeonlan
+ sudo sed -i -e 's|/opt/fusioninventory-agent|/Users/user/opt/fusioninventory-agent|' /Users/user/opt/fusioninventory-agent/bin/fusioninventory-wakeonlan
+ echo 'Only Tiger or newer OS supported, using LaunchDaemons plists'
Only Tiger or newer OS supported, using LaunchDaemons plists
+ TPATH=/Library/LaunchDaemons/
+ cat
+ sudo cp /Users/user/FusionInventory-Agent-2.5.2-test.pkg/Contents/Resources/org.fusioninventory.agent.plist /Library/LaunchDaemons//
+ sudo chown root:wheel /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ sudo chmod 644 /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ echo 'Loading Service'
Loading Service
+ sudo launchctl load /Library/LaunchDaemons//org.fusioninventory.agent.plist
+ echo 'Starting Service'
Starting Service
+ sudo launchctl start org.fusioninventory.agent
+ sudo chflags -R hidden /Users/user/opt
+ echo done
done
+ exit 0
laszlokertesz commented 4 years ago

And there was 1 issue. For some reason the

sudo mv -f "$PREFIX/org.fusioninventory.agent.plist" $TPATH

line from postflight was not working I changed it to

sudo cp "$PREFIX/org.fusioninventory.agent.plist" $TPATH/

And it was ok.

laszlokertesz commented 4 years ago

As for scripted installation, i ran the installer in the user then copied the opt directory and compressed it. For deployment i copy both this compressed archive and the pkg installer, unpack the opt it into the root's home folder then run the pre and postflight scripts from the pkg dir. A bit convoluter but it seems to be working for now, i look forward to have a functioning pkg...

g-bougard commented 4 years ago

I just released another test package for MacOSX. I hope it is now fixed for the few problem you saw on Catalina. Here it is: FusionInventory-Agent-2.5.2-teclib-3.pkg.tar.gz

@laszlokertesz please, don't run preflight after you installed the agent. This script is intended to stop the service and try to keep your configuration if it has been changed. So you still run it before you install and postfligh must always be started after the install.

osapsai commented 4 years ago

Hi @g-bougard! I have instaled FusionInventory-Agent-2.5.2-teclib-3.pkg.tar.gz throught gui instaler where had selected location to Aplications. Agent successfully was installed. But in web page no link "Force an Inventory". In config file is record "httpd-trust =..." When I go to http://hostname:62354/now I get "Access denied"

AntoineCourtil commented 4 years ago

Hi @g-bougard ,

Have you any news about this issue ? I have the same error as @osapsai. Install is okay via GUI but I can't force an Inventory, I get an "Access denied" and the "Next server target execution planned for" doesn't work.

Thx a lot, Antoine

g-bougard commented 4 years ago

I'm investigating an IPv6 support issue. You should check the agent journal in debug mode and look for such lines: [debug] [http server] GET request / from client ::ffff:127.0.0.1 Then you should set the reported IPv6 address in the httpd-trust parameter.

This problem occurs now as HTTP::Daemon module has been updated to support IPv6 natively.

g-bougard commented 4 years ago

fda1f5e2e6 shoud fix this last problem on MacOS.

AntoineCourtil commented 4 years ago

Thanks a lot for the quick action. So How can I rebuild the changes to have a .pkg file ?

g-bougard commented 4 years ago

Can you test the pre-release package for Mac I just published there ? FusionInventory-Agent-2.5.2-teclib-4.pkg.tar.gz

AntoineCourtil commented 4 years ago

After some tests, the new package works ! Thanks a lot !!!

osapsai commented 4 years ago

New package works! Thanks!

moobyfr commented 4 years ago

I'm testing this teclib-4 package on 10.15.1 and I still get an error. "Setup encountered an error ... The package tries to install content on the system volume." I tried with the Gui and using the command line: sudo installer -dumplog -pkg FusionInventory-Agent-2.5.2-teclib-4.pkg -target / 2> output.log

Here the head of the installer log

Nov  6 21:04:47  installer[42192] <Debug>: Referenced component packages (1) trustLevel=100
Nov  6 21:04:47  installer[42192] <Debug>: -[IFPKGDerivedDocument sortedPackageLocations]: result = (
            "file://localhost"
        )
Nov  6 21:04:47  installer[42192] <Debug>: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost
Nov  6 21:04:47  installer[42192] <Debug>: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/Users/e.blindauer/FusionInventory-Agent-2.5.2-teclib-4.pkg
Nov  6 21:04:47  installer[42192] <Debug>: Set authorization level to root for session
Nov  6 21:04:47  installer[42192] <Info>: Administrator authorization granted.
Nov  6 21:04:47  installer[42192] <Debug>: Will use PK session
Nov  6 21:04:47  installer[42192] <Debug>: Using authorization level of root for IFPKInstallElement
Nov  6 21:04:47  installer[42192] <Error>: Package Authoring Error: Package contains system volume install location content. Installation cannot proceed since installing to the system volume is not possible.
Nov  6 21:04:47  installer[42192] <Warning>: Package Authoring Error: Package contains system volume install location content, and installation will fail: Error Domain=IFInstallErrorDomain Code=-6000 "Ce paquet n’est pas compatible avec cette version de macOS." UserInfo={NSLocalizedRecoveryOptions=(
            Quitter
        ), IFReadOnlyPathsKey={(
            "/fusioninventory-agent/lib/site_perl/5.30.0/DateTime/Locale/en_SX.pod",
            "/fusioninventory-agent/agent/FusionInventory/Agent/Task/Inventory/Generic/Dmidecode.pm",
            "/fusioninventory-agent/lib/unicore/lib/Jg/Lam.pl",
g-bougard commented 4 years ago

@moobyfr If you had read all previous post here you would have tried this option: -target CurrentUserHomeDirectory in place of -target /

moobyfr commented 4 years ago

I saw this option, for me it's more a proof of concept to install it than a real solution. Fusion doesn't have anything to live in the homer from a user, the use can modify the configuration or remove it. And is deployed through a MDM solution, it will display a popup because the application want to access the User Data (MDMUA), which is a nonsense.

g-bougard commented 4 years ago

In Catalina case, in fact, you have to install agent with a dedicated user and this dedicated user should own admin privileges. This is not intended to be installed for a normal user. In your case, the admin user would not be intended to modify the configuration or remove it.

In Catalina, it is no more authorized to install under / target. I don't have any Catalina system on my hand to find a better solution. You can donate us such a system or require professional support as you seem to use the agent in a professional context.

moobyfr commented 4 years ago

Let's have real solution for reals problems. There is no restriction in catalina to write in /opt: it is firmlinked in the Data Volume in Catalina and it's available for FI (see https://eclecticlight.co/2019/10/11/macos-catalina-boot-volume-layout-revised-for-10-15-release/) I've fixed the problem in the teclib-4.pkg : the bom file has a relative path from ./fusioninventory-agent/ but the pax archive include the opt/ directory. I've rebuilded the bom file with ./opt/fusioninventory-agent/ and there is no more problem for installing it in a standard way.

You can find a updated package, with original Archive.bom.orig and the new one Archive.bom: https://seafile.unistra.fr/d/c5940484773d4e5aaee5/

g-bougard commented 4 years ago

As @moobyfr pointed us with nice details, we just need to fix our packaging. I'll release soon a last pre-release installer for test. If this is okay with that last installer for anyone here, next release (coming in few days) will be Catalina compliant (and without a trick).

g-bougard commented 4 years ago

Here it is: FusionInventory-Agent-2.5.2-teclib-5.pkg.tar.gz

Can anyone here test this package so I can base the coming 2.5.2 agent on this packaging ?

This pre-release also include a 64 bits dmidecode to fix #711.

@moobyfr can you confirm this package is working as you expect ? Also, can I ask you to remove the FusionInventory-Agent-2.5.2-teclib-5.pkg.tgz package you published to avoid any confusion (and as you're not working for Teclib) ?

SynCinatti commented 4 years ago

Hello,

i can confirm that this pre-release works on Catalina, installs from gui and sends inventory to fusion like a charm.

Skouat commented 4 years ago

@g-bougard the package teclib-5 works on Catalina

moobyfr commented 4 years ago

works for me too (I had to made a dmg, because the pkg is a bundle package)

g-bougard commented 4 years ago

Hi @moobyfr thank you for your feedback, for the dmg packaging, have you a simple process to transform pkg into dmg ? Maybe we can also provide it if it's easy to implement.

moobyfr commented 4 years ago

It's easy:

xattr -d com.apple.quarantine FusionInventory-Agent-2.5.2-teclib-5.pkg
hdiutil create -fs "HFS+" -srcfolder FusionInventory-Agent-2.5.2-teclib-5.pkg FusionInventory-Agent-2.5.2-teclib-5.dmg

The xattr -d is needed to prevent having an error "XXX can't be opened because it is from an unidentified developer."

agudinop commented 4 years ago

Hi.

I have performed the agent installation, as indicated but this does not report to my server.

I have configured the file "agent.cfg", with the parameters of my server

Upon entering the page, localhost: 62354, to force the inventory indicates "This site cannot be accessed".

Any of you can tell me if you report to your server or what I may be doing wrong.

Thanks.