openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
821 stars 252 forks source link

pine64 Support #93

Closed ThomDietrich closed 7 years ago

ThomDietrich commented 7 years ago

I'm in the process of building an openHABian pine64 image. @kaikreuzer @dmcwhinnie

Progress so far:

Good news: A first test did already set up and install a working openHAB!

ThomDietrich commented 7 years ago

First build successful. Flashing now...

dmcwhinnie commented 7 years ago

Purchased a new SD card this week, so ready to test when you are...

ThomDietrich commented 7 years ago

The image is almost finished. The next step will be modifications and improvements inside the openhabian setup. That's easier. @dmcwhinnie I'd be happy to provide you with a first image in a few hours.

dmcwhinnie commented 7 years ago

great! May not get to it today, but will get it in the next coupe days.

On Sun, Feb 12, 2017 at 3:17 PM, Thomas Dietrich notifications@github.com wrote:

@dmcwhinnie https://github.com/dmcwhinnie It took longer than I thought but here it is: https://drive.google.com/open?id= 0B67AyLNQlS3dMndLSkY0TnlDYXM

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openhab/openhabian/issues/93#issuecomment-279249864, or mute the thread https://github.com/notifications/unsubscribe-auth/AMefoRSincnAitq8YqsGejwviwZqjXXzks5rb3bzgaJpZM4L-Oho .

kaikreuzer commented 7 years ago

Started flashing my SD card :-)

One drawback to the RPi net-installer is that the extracted image is 4GB, so initial flashing takes much longer.

ThomDietrich commented 7 years ago

Indeed :) One does appreciate that after a while.

Sadly there was a small error in the image, you will not have much fun with it. Give me a few seconds. It would be great to have a few testers in the next few days.

kaikreuzer commented 7 years ago

Ok, cancelling the flashing... Will be happy to test any further updates!

ThomDietrich commented 7 years ago

Finally here we go! https://drive.google.com/drive/folders/0B67AyLNQlS3dYzJEbGtBOUdmTTg?usp=sharing The setup process seems to be stable now. It will be a bit simpler as soon as the pine image build project accepted three PRs of mine. Okay, currently there are two problems:

  1. The first boot seems to need a bit longer to provide network connectivity, the second boot will then successfully start and finish the openHABian setup. After that you'll have (most obvious) the openHABian login screen and everything else, just like with the RPi. check the progress: grep rc.local /var/log/syslog.

  2. Zulu Embedded doesn't work 😢 I've tracked it down to the absence of /lib/ld-linux-armhf.so.3, which was already discussed here, which I didn'T want to go through now. It's late enough and I hope @kaikreuzer knows the solutions to that little problem :)

Happy Hacking!

dmcwhinnie commented 7 years ago

First install looks good! To fix the armhf library issue, these steps need to be added.

# Add armhf architecture
dpkg --add-architecture armhf
#verify
dpkg --print-foreign-architectures
#update source
apt-get update
#Install required armhf binaries
apt-get install libc6:armhf libncurses5:armhf libstdc++6:armhf

Once I did that, I was able to start openHAB. Reboot started everything automatically. Note, I can't find the source I found that information, so it may be possible that we don't need all 3 libraries for Java to work. All I have in my notes is to install all 3. :blush:

I also did some basic tests with samba, z-wave addon installed, and detected the zwave module shipped with the original IOT Pine 64 shipments.

kaikreuzer commented 7 years ago

Err, stupid question: What is the default user to log in with?

ThomDietrich commented 7 years ago

I found a solution to the first problem (not in the image yet, so you will have to reboot once) and can confirm that the steps as described by @dmcwhinnie do the job (Thanks!).

@kaikreuzer ubuntu:ubuntu ;D

kaikreuzer commented 7 years ago

Ah :-) Needs to be changed 😎

kaikreuzer commented 7 years ago

Just FTR: Whatever I execute, I see many of these warnings:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ThomDietrich commented 7 years ago

I had longer discussions about that before. till now we decided to stay with the default password (e.g. pi:raspberry) but ask the user to change it: https://github.com/openhab/openhabian/blob/pine64-build/openhabian-setup.sh#L1006-L1042 - This routine is called whenever a user exits sudo openhabian-config.

ThomDietrich commented 7 years ago

Ah, setting locale was one of the last things I automated yesterday. Didn't ensure it's running smoothly... https://github.com/openhab/openhabian/blob/pine64-build/openhabian-setup.sh#L149-L158

kaikreuzer commented 7 years ago

till now we decided to stay with the default password

I was also hoping for a different user, like e.g. "openhab" instead of "ubuntu". But I see that this won't work for e.g. the netinstaller that isn't under our control. And nothing to urgent for sure. But on the long run, it would be neat to have the same user on any openHABian installation and not different once depending on whether you run it on pi or pine.

kaikreuzer commented 7 years ago

Regarding Zulu JDK, all I needed to make it work was:

dpkg --add-architecture armhf
apt-get update
apt-get install libc6:armhf 

@dmcwhinnie Are libncurses5:armhf& libstdc++6:armhf really required as well?

@ThomDietrich I also found the solution for the font issue! It is as simple as installing fontconfig:armhf!

kaikreuzer commented 7 years ago

Configuring the Z-Wave board as /dev/ttyS2 also directly worked without any further tweaking - so overall, I agree with @dmcwhinnie: Great work so far! 👍

dmcwhinnie commented 7 years ago

@kaikreuzer Are libncurses5:armhf& libstdc++6:armhf really required as well?

I never confirmed all 3 were required. I had found the information somewhere, in the past, which said all 3 were needed. Once I had it working, I never went back to fully confirm if all 3 were needed. I suspect only the 1 is needed, and your setup seems to confirm.

ThomDietrich commented 7 years ago

But I see that this won't work for e.g. the netinstaller that isn't under our control. same user on any openHABian installation

Oh but it is :smiley: I just decided to set it to pi/ubuntu for now. You see, in the beginning of openHABian I wanted a "hassle-free" start, which includes being able to log in with the password RPi users with little or no Linux experience know: raspberry. Now with possibly more and more platforms supported I'd agree, one username:password would be nice. Are you sure about the openhab user? That's the system user openHAB is running under. It's not a good practice to user system users as interactive/sudo users... How about "openhabian" or "hab" or "enthusiast"

kaikreuzer commented 7 years ago

Are you sure about the openhab user?

Well, it would be in line with our docs for manual setup.

kaikreuzer commented 7 years ago

Or do you mean we should actually have two users? "openhab" for running the service and then an admin/sudo user for manual logins?

ThomDietrich commented 7 years ago

@kaikreuzer could you please provide me with one example command to provoke the locale warning...

Regarding Zulu JDK

Thanks. Turns out all I missed in my late nighter yesterday was the apt update :sweat_smile:

I also found the solution for the font issue! It is as simple as installing fontconfig:armhf!

Amazing. Do I still need to confirm this on the RPi?

Configuring the Z-Wave board as /dev/ttyS2 also directly worked without any further tweaking

You mean inside openHAB? No changes on system side needed? Perfect!

I never went back to fully confirm if all 3 were needed

Okay then, I'll add the one and it's good that all three of them are mentioned here in case of later problems.

I agree with @dmcwhinnie: Great work so far! :+1:

Gracias :)

To summarize: I'll build a new image this evening. It will include:

I'll also work on a fix for FireMotD to detect the pine64 platform.

It would also be nice to have the on-board LED blink after the setup was successfully finished (just as with the RPi - @kaikreuzer @dmcwhinnie the pine I got from Kai (Thanks again!) is a prototype and doesn't have a status LED. Meaning this would be up to you to figure out. If something like this is not easily available, We can ignore that for now. It's just nice to have and not necessary.

ThomDietrich commented 7 years ago

Well, it would be in line with our docs for manual setup.

sudo adduser --system --no-create-home --group --disabled-login openhab

This is a system user without (ssh) login ;)

Or do you mean we should actually have two users? "openhab" for running the service and then an admin/sudo user for manual logins?

Yup, that's how something like this is normally done. Linux users like "openhab" or "www-data" should be reasonably restricted. The end user should have his own interactive user with unrelated privileges. The fact that some users give openhab sudo is another story :hankey: :wink:

kaikreuzer commented 7 years ago

This is a system user without (ssh) login ;)

Ok, then I would go for "openhabian".

could you please provide me with one example command to provoke the locale warning...

It e.g. happens when doing apt-get installs like

sudo apt-get install fontconfig:armhf

Do I still need to confirm this on the RPi?

It has already been confirmed to be working here. What might be good is to check the minimal requirement. It might be enough to install libfontconfig1:armhf - we might not need the "full" fontconfig. Likewise, I had installed ttf-dejavu for my first tests, so I am not sure whether this is required or not.

You mean inside openHAB? No changes on system side needed? Perfect!

Yes, inside openHAB.

ThomDietrich commented 7 years ago

Ok, then I would go for "openhabian".

The shell will look like this:

[20:15:28] openhabian@openHABianPine64:~$

Maybe we can come up with something nicer?

Building new image, including libc6:armhf libfontconfig1:armhf and the first boot fix.

dmcwhinnie commented 7 years ago

For the status LED, looks like it is doable based on this https://gist.github.com/pfeerick/00b04df3ce65979158b117b4e1f7c168 and http://forum.pine64.org/showthread.php?tid=2234

The issue I see is that this is a script running in a loop, so would have to spawn something and keep it running in the background. Not quite as clean as the PI for causing it to heartbeat.

I should add, that this is for the "Power" LED, I believe the board also as spot for an additional LED, but mine doe not have that one. So if that is what you are thinking, I don't have that either.

kaikreuzer commented 7 years ago

Maybe we can come up with something nicer?

Maybe some shorter hostname? openHABPine? PineHAB?

ThomDietrich commented 7 years ago

Here we go. I've uploaded a new image to test. Changes since yesterday:

The bootup time from power to openHAB Initial Setup screen was around 12 minutes btw.

https://drive.google.com/file/d/0B67AyLNQlS3dVjYwWlAxOV9CVTg/view?usp=sharing

I'm satisfied with the base now. @kaikreuzer @dmcwhinnie @umiddelb please give it a full test spin! 😉 Things still on the TODO list:

Regarding the username:password: I would like to use something less boring and maybe a bit cheerful. How do you like enthusiast:smarthome or smart:home? Whoever is reading this, please give your vote ;)

@umiddelb I've read your mail today but as you can see I'm currently a bit busy. I'll answer you soon!

@kaikreuzer: While testing the chart, I encountered two usability issues. 1) Basic UI doesn't show the "Choose your sitemap" link list, where did it go? 2) the difference between Configuration and Preferences is unclear/un-intuitive. Also I was confused that the pre-configured sitemap for Basic UI is still called "_default". Might be time to call it "default"? We don't have to discuss these in detail here, if you think it's worth to look into I can open new issues.

dmcwhinnie commented 7 years ago

I like smart:home. With my typing skills I'll never get enthusiast right each time....

I'll let you know how the testing goes...

dmcwhinnie commented 7 years ago

Here are some observations. A couple things may just be me, I will re-image and test again to confirm Tuesday

some issues

  1. Installed zwave and some others (chromecast, HTTP, DSC Alarm, weather) at the same time. All the others worked except zwave. zwave would show blank screen in paper UI when navigating to the "add thing". no errors in any logs. I uninstalled and then reinstall, then it worked as expected. ZWAVE was shown as initialized. (note I don't have any zwave devices) I will try to reproduce.
  2. config files in the services folder were owned by openhab, not openhabian. I will try to reproduce.
  3. Weather addon was complaining about forecast days... will troubleshoot later.

some good news

  1. The following addons worked after restoring setup from my "production" system. HTTP, DSC Alarm, ASTRO, Chromecast,
  2. SAMBA works as expected
  3. changed timezone via openhabian successfully
  4. Openhab cloud worked

something else

  1. Wifi setup. I removed the apt install of "firmware-brcm80211" (ok, I also had to remove the check for "is_pithree") and then ran the setup script. Wifi started worked just fine.

My setup is rather simple (the above covers most of my current day to day functionality. But will continue to test what I can. Been wanting to get MQTT running again, so will include that in my testing. I'll also go through the different openhabian features/options and make sure they seem ok.

overall awesome!!

dmcwhinnie commented 7 years ago

On the LED heartbeat front... none of those commands work on the system/power LED....my board also doesn't have an LED on the board other than the one for power.

kaikreuzer commented 7 years ago

1) Basic UI doesn't show the "Choose your sitemap" link list, where did it go?

Imho this never existed.

called "_default". Might be time to call it "default"?

Nope, "_default" always exists, it is auto-generated from the available Things. You can set "your" default in the Paper UI to whatever you call your sitemap.

But let's not get off-topic here, just wanted to note that I do not see any reason for entering issues.

ThomDietrich commented 7 years ago

@kaikreuzer I was talking about this. Shouldn't this be the screen every new user sees if he didn't set a default ("_default" being one of the options)? I see reason for entering issues because this is one of a few usability concerns I have :see_no_evil:

Hey @dmcwhinnie, Wow it's great to know someone in another timezone :smile: One short night of sleep and already a detailed test report :sparkles: I didn't see your message yesterday. Running a loop in the background wouldn't have been the issue, it would only run after the first boot cycle. Too bad you didn't get it to work. If you do, let me know and we can implement it.

With my typing skills I'll never get enthusiast right each time....

Hehe, sadly I had the same thought :wink: I would like that option. The nice thing about smart:home is, that the user is called smart :monkey:

Zwave: @kaikreuzer said it was working before. That's something the two of you will have to figure out, I've neither transceiver nor hardware for zwave.

Config files: I believe the current setting is openhab:$username with 664 permissions. Is that not the case?

Weather addon forecast: ¯\_(ツ)_/¯

  1. changed timezone via openhabian successfully

How? You've hacked openhabian.conf and executed Basic Setup? You should be aware, that this is not yet a supported feature :sweat_smile:

  1. Wifi setup. I removed the apt install of "firmware-brcm80211" (ok, I also had to remove the check for "is_pithree") and then ran the setup script. Wifi started worked just fine.

Okay that's great! So I can add is_pine64 and make "firmware-brcm80211" conditional for is_pithree !?

But will continue to test what I can.

That would be amazing!

Been wanting to get MQTT running again

I can't test right now, there was some error with the repo/package used.

overall awesome!!

Great! Thanks :wink:

kaikreuzer commented 7 years ago

@kaikreuzer I was talking about this. Shouldn't this be the screen every new user sees

No idea. When and where was that shown? Why do you mention it here, does that mean that it behaves differently on other installations (not openHABian on Pine)? I am not aware of any changes on such things for at least a year, so I wonder why this comes up... But sure, if you think something is broke, feel free to create an issue.

ThomDietrich commented 7 years ago

Clearly off-topic, sorry. Will create an issue over at eclipse smarthome

ThomDietrich commented 7 years ago

FireMotD problems are fixed. https://github.com/willemdh/FireMotD/pull/34, https://github.com/willemdh/FireMotD/pull/35 Looking into the "zulu thing" now @kaikreuzer

ThomDietrich commented 7 years ago

I'll send a mail with my findings tomorrow. The short version: Läuft

ThomDietrich commented 7 years ago

The End Is Nigh.

I will do one last important test this evening: RPi compatibility. If this is successful, I'm ready to merge and upload new releases. After a few days I'll mark this point with a new version number.

Open todos: validate pine64_platform_scripts execution, modify file permissions, check Mosquitto install, rearrange menu entries, change username:password.

Any comments?

kaikreuzer commented 7 years ago

Let me know once you have a new image available for testing!

ThomDietrich commented 7 years ago

There you go :wink: https://drive.google.com/open?id=0B67AyLNQlS3dam9HQVpDMU9VaGs

kaikreuzer commented 7 years ago

Downloading ⏳

ThomDietrich commented 7 years ago

In my eyes it's finished, All improvements that might still be needed are unrelated to the base image. Last tow changes would be switching from development branch to master and setting the default password

kaikreuzer commented 7 years ago

FYI, when running apt-get upgrade I still see the locale warnings:

Get:1 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable/main arm64 openhab2 all 2.1.0~20170216144237-1 [53.2 MB]
Fetched 53.2 MB in 8s (6345 kB/s)                                                                                                                                                                                                            
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ThomDietrich commented 7 years ago

But why...

My system:

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

These are the commands supposed to be executed:

# List available locales
cat /usr/share/i18n/SUPPORTED
# Generate locales, set default
/usr/sbin/locale-gen en_US.UTF-8 de_DE.UTF-8
/usr/sbin/update-locale LANG=en_US.UTF-8
kaikreuzer commented 7 years ago

Does this help?

[15:17:44] ubuntu@openHABianPine64:~$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
ThomDietrich commented 7 years ago

I fear you'll have to investigate. This doesn't make sense to me and I'm not seeing these issues on my* Pine.

What happens after LC_CTYPE="en_US.UTF-8"?

kaikreuzer commented 7 years ago

Everything fine then:

[16:06:58] ubuntu@openHABianPine64:~$ LC_CTYPE="en_US.UTF-8"
[16:07:04] ubuntu@openHABianPine64:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
ThomDietrich commented 7 years ago

https://askubuntu.com/questions/599808/cannot-set-lc-ctype-to-default-locale-no-such-file-or-directory

This same problem (LC_CTYPE=UTF-8, which is wrong) can happen when you login over ssh from a Mac to a linux box, and your terminal automatically sets environment variables. There's a checkbox for that. Uncheck it, and you're good to go. In iTerm it's in the profile->Terminal Tab.

At least an explanation...

ThomDietrich commented 7 years ago

Could you please try the following and reconnect/reboot:

/usr/sbin/update-locale LC_CTYPE="en_US.UTF-8" LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8"