httpServer app can't link to lighttpd

When started httpServer fails with these messages:

Aug 13 12:31:54 swi-mdm9x28-wp user.err Legato: =ERR= | supervisor[910]/supervisor T=main | app.c CreateFileLink() 2140 | Could not create file '/legato/systems/current/appsWriteable/httpServer/bin/lighttpd'.  Read-only file system
Aug 13 12:31:54 swi-mdm9x28-wp user.err Legato: =ERR= | supervisor[910]/supervisor T=main | app.c CreateFileLink() 2159 | Failed to create link at '/bin/lighttpd' in app 'httpServer'.

Relevant line in httpServer.adef (unmodified):

requires:
{
    file:
    {
      ....
        /legato/systems/current/apps/httpServer/read-only/bin/lighttpd /app/bin/lighttpd
    }

lighttpd is at the specified location on the WP7702 file system. Thanks for any ideas.

how about changing the required directory like below:

dir:
{
/proc / // needed by app script, and for listing running processes
/bin /usr/bin
/sbin /
/legato/systems/current/bin /legato/systems/current/
/legato/systems/current/lib /legato/systems/current/
/legato/systems/current/apps /legato/systems/current/
}

1 Like

Thanks server now runs and displays index.html. Original directory was:

    dir:
    {
        /proc /    // needed by `app` script, and for listing running processes
        /bin /
        /sbin /
        /usr/lib /usr/
        /usr/bin /usr/
        /usr/include /usr/
        /legato/systems/current/bin /legato/systems/current/
        /legato/systems/current/lib /legato/systems/current/
        /legato/systems/current/apps /legato/systems/current/
    }

iptables commands for anyone interested:

iptables -A INPUT -p tcp --dport 8080 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 8080 -m conntrack --ctstate ESTABLISHED -j ACCEPT

However clicking on one of the links (to python script) gives “500 - Internal Server Error”. Unable to start script for some reason?

Where do you run the python script?

This httpserver should be working on 19.10.0.rc3_WP76xx.
Maybe you can give a try on this legato version or above.
Also please check logread and see if there is SMACK issue.

I found that you can modify as following to overcome “500 - Internal Server Error”:

dir:
{
/proc / // needed by app script, and for listing running processes

/*
/bin /usr/bin
/sbin /
*/
/usr/lib /usr/
/usr/bin /usr/
/usr/include /usr/

/legato/systems/current/bin /legato/systems/current/
/legato/systems/current/lib /legato/systems/current/
/legato/systems/current/apps /legato/systems/current/
}

Thanks for the reply, I am still getting that HTTP 500 error message. And when I try to right click and save the .py on my computer it saves a web page with the HTTP 500 message.

I see this log message when I start up httpServer:

Aug 17 15:06:44 swi-mdm9x28-wp user.notice kernel: [22314.249780] audit: type=1400 audit(1597676804.719:13): lsm=SMACK fn=smack_inode_getattr action=denied subject="app.httpServer" object="admin" requested=r pid=8755 comm="lighttpd" path="pipe:[122222]" dev="pipefs" ino=122222

I am building the httpServer under Legato 19.07.0, the WP7702 is running 19.11.0_293d1395d26f2a2b136ae78fe9885901_modified. I tried building the httpServer under Legato 19.11.0 but I get this message:

WARNING: can't open config file: /opt/swi/SWI9X06Y_02.32.02.00/sysroots/x86_64-pokysdk-linux/usr/lib/ssl/openssl.cnf

I don’t see problem to run in WP76 FW R13 with legato 19.2 with above modifciation on adef file.
No HTTP 500 error message is found.

R13 is not released yet for the WP77/ mangOH loads, maybe I will wait and try again then as I do not need this functioning immediately. Thanks for your help.

Rebuilt httpServer using source code from legato-19.07.0/apps/sample/ and installed under red_wp77xx_0.6.0.spk and it now works.

root@swi-mdm9x28-wp:~# cm info
Firmware Version: SWI9X06Y_02.35.02.00 5208b3 jenkins 2020/06/10 00:30:12
...
root@swi-mdm9x28-wp:~# legato version
19.11.2_625c7d1acfd1ca45b2dbe189b4cb1ce7_modified

Thanks again, hope this info will be useful.

Sorry for replying to an old thread. But why is the python input from shell() missing? (Date, uptime, Legato version etc.) It’s working when I run the python script from command line but missing on my end as well.
(My test system is WP7607 with R16.0 and Legato 20.08)

You might run this and see what happens

Thanks @jyijyi for the fast reply.

I was on branch 20.08 and somehow had not noticed the changes to httpServer 2 months ago.
Tried the updated files from httpServer master but got “ERR_CONNECTION_REFUSED”. Maybe it’s not compatible with legato 20.08 as there are som framework changes in the commit.

Also tried the updated diagnostics.sh wth the 20.08 version of httpServer but I get " 500 - Internal Server Error" when opening diagnostics.sh. Runs ok in command line.

have you tried to shut down firewall by:

iptables -I INPUT -j ACCEPT

1 Like

Yes, still 500 - Internal Server Error

are you using WP76?
did you change as said above ?

1 Like

Yes, WP7607.
Got it working now! :grinning:
bin and sbin had to be added again:

  /proc /    // needed by `app` script, and for listing running processes
    /bin /
    /sbin /
    /usr/lib /usr/
    /usr/bin /usr/
    /usr/include /usr/
    /legato/systems/current/bin /legato/systems/current/
    /legato/systems/current/lib /legato/systems/current/
    /legato/systems/current/apps /legato/systems/current/

Thanks @jyijyi for pointing me in the right direction :+1: