Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making OctoPi build on Ubuntu 64bit so we have 64bit builds #711

Closed
guysoft opened this issue Jan 11, 2021 · 55 comments
Closed

Making OctoPi build on Ubuntu 64bit so we have 64bit builds #711

guysoft opened this issue Jan 11, 2021 · 55 comments

Comments

@guysoft
Copy link
Owner

guysoft commented Jan 11, 2021

Ok, so following what was going on in #692 . We are thinking about using Ubuntu to make 64bit builds. And also testing to see how using a distro with predictable release cycles works with OctoPi (we might actually like this long-term).

Current status:

It seems to load but

  1. There is an Ubuntu user and also the Pi user (can be fixed).
  2. Pi user has no sudo
  3. HA proxy does not load. I get:
/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -S /run/haproxy-master.sock
[NOTICE] 010/111929 (4074) : haproxy version is 2.2.3-2
[NOTICE] 010/111929 (4074) : path to executable is /usr/sbin/haproxy
[ALERT] 010/111929 (4074) : parsing [/etc/haproxy/haproxy.cfg:35] : The 'reqrep' directive is not supported anymore since HAProxy 2.1. Use 'http-request replace-path', 'http-request replace-uri' or 'http-request replace-header' instead.
[ALERT] 010/111929 (4074) : parsing [/etc/haproxy/haproxy.cfg:36] : The 'reqadd' directive is not supported anymore since HAProxy 2.1. Use 'http-request add-header' instead.
[ALERT] 010/111929 (4074) : parsing [/etc/haproxy/haproxy.cfg:37] : The 'reqadd' directive is not supported anymore since HAProxy 2.1. Use 'http-request add-header' instead.
[ALERT] 010/111929 (4074) : parsing [/etc/haproxy/haproxy.cfg:43] : The 'reqrep' directive is not supported anymore since HAProxy 2.1. Use 'http-request replace-path', 'http-request replace-uri' or 'http-request replace-header' instead.
[ALERT] 010/111929 (4074) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 010/111929 (4074) : Fatal errors found in configuration.

Possible fix by @CRCinAU at: #692 (comment)

@CRCinAU
Copy link

CRCinAU commented Jan 11, 2021

So what's broken / known problems at this point? Only the haproxy? Just about to give it a whirl...

@guysoft
Copy link
Owner Author

guysoft commented Jan 11, 2021

I haven't tested more. Its about an hour old

@CRCinAU
Copy link

CRCinAU commented Jan 11, 2021

Heh - noted - I won't overwrite my working RC setup then ;)

EDIT: Good sign - even though its on a very slow USB stick for testing:

PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
443/tcp open  https

@CRCinAU
Copy link

CRCinAU commented Jan 11, 2021

Ok, good news is that it seems to work well enough that I'm going to back up my RC1 config and load it into this on my faster USB stick.... It boots fine, resizes ok, starts octoprint ok, haproxy starts with my modified config as per the quoted post, connects to the printer ok....

EDIT: Also, apt update && apt -y dist-upgrade works fine too....

@CRCinAU
Copy link

CRCinAU commented Jan 11, 2021

Extra packages that can be removed:

* snapd (and rm -fR /run/snapd)
* squashfs-tools
* bcache-tools
* cloud-* (and rm -fR /etc/cloud)
* cryptsetup-*
* *nginx*

There may be more - but that's a quick overview...

@DrDrache
Copy link

I will download this and test as well - I have been running RC1 64bit since you released it (and nightly before)
not having an aarch64 image (ubuntu or otherwise) for a pi4 host is a bad idea in my personal opinion.

the speed of the system and the interface IS significantly better (faster?); I do understand the comments about support/etc that was indicated in the previous thread.

I only want to say, in 2021; sticking to 32bit only is short-sighted (PI Foundation, for instance).

testing here I go! :P

@DrDrache
Copy link

based on my limited testing, I am unable to get my webcam working with mpegstreamer. I will spend more time on it... just adding to the discussion.

@XboxOldie
Copy link

I have downloded the 64bit version and could start it on my raspberry Pi4 8GB.
With Putty I can access the system as user pi.
I was able to change the password but thats it.
After this I can't continue with any configuration because user pi is not allowed for root access.
Is there a Ubuntu admin user which will have this access or how should I be able to test further when I can't further configure my rasbperry to work correctly.
Any feedback would be great helping you to continue with testing.

@dan-and
Copy link

dan-and commented Jan 12, 2021

@XboxOldie see: #712 ... there is also the ubuntu/ubuntu user on the current images. that user is allowed to sudo.

@guysoft
Copy link
Owner Author

guysoft commented Jan 12, 2021

Next nightly should have the pi user able to run sudo. I hope so at least, testing appreciated!

@XboxOldie
Copy link

@guysoft
I have installed the latest nightly build now from 12.01.2021 and the user pi is having now sudo rights.
Thanks for the change

I could do then the password change , the sudo apt update and upgrade like always under the user pi.
All was running with a view messages and ended after a view minutes.
sudo raspi-config does not exist anymore on the RC2 so nothing i can do there.

However after all the system updates I was not able to open the octoprint webinterface on any browser like Opera or Edge.
Not with the IP nor with http;//octopi

Hope you can still solve the issue that I can continue testing.
I added the whole installation procedure I did as a text file for your reference

Install octopi RC2.txt

Hope that helps.

PS: So far I have the RC1 with the 64bit running and all is working well on my Pi 4B 8GB

@guysoft
Copy link
Owner Author

guysoft commented Jan 13, 2021

@XboxOldie See the first post. HAproxy needs to be fixed because it is not working on ubuntu, I don't know why:
#711 (comment)

@guysoft
Copy link
Owner Author

guysoft commented Jan 13, 2021

Seems like HAproxy on Raspbian/Rpios is 1.8.19 and on Ubuntu 2.2, which means the settings need to be upgraded.

@CRCinAU
Copy link

CRCinAU commented Jan 13, 2021

Seems like HAproxy on Raspbian/Rpios is 1.8.19 and on Ubuntu 2.2, which means the settings need to be upgraded.

If you swap out the original two backend blocks and replace them with the two blocks I posted on the original ticket we discussed this, it works fine.

@XboxOldie
Copy link

@guysoft Please keep me informed when HAproxy is solved into a new nightly distribution to continue testing.
I'm not a linux specialist only a normal user trying to inform you when all is working as expected.

@guysoft
Copy link
Owner Author

guysoft commented Jan 13, 2021

@CRCinAU

Ok, just to recap its comment #692 (comment):

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        http-request replace-path ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

I am swamped and hope to test that soon. If anyone wants to test it here it would help me. I can also just push it to the nightly for now.

@DrDrache
Copy link

@CRCinAU

Ok, just to recap its comment #692 (comment):

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        http-request replace-path ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

I am swamped and hope to test that soon. If anyone wants to test it here it would help me. I can also just push it to the nightly for now.

I can verify that those codeblock changes allowed full access to the UI. I was unable to get my webcam working at all - so I cannot verify the webcam codeblock is 100%.
in addition, I think the same type of changes should be done on the HLS webcam block? I am not sure.

@XboxOldie
Copy link

@DrDrache or @CRCinAU , Every day I set up a new system with the latest nightly build, but until now no nightly build was able to start the octoprint UI on the browser.
Are you able to make some changes in the build that my setups are at least able to start Octoprint?
I also have a PI webcam running on my life system and will be able to provide feedback if accessable or not.

@cp2004
Copy link
Contributor

cp2004 commented Jan 18, 2021

@XboxOldie If you need something stable without issues, don't use the nightly. I wouldn't expect every build to 'just work', especially considering it has just switched to Ubuntu rather than Raspberry Pi OS. There is a reason they are called 'nightly'.

Good feedback is 'It won't start OctoPrint and I got errors XYZ', or 'ABC will not load, it says D' - that will help them solve the issue quicker.

@guysoft
Copy link
Owner Author

guysoft commented Jan 18, 2021

@XboxOldie Yes I can make the changes, however I am swamped this week. So unless someone else PRs (which they are certainly welcome). You will have to wait.

@deejay2
Copy link

deejay2 commented Jan 19, 2021

I've just installed the latest nightly build and got to do that to make octoprint start:

  • Apply the aforementioned changes to haproxy.conf
  • Copy /etc/securetty from another ubuntu version cause it's not present on 20.10?

I will test a few things in the coming days. I'm a webcam user with Octolapse plugin. I'll tell you if everything works fine.

@deejay2
Copy link

deejay2 commented Jan 20, 2021

May I suggest to add this to /etc/sysctl.conf
vm.swappiness=0

Swapping should be used as a very last resort.

@CRCinAU
Copy link

CRCinAU commented Jan 21, 2021

Ok - I'm starting not to be sold on the Ubuntu idea.... Mainly because as a desktop OS, there's a LOT that needs to be stripped out to get it anywhere near the Rasbian base.... Lots....

So, what other options are there? What is the official problem with the 64bit official distro? Are they just slow in updating?

I mean, I see they have these 'lite' images for it: https://downloads.raspberrypi.org/raspios_lite_arm64/images/

Last updated 2020-08-24...

As an example of the difference:
2021-01-11_2020-08-20-octopi-buster-arm64-lite-0.18.0.zip -> 669M
2021-01-11_octopi-20.10-preinstalled-server-arm64+raspi-0.18.0.zip -> 1.1G

@guysoft
Copy link
Owner Author

guysoft commented Jan 21, 2021

@CRCinAU

  1. We are using the server version, most of it is already in place
  2. There is no option to use the Raspios, please read the raspios_lite_arm64 images are not being updated RPi-Distro/pi-gen#481 . They are not to be used ATM.

The current blocker to get Ubuntu ready is that I am swamped and have no time to fix and test the HAproxy settings to version 2.

@CRCinAU
Copy link

CRCinAU commented Jan 21, 2021

I think there's a difference between "not to be used" and "are not considered stable".

Given the massive amount of work to get Ubuntu anywhere close to the current (even beta) pios distro, and the lack of time available, getting the fine tuning required in Ubuntu -> OctoPi seems like an even further away stretch goal.

EDIT: I'd think it would be much better long term to keep the 64 bit builds as nightlies and ONLY provide official support for the 32 bit version until the pios is considered stable. Keep it as a beta, and fix things as they come up...

@guysoft
Copy link
Owner Author

guysoft commented Jan 24, 2021

@CRCinAU 64 bit builds are planned for next release, not the current RC. They are nightly builds, aka they are not tested, I don't know what happens when you run them. The nightly builds tend to become more stable as we near a new release. I am now planning to release 0.18.0 RC2 Monday, so I am not touching the Ubuntu builds just yet.
If you want to help getting them stable then you can make PRs and then others can test them too. I am quite confident we can reach stability as good as the RpiOS. We have had quite a lot of turbulence from the RpiOS unorganized release scheduling. And adding Ubuntu as a possibility might actually make things more stable in the log run. Unlike Ubuntu, the Rpi foundation have cleanly said they are not planing to maintain the 64bit just yet. So the Ubuntu 64bit is at the moment more stable and up to date than RpiOS.

@Willmac16
Copy link
Contributor

Changes I made to get the Ubuntu 64 bit version working:

  • sudo apt update && sudo apt upgrade I am pretty sure this didn't make a difference, but I did do it.
  • modify the haproxy file (backend octoprint matches above, backend webcam is different)
backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        http-request replace-path /webcam/(.*) /\1
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

  • comment out ConditionPathExists=/etc/octopi_streamer/mjpeg in /etc/systemd/system/webcamd.service
  • reboot the pi

I will work to figure out how to get a pr together for this.

@XRyu
Copy link
Contributor

XRyu commented Feb 11, 2021

Changes I made to get the Ubuntu 64 bit version working:

  • sudo apt update && sudo apt upgrade I am pretty sure this didn't make a difference, but I did do it.
  • modify the haproxy file (backend octoprint matches above, backend webcam is different)
backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        http-request replace-path /webcam/(.*) /\1
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http
  • comment out ConditionPathExists=/etc/octopi_streamer/mjpeg in /etc/systemd/system/webcamd.service
  • reboot the pi

I will work to figure out how to get a pr together for this.

Did exactly the same, can confirm interface works, so does camera - going to try further.
Made the mentioned changes in /etc/haproxy/haproxy.cfg (i am totally new with this, so i had to figure out the path, adding here for completeness :D)

i would love to help with the PR, but i even dont know where in the repo i would need to edit / change these files. Maybe i find out :)

@Willmac16
Copy link
Contributor

Thank you guys for figuring out how to make the PR (I got stuck trying to build the OS and worked on other projects for the past couple of weeks).

@guysoft
Copy link
Owner Author

guysoft commented Feb 21, 2021

Was wondering if anyone found the time to test this in the end?

@Willmac16
Copy link
Contributor

I'll try it out now.

@Willmac16
Copy link
Contributor

UI and Webcam (mjpg) are up.

@CRCinAU
Copy link

CRCinAU commented Feb 21, 2021

I did - but ended up going back to the Raspbian based images for 64 bit - they were just faster....

So I installed the last 64 bit raspbian image and then just updated it to the latest of everything...

@XRyu
Copy link
Contributor

XRyu commented Feb 21, 2021 via email

@Willmac16
Copy link
Contributor

The only issues I am having with the current ubuntu 64 bit build are trying to get WS281x LED setup since ubuntu doesn't have the gpio permissions baked in.

@cp2004
Copy link
Contributor

cp2004 commented Feb 22, 2021

@Willmac16 interesting, if you could let me know when you do get it sorted I might be able to adjust some things to make it easier, or at least document it. And if you have more questions you know where I am...

I've not tried my plugin on Ubuntu yet, next release does make it more platform-agnostic hopefully.

@XRyu
Copy link
Contributor

XRyu commented Feb 22, 2021 via email

guysoft added a commit that referenced this issue Feb 22, 2021
@guysoft
Copy link
Owner Author

guysoft commented Feb 22, 2021

Pushed to nightly, we can test

@XboxOldie
Copy link

XboxOldie commented Feb 22, 2021

@guysoft
Have installed nightly 2021-02-22_octopi-20.10-preinstalled-server-arm64+raspi-1.0.0 on Pi4B 8GB
After copy of system to the SD and adding my WLAN access into the "octopi-wpa-supplicant.txt" the system started immediately and very fast into the WEB interface with the further setup screens.
After the plugin installation of "Creality-2x-temperature-reporting-fix" for my Ender 3 Pro, all is working perfect and fast.
Also camera is recognized and working normal.
I also did sudo update and upgrade +reboot without errors.
So far all works perfect and I will continue print tests with this new nightly version.

@XRyu
Copy link
Contributor

XRyu commented Feb 22, 2021

i can't tell how great it feels to read that - i can rarely contribute. This feels great to be a part of a nice community getting projects like this forward :D

Thank you for testing and the feedback @XboxOldie :D
Mine is running also fine, no stuttering of Octoprint crashing since then - with raspiOS i had regular downtimes and had to ssh into and needed to reboot.

@Willmac16
Copy link
Contributor

I made a pr #724 with the minimum set of changes I believe is required to get (the current version of) ws281x to work. @guysoft @cp2004

@guysoft
Copy link
Owner Author

guysoft commented Feb 23, 2021

Tested here too. Boots, works well and the raspberry pi camera I have also works.

The desktop script does not work because there is no package raspberrypi-ui-mods and would need to be changed if we want the desktop on 64bit.

@ping-localhost
Copy link

ping-localhost commented Feb 24, 2021

I'm currently testing/using the latest nightly build 2021-02-23_octopi-20.10-preinstalled-server-arm64+raspi-1.0.0.zip on my RPI4 8GB and PSU control (and GPIO Control/anything that uses RPi.GPIO) fails to be installed due to the following error:

2021-02-23 21:52:16,545 - octoprint.plugins.pluginmanager - ERROR - Reason: UnicodeEncodeError('latin-1', '  source/c_gpio.c: In function ‘setup’:\n', 31, 32, 'ordinal not in range(256)')

I've some logs available as a gist here: https://gist.github.com/ping-localhost/aad12f9619b13deaf5e2d6810407a0f5

@guysoft
Copy link
Owner Author

guysoft commented Mar 1, 2021

@ping-localhost That error seem seems to be from the plugin manager console or something like it might be unrelated.
https://gist.github.com/ping-localhost/aad12f9619b13deaf5e2d6810407a0f5#file-octoprint-log-L21
This line says its using a Unicode Character 'LEFT SINGLE QUOTATION MARK' (U+2018).
I am not sure where its coming from, but its not an OctoPi issue. Should fail anywhere.

Need to find the actual log of the install to figure out what is going on.

@ping-localhost
Copy link

ping-localhost commented Mar 5, 2021

@ping-localhost That error seem seems to be from the plugin manager console or something like it might be unrelated.

@guysoft I think you are right, because when I install the plugin directly through SSH, on the pi account and in the home dir, using pip install "https://github.com/kantlivelong/OctoPrint-PSUControl/archive/master.zip", everything works as expected.

However, I get a massive error when I run the following (which is what OctoPrint runs, but without the no cache dir):

/home/pi/oprint/bin/python -m pip --disable-pip-version-check install https://codeload.github.com/kantlivelong/OctoPrint-PSUControl/zip/master

Error it outputs: https://gist.github.com/ping-localhost/aad12f9619b13deaf5e2d6810407a0f5#file-terminal-log


EDIT: I was successful in installing PSU Control after I copied RPi/ and RPi.GPIO-0.7.0.egg-info from /usr/lib/python3/dist-packages to /home/pi/oprint/lib/python3.8/site-packages/. I did have to tell OctoPrint to install PSU control again, but after that stuff started working.

Not the way to actually resolve this issue, but at least I can use PSU control again, which does make me happy 😅

@guysoft
Copy link
Owner Author

guysoft commented Mar 5, 2021

@foosel looks like a plugin manager bug?

@foosel
Copy link
Collaborator

foosel commented Mar 5, 2021

@guysoft Negative, the plugin manager isn't involved anymore at this point, that's a failing pip install during intake of a dependency.

@ping-localhost
Copy link

Here are my version, in case it helps (they are the same):

pi@octopi:~$ /home/pi/oprint/bin/python -m pip --version
pip 21.0.1 from /home/pi/oprint/lib/python3.8/site-packages/pip (python 3.8)
pi@octopi:~$ /home/pi/oprint/bin/python --version
Python 3.8.6 
pi@octopi:~$ python3 -m pip --version
pip 21.0.1 from /home/pi/.local/lib/python3.8/site-packages/pip (python 3.8)
pi@octopi:~$ python3 --version
Python 3.8.6 

@werdnum
Copy link

werdnum commented Apr 3, 2021

I'm currently testing/using the latest nightly build 2021-02-23_octopi-20.10-preinstalled-server-arm64+raspi-1.0.0.zip on my RPI4 8GB and PSU control (and GPIO Control/anything that uses RPi.GPIO) fails to be installed due to the following error:

2021-02-23 21:52:16,545 - octoprint.plugins.pluginmanager - ERROR - Reason: UnicodeEncodeError('latin-1', '  source/c_gpio.c: In function ‘setup’:\n', 31, 32, 'ordinal not in range(256)')

I've some logs available as a gist here: https://gist.github.com/ping-localhost/aad12f9619b13deaf5e2d6810407a0f5

As far as I can tell, this seems to be a silly error wherein the command-line output is being converted from Unicode to latin1 to strip out the colour control characters, and the string doesn't work as latin1 because the output contains non-latin1 characters. I hacked around it in my installation by just editing the offending file (/home/pi/oprint/lib/python3.8/site-packages/octoprint/util/commandline.py) to change line 57 from this:

 return _ANSI_REGEX.sub(b"", line.encode("latin1")).decode("latin1")

to this:

 return _ANSI_REGEX.sub(b"", line.encode("latin1", "namereplace")).decode("latin1", "namereplace")

and restarting octoprint. You could also use ignore instead of namereplace probably, but I didn't test that because it doesn't actually matter very much what the command-line output is, as long as it doesn't throw an error.

@guysoft
Copy link
Owner Author

guysoft commented Apr 7, 2021

This is part of the nightly build and is planned to be released when we release. So new bugs should go in a separate issue. Closing.

@guysoft guysoft closed this as completed Apr 7, 2021
foosel added a commit to foosel/OctoPi that referenced this issue Jun 30, 2021
Build will check which one is installed and only enable the correct
one.

See also guysoft#711
DeviousFusion pushed a commit to UTA-FabLab/OctoPi that referenced this issue Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests