Moving Cloned OH2.x RPi4B SD Card to new RPi4B faild

openhab is the user that owns the file under /etc/openhab.
You can see that e.g. by using the command:

ls -ld /etc/openhab

which returns

drwxrwxr-x 15 openhab openhab 4096 Jan 30 12:26 /etc/openhab

first openhab is the user that owns the directory /etc/openhab
second openhab is the group that the user openhab is a member of.

Which command id you can see more information about the user openhab

id openhab

which returns

uid=110(openhab) gid=115(openhab) groups=115(openhab),5(tty),20(dialout),29(audio),112(bluetooth),997(gpio)

When you do that for user openhabian you should get a result similar to

uid=1000(openhabian) gid=115(openhab) groups=115(openhab),4(adm),5(tty),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),112(bluetooth),999(spi),998(i2c),997(gpio),1000(openhabian),118(mosquitto)

openhab is the user the “service” openhab runs with. This is why files are owned by openhab so that the service can read the files and can write to directories ( /var/lib/openhab/… ).
The user openhabian is a user that is being used mainly for configuration and to easily get higher privileges with sudo command.
As you wrote that copying the files worked with OH2. Are you able to check the files/directories permissions you used with OH2 ?

Hi,
I ran the commands on the old OH2.5.9 Prod unit and the new OH3>2 Test unit with issues. Here are the results:

On old OH2.5.9 Prod:
sudo ls -ld /etc/openhab
ls: cannot access ‘/etc/openhab’: No such file or directory
sudo ls -ld /etc/openhab2
drwxrwxr-x+ 13 openhab openhab 4096 Aug 25 2020 /etc/openhab2
id: ‘openhab2’: no such user
sudo id openhab
uid=110(openhab) gid=115(openhab) groups=115(openhab),5(tty),20(dialout),29(audio),112(bluetooth),997(gpio)
sudo id openhab2
id: ‘openhab2’: no such user

On new OH3.2.0->OH2.5.12 Test:
sudo ls -ld /etc/openhab
ls: cannot access ‘/etc/openhab’: No such file or directory
sudo ls -ld /etc/openhab2
drwxrwxr-x 13 openhab openhab 4096 Apr 22 18:04 /etc/openhab2
sudo id openhab
uid=110(openhab) gid=115(openhab) groups=115(openhab),5(tty),20(dialout),29(audio),112(bluetooth),997(gpio)
sudo id openhab2
id: ‘openhab2’: no such user

A bit confusing to me I guess.

The + sign in

makes the difference …
It looks like an ACL ( see e.g. UNIX/Linux : Access control lists (ACLs) basics – The Geek Diary ) was set.
Could you run

sudo getfacl /etc/openhab2

on your OH2 system ?

Sure can. Here it is:
[20:23:54] openhabian@openhab:~$ sudo getfacl /etc/openhab2
[sudo] password for openhabian:
getfacl: Removing leading ‘/’ from absolute path names

file: etc/openhab2

owner: openhab

group: openhab

user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x

Did this make a change in OH2 ? Says “Removing leading ‘/’ …”
Bjorn

Wolfgang,
I read about the ACLs and my immediate question is if there is a wrong setting in OH3>2 since that is the only OH version that WinSCP does not like?
Bjorn

Hi all,
I did a bit more testing on the WinSCP issue:
It appears that a fresh OH2/OH3->2 instance grants WinSCP permissions to communicate with the /etc/openhab2 directories, but not with the /var/lib/openhab2/backup directory (ex. old backup files can’t be deleted).
Running the config tool item 14 (Fix Permissions) changed this. Now the Backup folder is accessible, but files transferred to /etc/openhab2 gets their time and date changed to time of arrival. Very frustrating!!
The same happens using FileZilla (and others?) and indicates an issue on the OH2 server side.
Is there a fix or can on be made?

Now the same date/time change happens also on OH3 to my surprise.

No, it’s a sign that you’re improperly using the system. Files you copy over get created with user+group ownership and current date - that’s all data you tell the server. It’s common among Windoze users to misunderstand how the Linux rights system works, but that does not mean the server behavior is wrong (it isn’t). Ask Big G for proper resources on the topic and read up on it.
Or stop using Win client tools and use Samba/CIFS sharing instead as almost everybody else does.

Thanks Markus,
Understand (I think). Just a quick one, please?
I have Win Explorer talking to OH Samba now on \x.x.x.x\openHAB-conf. That gives me access only to the OH conf folders (/etc/.), so how do I gain access to the root containing also /var/lib/., /var/log/. etc…?
The only Win Explorer connection alternatives are openHAB-userdata, -sys, -conf and -addons. No access to log and backup folders.
WinSCP did before I ran Fix permissions.

For OH operations, you don’t need these to be available on your Windows box which is why they’re not shared (you might be running an oldish version with even less accessible than is on recent openHABian).
If you insist you could get them by configuring Samba but no that’s not quick at all so please ask the Internet on that.

Hmm. OK, thanks a lot.
Just qurious, how do you then extract item values from log files when needed for whatever purpose (ex. statistics, forum questions etc.)?
Thanks for your patience.

  • to extract values you can ssh ( putty ) into the remote host and execute e.g. grep command
  • to download the files you can use sftp/scp/winscp/filezilla and copy the files to e.g your window host
  • frontail is an option to have access to the latest log entries via browser