Difference between revisions of "App Install"

From Amahi Wiki
Jump to: navigation, search
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{WorkInProgress}}
+
__TOC__
 +
 
 
Occasionally Amahi [https://www.amahi.org/apps applications] fail to install properly.  This is often noted by error messages in the application install log (/var/log/amahi-app-install.log).  
 
Occasionally Amahi [https://www.amahi.org/apps applications] fail to install properly.  This is often noted by error messages in the application install log (/var/log/amahi-app-install.log).  
  
Line 13: Line 14:
 
Your HDA services have been restarted.
 
Your HDA services have been restarted.
 
mv: cannot stat ‘unpack’: No such file or directory
 
mv: cannot stat ‘unpack’: No such file or directory
cp: cannot stat ‘html/sample.config.inc.php’: No such file or directory
 
 
sed: can't read html/config.inc.php: No such file or directory
 
sed: can't read html/config.inc.php: No such file or directory
mv: cannot move ‘./transmission/class.ext.transmission.php’ to ‘./html/lib’: No
 
such file or directory
 
 
chown: cannot access ‘html/lib’: No such file or directory
 
chown: cannot access ‘html/lib’: No such file or directory
 
/tmp/run_script20140503-14160-1huv0uh: line 47: html/config.inc.php: No such fil
 
/tmp/run_script20140503-14160-1huv0uh: line 47: html/config.inc.php: No such fil
Line 25: Line 23:
 
Other times, you may receive notice in the Dashboard.   
 
Other times, you may receive notice in the Dashboard.   
  
[[File:DashboardAppError.png|750px]]
+
[[File:DashboardAppError.png|850px]]
  
We take these seriously and have tried to incorporate additional error checking/prevention methods.  Unfortunately they don't catch everything.
+
We take these seriously and have incorporated additional error checking/prevention methods.  Unfortunately they don't catch everything.
  
 +
= Reasons for Failure =
 
Reasons for failure vary, but the most common are:
 
Reasons for failure vary, but the most common are:
* Slow or sporadic internet connection.
+
<ul><li> Network connection
* Install script:
+
<small><pre>#<RuntimeError: run_script had to KILL this script. it was taking too long. sorry.>,
** Taking too long
+
/var/hda/platform/html/lib/system_utils.rb:66:in `run_script',
<small><pre>=======  app install begin      @  2014-05-03 14:33:00 -0400 ==========
+
/var/hda/platform/html/app/models/app.rb:241:in `block in install_bg',
Installing  app id yi7uxa8mlb under /var/hda/platform/html/script/.. ENV=production
+
/var/hda/platform/html/app/models/app.rb:240:in `chdir',
Your HDA services have been restarted.
+
/var/hda/platform/html/app/models/app.rb:240:in `install_bg',
Your HDA services have been restarted.
+
/var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
NOTE: file /var/hda/tmp/amahi-download-cache/956319338e8752e6a8f544423df61187d8b7e320 written in cache
+
/var/hda/platform/html/script/install-app:107:in `main',
/var/hda/platform/html/lib/system_utils.rb:66:in `run_script': run_script had to
+
/var/hda/platform/html/script/install-app:119:in `<main>'</pre></small></li>
KILL this script. it was taking too long. sorry. (RuntimeError)
+
<li> Insufficient privileges
        from /var/hda/platform/html/app/models/app.rb:241:in `block in install_bg'
+
<small><pre>#<Errno::EACCES: Permission denied @ dir_s_mkdir - /var/hda/web-apps/bandwidthd>,
        from /var/hda/platform/html/app/models/app.rb:240:in `chdir'
+
/usr/share/ruby/fileutils.rb:252:in `mkdir',
        from /var/hda/platform/html/app/models/app.rb:240:in `install_bg'
+
/usr/share/ruby/fileutils.rb:252:in `fu_mkdir',
        from /var/hda/platform/html/script/install-app:86:in `install_or_uninstall'
+
/usr/share/ruby/fileutils.rb:226:in `block (2 levels) in mkdir_p',
        from /var/hda/platform/html/script/install-app:107:in `main'
+
/usr/share/ruby/fileutils.rb:224:in `reverse_each',
        from /var/hda/platform/html/script/install-app:119:in `<main>'</pre></small>
+
/usr/share/ruby/fileutils.rb:224:in `block in mkdir_p',
** Incorrect syntax
+
/usr/share/ruby/fileutils.rb:210:in `each',
** Insufficient privileges
+
/usr/share/ruby/fileutils.rb:210:in `mkdir_p',
* Application source file is unavailable.
+
/var/hda/platform/html/app/models/app.rb:364:in `mkdir',
** New version
+
/var/hda/platform/html/app/models/app.rb:440:in `install_webapp',
** File moved
+
/var/hda/platform/html/app/models/app.rb:208:in `install_bg',
** Wrong SHA1 hash
+
/var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
 +
/var/hda/platform/html/script/install-app:107:in `main',
 +
/var/hda/platform/html/script/install-app:119:in `<main>'</pre></small></li>
 +
:To correct, as ''root'' user (or precede with <code>sudo</code>) do:
 +
chown -R apache:users /var/hda/web-apps
 +
<li> Source file is unavailable:
 +
<ul>
 +
<li> New version</li>
 +
<li> File moved</li>
 +
<li> Wrong SHA1 hash</li></ul>
 
<small><pre>WARNING: primary downloaded file /tmp/amahi-download-
 
<small><pre>WARNING: primary downloaded file /tmp/amahi-download-
 
cache/b224eae4f30c011cbe6eae3c81d662f199eaa85f did not pass signature check - got  
 
cache/b224eae4f30c011cbe6eae3c81d662f199eaa85f did not pass signature check - got  
 
2da58737f99c63f47983db27789cf4b989975220, expected  
 
2da58737f99c63f47983db27789cf4b989975220, expected  
 
b224eae4f30c011cbe6eae3c81d662f199eaa85f</pre></small>
 
b224eae4f30c011cbe6eae3c81d662f199eaa85f</pre></small>
 +
<li>No space left on root (/) partition
 +
<small><pre>#<Errno::ENOSPC: No space left on device @ io_write - /var/hda/tmp/amahi-download-cache/3ab7164c607c124b97e08dd25d3a9712afebde2b>,
 +
/var/hda/platform/html/lib/downloader.rb:100:in `write',
 +
/var/hda/platform/html/lib/downloader.rb:100:in `block in download',
 +
/var/hda/platform/html/lib/downloader.rb:100:in `open',
 +
/var/hda/platform/html/lib/downloader.rb:100:in `download',
 +
/var/hda/platform/html/lib/downloader.rb:50:in `download_and_check_sha1',
 +
/var/hda/platform/html/app/models/app.rb:200:in `install_bg',
 +
/var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
 +
/var/hda/platform/html/script/install-app:107:in `main',
 +
/var/hda/platform/html/script/install-app:119:in `<main>'</pre></small></li>
 +
:Empty the ''/var/hda/tmp/amahi-download-cache'' directory.
 +
rm -rf /var/hda/tmp/amahi-download-cache/*
 +
</ul>
  
 +
= Recipe for Success =
 
There are some recommendation users can follow to help correct or prevent these problems.
 
There are some recommendation users can follow to help correct or prevent these problems.
  
<b>DON'T:</b>
+
<b><big>DON'T</big></b>
 
# Refresh your web browser or navigate from the page while an application is installing.
 
# Refresh your web browser or navigate from the page while an application is installing.
 
# Try to install an application after it initially fails.  Need to diagnose issue.
 
# Try to install an application after it initially fails.  Need to diagnose issue.
  
  
<b>DO:</b>
+
<b><big>DO</big></b>
# Check the log for details of why the app install failed.
+
# Look at the log for details of why the app install failed.
# Check the Dashboard Apps tab, Installed section for the app.
+
# View the Dashboard Apps tab, Installed section for the app.
 
# Check /var/hda/web-apps to ensure the app did not partially install.
 
# Check /var/hda/web-apps to ensure the app did not partially install.
# File a [https://bugs.amahi.org bug report].
+
# Search the [https://forums.amahi.org forums] for a similar issue and potential solution.
 +
# Visit the IRC, [http://webchat.freenode.net/?channels=amahi #amahi] channel for immediate assistance.
 +
# [[Submit Bug Report|Submit a bug report]].  Provide details to help with [[App_troubleshooting|debugability]] of the issue.
  
<!--== MANUAL CLEAN UP ==
+
= Clean Up Failed Web App Install =
An application install was unsuccessful, but it appears partially installed.  To return your HDA to a safe state for another install attempt, the following may help:
+
<div style="border: 1px solid #A3B1BF; padding: .8em 1em; background-color: #E6F2FF; margin: 0px 1em;">'''DISCLAIMER:'''  The steps below should '''ONLY''' be attempted by advanced users.  If you don't know what you are doing, recommend you seek professional assistance or you could break your HDA!</div>
* Check /var/hda/web-apps directory and look for the app.   
+
 
** The application short URL is the name of the directoryFor example, Adminer would be adminer.
+
 
** Remove the directory
+
'''NOTE:''' We will use '''owncloud''' as an example of the application that failed to install.
* Check the HDA database (hda_production, apps table)
+
 
** Look to see if there is an entry for the app that failed to install correctly.
+
A web app install was unsuccessful, but it appears partially installed.  This often happens and repeatedly trying to install without clean up results in multiple failed attempts.  For example, 4 failed attempts of [https://www.amahi.org/apps/owncloud ownCloud] would create ''owncloud'', ''owncloud1'', ''owncloud2'', ''owncloud3''.
** Remove that row if it exists.
+
 
<pre>MariaDB [hda_production]> select id,name from webapps;
+
To return your HDA to a safe state for another install attempt, the following may help:
 +
* Navigate to the ''Network'' tab, ''DNS Aliases'' section in the Amahi Dashboard
 +
** Make note of the URL name(s)
 +
** Remove each entry for the failed application by selecting ''Delete''
 +
* If the app has a database, execute the following command:
 +
hda-create-db-and-user -d owncloud
 +
<ul>
 +
<li>The next steps must be done from the command line as ''root'' user:</li>
 +
<ul>
 +
<li>Navigate to /etc/httpd/conf.d and determine file(s) to remove</li>
 +
ls -al
 +
<li>Remove each ####-app.conf (substitute the number for #### and URL name for app) file</li>
 +
cd /etc/httpd/conf.d
 +
  rm -rf 1001-owncloud.conf
 +
rm -rf 1002-owncloud1.conf
 +
rm -rf 1003-owncloud2.conf
 +
rm -rf 1004-owncloud3.conf
 +
<li>Then as ''root'' user, restart apache</li>
 +
  sysemctl restart httpd
 +
<li>Next, navigate to /var/hda/web-apps</li>
 +
cd /var/hda/web-apps
 +
<li>Remove each app directory</li>
 +
rm -rf owncloud
 +
rm -rf owncloud1
 +
rm -rf owncloud2
 +
rm -rf owncloud3
 +
</ul></ul>
 +
* Finally check the HDA database ''hda_production'' (''webapps'' table)
 +
** Look to see if there is an entry for each app that failed to install correctly.
 +
** Remove the row(s) that exist for the app (i.e. id 4, 5, 6, and 7)
 +
<br />
 +
:'''EXAMPLE'''
 +
<blockquote><pre>MariaDB [hda_production]> select id,name from webapps;
 
+----+------------+
 
+----+------------+
 
| id | name      |
 
| id | name      |
 
+----+------------+
 
+----+------------+
 
|  1 | phpsysinfo |
 
|  1 | phpsysinfo |
|  2 | cups      |
+
|  4 | owncloud  |
|  4 | zm        |
+
|  5 | owncloud1  |
|  5 | zm1        |
+
|  6 | owncloud2  |
|  6 | zm2        |
+
|  7 | owncloud3 |
|  7 | zm3        |
 
|  8 | zm4        |
 
| 9 | zm5        |
 
| 10 | zm6        |
 
| 12 | zm7        |
 
| 14 | zm8        |
 
 
+----+------------+
 
+----+------------+
11 rows in set (0.00 sec)</pre>
+
5 rows in set (0.00 sec)</pre></blockquote>
* Check /etc/httpd/conf.d directory for a file that is associated with the app** For example, 1001-adminer.conf would be for Adminer.
+
 
** If it exists, remove it.1
+
The safest way is to use a web application such as [https://www.amahi.org/apps/adminer Adminer] or [https://www.amahi.org/apps/phpmyadmin phpMyAdmin].  TO do it via command line, execute the command below for each ''id' that needs to be deleted from the database:
** Restart httpd.service-->
+
echo "delete from webapps where id=2" | mysql -uroot -p hda_production
 +
 
 +
::'''WARNING:''' Please see [[Database Root Password]] for the appropriate login password.
 +
 
 +
Once these steps are complete, it should be safe to try and install the applicationMonitor the '''/var/log/amahi-app-installer.log''' file for progress and errors via command line:
 +
tail -f /var/log/amahi-app-installer.log
 +
 
 +
If the app continues to fail, recommend you seek professional assistance by [[Submit Bug Report|submitting a bug report]].
 +
 
 +
 
 +
Back to the [[Troubleshooting]].

Latest revision as of 03:37, 18 June 2017

Occasionally Amahi applications fail to install properly. This is often noted by error messages in the application install log (/var/log/amahi-app-install.log).

=======  app install begin      @  2014-05-03 07:42:37 -0500 ==========
Installing   app id qf1tweahyo under /var/hda/platform/html/script/.. ENV=produc
tion
NOTICE: redirected 'http://downloads.sourceforge.net/project/linfo/Linfo%20Stabl
e%20Releases/linfo-1.11.tar.gz' --> 'http://iweb.dl.sourceforge.net/project/linf
o/Linfo%20Stable%20Releases/linfo-1.11.tar.gz' ...
file /var/hda/tmp/amahi-download-cache/9306c736dc7197b9a3ed6b4c9395d4ab6e779a48
written in cache
Your HDA services have been restarted.
Your HDA services have been restarted.
mv: cannot stat ‘unpack’: No such file or directory
sed: can't read html/config.inc.php: No such file or directory
chown: cannot access ‘html/lib’: No such file or directory
/tmp/run_script20140503-14160-1huv0uh: line 47: html/config.inc.php: No such fil
e or directory
App: Linfo installed
=======  app install end        @  2014-05-03 07:42:43 -0500 ==========

Other times, you may receive notice in the Dashboard.

DashboardAppError.png

We take these seriously and have incorporated additional error checking/prevention methods. Unfortunately they don't catch everything.

Reasons for Failure

Reasons for failure vary, but the most common are:

  • Network connection
    #<RuntimeError: run_script had to KILL this script. it was taking too long. sorry.>,
    /var/hda/platform/html/lib/system_utils.rb:66:in `run_script',
    /var/hda/platform/html/app/models/app.rb:241:in `block in install_bg',
    /var/hda/platform/html/app/models/app.rb:240:in `chdir',
    /var/hda/platform/html/app/models/app.rb:240:in `install_bg',
    /var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
    /var/hda/platform/html/script/install-app:107:in `main',
    /var/hda/platform/html/script/install-app:119:in `<main>'
  • Insufficient privileges
    #<Errno::EACCES: Permission denied @ dir_s_mkdir - /var/hda/web-apps/bandwidthd>,
    /usr/share/ruby/fileutils.rb:252:in `mkdir',
    /usr/share/ruby/fileutils.rb:252:in `fu_mkdir',
    /usr/share/ruby/fileutils.rb:226:in `block (2 levels) in mkdir_p',
    /usr/share/ruby/fileutils.rb:224:in `reverse_each',
    /usr/share/ruby/fileutils.rb:224:in `block in mkdir_p',
    /usr/share/ruby/fileutils.rb:210:in `each',
    /usr/share/ruby/fileutils.rb:210:in `mkdir_p',
    /var/hda/platform/html/app/models/app.rb:364:in `mkdir',
    /var/hda/platform/html/app/models/app.rb:440:in `install_webapp',
    /var/hda/platform/html/app/models/app.rb:208:in `install_bg',
    /var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
    /var/hda/platform/html/script/install-app:107:in `main',
    /var/hda/platform/html/script/install-app:119:in `<main>'
  • To correct, as root user (or precede with sudo) do:
    chown -R apache:users /var/hda/web-apps
    
  • Source file is unavailable:
    • New version
    • File moved
    • Wrong SHA1 hash
    WARNING: primary downloaded file /tmp/amahi-download-
    cache/b224eae4f30c011cbe6eae3c81d662f199eaa85f did not pass signature check - got 
    2da58737f99c63f47983db27789cf4b989975220, expected 
    b224eae4f30c011cbe6eae3c81d662f199eaa85f
  • No space left on root (/) partition
    #<Errno::ENOSPC: No space left on device @ io_write - /var/hda/tmp/amahi-download-cache/3ab7164c607c124b97e08dd25d3a9712afebde2b>,
    /var/hda/platform/html/lib/downloader.rb:100:in `write',
    /var/hda/platform/html/lib/downloader.rb:100:in `block in download',
    /var/hda/platform/html/lib/downloader.rb:100:in `open',
    /var/hda/platform/html/lib/downloader.rb:100:in `download',
    /var/hda/platform/html/lib/downloader.rb:50:in `download_and_check_sha1',
    /var/hda/platform/html/app/models/app.rb:200:in `install_bg',
    /var/hda/platform/html/script/install-app:86:in `install_or_uninstall',
    /var/hda/platform/html/script/install-app:107:in `main',
    /var/hda/platform/html/script/install-app:119:in `<main>'
  • Empty the /var/hda/tmp/amahi-download-cache directory.
    rm -rf /var/hda/tmp/amahi-download-cache/*
    

Recipe for Success

There are some recommendation users can follow to help correct or prevent these problems.

DON'T

  1. Refresh your web browser or navigate from the page while an application is installing.
  2. Try to install an application after it initially fails. Need to diagnose issue.


DO

  1. Look at the log for details of why the app install failed.
  2. View the Dashboard Apps tab, Installed section for the app.
  3. Check /var/hda/web-apps to ensure the app did not partially install.
  4. Search the forums for a similar issue and potential solution.
  5. Visit the IRC, #amahi channel for immediate assistance.
  6. Submit a bug report. Provide details to help with debugability of the issue.

Clean Up Failed Web App Install

DISCLAIMER: The steps below should ONLY be attempted by advanced users. If you don't know what you are doing, recommend you seek professional assistance or you could break your HDA!


NOTE: We will use owncloud as an example of the application that failed to install.

A web app install was unsuccessful, but it appears partially installed. This often happens and repeatedly trying to install without clean up results in multiple failed attempts. For example, 4 failed attempts of ownCloud would create owncloud, owncloud1, owncloud2, owncloud3.

To return your HDA to a safe state for another install attempt, the following may help:

  • Navigate to the Network tab, DNS Aliases section in the Amahi Dashboard
    • Make note of the URL name(s)
    • Remove each entry for the failed application by selecting Delete
  • If the app has a database, execute the following command:
hda-create-db-and-user -d owncloud
  • The next steps must be done from the command line as root user:
    • Navigate to /etc/httpd/conf.d and determine file(s) to remove
    • ls -al
    • Remove each ####-app.conf (substitute the number for #### and URL name for app) file
    • cd /etc/httpd/conf.d rm -rf 1001-owncloud.conf rm -rf 1002-owncloud1.conf rm -rf 1003-owncloud2.conf rm -rf 1004-owncloud3.conf
    • Then as root user, restart apache
    • sysemctl restart httpd
    • Next, navigate to /var/hda/web-apps
    • cd /var/hda/web-apps
    • Remove each app directory
    • rm -rf owncloud rm -rf owncloud1 rm -rf owncloud2 rm -rf owncloud3
  • Finally check the HDA database hda_production (webapps table).
    • Look to see if there is an entry for each app that failed to install correctly.
    • Remove the row(s) that exist for the app (i.e. id 4, 5, 6, and 7)


EXAMPLE
MariaDB [hda_production]> select id,name from webapps;
+----+------------+
| id | name       |
+----+------------+
|  1 | phpsysinfo |
|  4 | owncloud   |
|  5 | owncloud1  |
|  6 | owncloud2  |
|  7 | owncloud3  |
+----+------------+
5 rows in set (0.00 sec)

The safest way is to use a web application such as Adminer or phpMyAdmin. TO do it via command line, execute the command below for each id' that needs to be deleted from the database:

echo "delete from webapps where id=2" | mysql -uroot -p hda_production
WARNING: Please see Database Root Password for the appropriate login password.

Once these steps are complete, it should be safe to try and install the application. Monitor the /var/log/amahi-app-installer.log file for progress and errors via command line:

tail -f /var/log/amahi-app-installer.log

If the app continues to fail, recommend you seek professional assistance by submitting a bug report.


Back to the Troubleshooting.