ETC as running ftp or ssh instead of webserver


#1

Before I start inventing the wheel again :wink: did anyone out there modify ETCs arch linux from fixed IP node with WiFi server to a Wifi-client with DHCP?

I have to admit, that I am quite annoyed of the edit handling.
To read python documentation or similar in the net I have always to switch the network.
To transport images to the USB stick I have to shut down ETC, move the stick to the computer, copy, move back, boot,…

It would be much easier, if the network setup would be a wifi client with DHCP or fixed IP address. Then one could run a ftp or ssh daemon running (instead of the webserver), and upload and organize all files. Editing could be done with my favorite editor. etc. pp.

So: did anyone do that?


#2

To have the ETC connect to an existing network instead of creating an access point, change the WiFi.sh file on the USB drive. Comment out the line

create_ap wlan0 eth0 NETWORK_NAME PASSWORD &

and add the lines

wpa_supplicant -B -D nl80211,wext -i wlan0 -c <(wpa_passphrase "NETWORK_NAME" "PASSWORD") 
dhcpcd

replacing name and pw with those of network. now it should join existing network. make sure network is 2.4 GHz!

ssh still not available, but you can run this mode to enable ssh. This also creates a web file manager running at whatever the ip is for transferring files (check on screen display for ip). The editor will still be running on port 8080. ssh user and pw is root.

0-WebFiles.zip (1.4 MB)


#3

Ah great. Thanks! I had experimented wih wpa_supplicant already, but appearently I missed the right driver name.

With your commandline it works like charm.

Regarding the 0-WebFiles: which URL do I have to invoke? I tried
192.168.178.36:8080/static/fm/index.html but nothing happened.


#4

https://patchstorage.com/0-webfiles/


#5

that’s clear. No, I meant which link do I have to call after I invoked the 0-webfiles Mode.
It must be something like 192.168.12.1:8080/static/fm/index.html
(at least this subdir exists on the static-subfolder of the 0-webfiles dir, and it contains the right index.html).

But meanwhile I choose to go a different direction.
I use the WiFi client configuration explained above by @oweno which allows me to access the USB-drive in the ETC directly from my machine. At the moment I use ssh/scp, but I will export the filesystem on the ETC, and mount the directory directly on my Mac Book.
That is much easier for the filetransfer than the webbased GUI (at least for me, as I have to handle Linux / Unix in my dayjob).

Nevertheless thank you for trying to help!


#6

you want to loose the 8080 port, so:

192.168.178.36/static/index.html

how do you manage this? sounds like a good solution!


#7

See https://wiki.archlinux.org/index.php/NFS
You create /etc/exports and add the path which shall be exported (in this case /usbdrive)
Then you start the nfs-server (systemctl nfs-server.service enable or start)
On the Mac side it is simply adding a remote filesystem

For Windows you’d need a Samba server (https://wiki.archlinux.org/index.php/Samba)

I did not do it with arch linux yet, but in other unixes I did this a thousand times. I am not sure how much these services would affect the memory usage. It won’t be much, but for sure it will.


#8

BTW: I found that sometimes the python process hangs in this network configuration. It happens about two or three seconds after the first Mode started. While these few seconds I can use the knobs and buttons, but after that the screen freezes and the buttons do no longer react. The linux itself is running fine.

It does not always but it happens.

I added stdout and stderr redirection to the start command in /root/ETC_Sys/scripts/start-etc.sh like
echo "#################date############" >> /tmp/etc.log
python2 main.py >> /tmp/etc.log 2>&1 &
But the output is quite poor

#################Sat Oct 17 01:07:27 UTC 2015############
Failed to symlink /root/.config/pulse/0ad93370e24141368e4ae814b5796c88-runtime.tmp to /tmp/pulse-PKdhtXMmr18n: Read-only file system
Failed to symlink /root/.config/pulse/0ad93370e24141368e4ae814b5796c88-runtime.tmp: Read-only file system
libpng warning: iCCP: known incorrect sRGB profile

dmesg doesn’t report anything unusual.

Do we have any other possibility to see, what python is doing here? Do truss / tusc / strace / trace exist in arch linux?


#9

is python crashing? (i.e. is the python process still running after its freezing?)

you could install strace via pacman

I actually quite like the web editor, the only thing i dont like is the left hand pane, where the files and save options are… I think the save options, probably should be buttons at the top, so they are always available without having to scroll thru the whole mode list.

I think when I get time I might take at look at improving the editor, as its pretty sound otherwise, and the workflow when developing modes is really fast :slight_smile:

btw… if you do want to edit remotely, you’ll also want to look at the osc messages that is used to tell ETC/python that the file has change, and so to reload the mode… you can find this either in the web editor code, or osc.py.
(sorry cant remember the message off-hand)

btw… if your going down the route of remote editing , Id also recommend switching to using the sdcard for storing modes, see my organelle post on this… this only requires a very small change in etc_system.py, my experience is the sdcard is much more reliable than usbsticks.
(and frees up the usb ports for midi controller(s) without needing to carry around a usb hub as well :wink: )


#10

The process still exists, but it needs a kill -9. I can’t say whether it hangs in a loop or is really stuck. That is, why I’d like to strace it.

Btw: I have the same opinions on the webbased editor (if you ever move the save buttons to the top, then please also make the sort order alphabetical). My goal is not to replace the editor, but I mostly want to handle image files or fonts and also organizing modes (adding / removing / renaming …) is much easier with a usual filesystem access.


#11

hmm, and its not animating still? or just not responding to controls?
if its not animating, probably an issue with pygame - perhaps blocked in its main loop.
if it just not responding to controls it could be the etc daemon process has crashed (this routes from the micro controller to python via osc)

as you say, hard to know without more info… anyway strace should be installable, it is on my organelle.
(sorry i dont have an ETC to test with so cant look into the real cause, as it’ll be different on the organelle/otc)

web editor, yeah agreed…
what I do when i want to organise things (or do quick edits ;)) is log in via SSH and then do them directly on the box - its faster for me, than using remote filesystems etc.
… also means I can restart processes where necessary, which you sometimes have to do as ETC caches things in memory.


#12

It is not animating. So it looks like the pygame is blocked.

I will install strace as next step. (I hope I won’t destroy the linux installation :wink: )

Yepp. I recognized that too. I made an mistake in programming, corrected it, but the behaviour stayed the same. I found that it helps, if I remove the pyc file, befor I save the Mode. It looks like python refills its caches when it compiles.


#13

Hi

I just wanted let you know the solution for the hang:
I found that it is not wise to start the Network client (dhcpcd in the example given by @oweno above), while python is running already.
So I moved the WiFi initialisation in /root/ETC_Sys/scripts/setup.sh in front of the start-etc.sh:

It is nowlike this:

        export SDL_VIDEODRIVER=fbcon

        #etc-start moved after Wifi.sh
        #/root/ETC_Sys/scripts/start-etc.sh

        # try to start wifi if there is a config file
        # and start the web interface
        if [ -f /usbdrive/WiFi.sh ]; then
                echo "wifi usb adapter found"
                /usbdrive/WiFi.sh
        fi
        pause 1

        /root/ETC_Sys/scripts/start-etc.sh

        if [ -f /usbdrive/WiFi.sh ]; then
                cd /root/ETC_Web
                ./run.sh &
        fi

#14

interesting… thanks for sharing this fix!


#15

I am happy that I can help to make this nice product even better.

I found that out, when I replaced python2 main.py in start-etc.sh by strace -o /tmp/strace_etc.out.txt python2 main.py. This causes python to run much slower.
With this “slowed down version” of python, the problem did not appear.

My interpretation is, that there is a kind of Xserver running, to which the display of python is sent. If we change the network setting we change in consequence maybe also the $DISPLAY setting (if I had the on screen display activated I still saw the 127.0.0.1 though I could access the ETC under its 192.168… address) Python might not like it, that the IP / display variable change happens while it is trying to write one of the 30 frames.
With the move of the WLAN startup the new $DISPLAY variable is already set, when python starts.

Best regards
Florian


#16

Hi

I did this change. It is dead easy:

edit /root/ETC_Web/static/index.html
search for “body>”

change the body-content. It should look like this:

  <body>
    <div id="menu" >
      <a class="side-button" href="index.html">Editor</a> &nbsp;&nbsp; | &nbsp;&nbsp; 
      <a class="side-button" href="grabs.html">Screen Grabs</a>
    </div>

    <h1 id="title"></h1>

    <div id="reload-mode" class="side-button"> reload </div>
    <div id="save" class="side-button"> save </div>
    <div id="save-new" class="side-button"> save new </div>
    <br />

    <div id="modees"> </div>
    <br /> <br /><br /> <br />

    <div id="editor"> import cool </div>

    <script>
    </script>

    <div class="modal"><!-- Place at bottom of page --></div>

    </body>

Before the edit the three div-sections reload, save, save new where below of the modes section.


#17

I’m reviving this old topic, because I can’t seem to enable the SSH server. I’m running the 0-WebFiles mode, and the “Organelle Patches” (LOL) web server runs fine, but SSH seems to still be off, giving me “connection refused”.

Is the sshd set to a different port by default?

Also, there is a mention in this thread of using a keyboard to drop to command-line. How do I do this?


#18

It is standard port 22

I don’t have the ETC here, but I may have a look at the configuration when I am at home.


#19

Thanks, it seems dead to me. I’ll try some more, it would really help if I could develop over SSH instead, using Atom as an editor… :slight_smile:


#20

SSH is disabled by default on ETC. but you can use this mode which will enable it when you restart:

import os
import pygame

def setup(screen, etc) :
    os.system("systemctl enable sshd")
    os.system("systemctl start sshd")

def draw(screen, etc) :
    pass