Error - Apply Improvements - Fix Permissions

I grabbed the latest image of OH 3, then downgraded to OH 2.5.11 on my RPi 4.

I ran “14 | Fix Permissions” and received an error -

 There was an error or interruption during the execution of:                  │
                                  │   "10 | Apply Improvements"                                                  │
                                  │                                                                              │
                                  │ Please try again. If the error persists, please read                         │
                                  │ /opt/openhabian/docs/openhabian-DEBUG.md or                                  │
                                  │ https://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md   │
                                  │ how to proceed.      

I’m hoping that this is why when I try to install Samba from the config menu, I don’t receive any errors, but I don’t see my RPi folders/drive from Windows.

1 Like
  • did you follow the advice as described in the debug instructions file ?
  • in many cases on STDOUT/STDERR ( that’s in the shell window in the background where openhabian-config runs ) you get a set of output messages; once openhabian-config is ended/closed you can read them; what are the messages esp. the error messages there ?
  • of course you ran openhabian-config with sudo, right ? Otherwise there must be erorr messages. One reason remaining for error messages could be non existing directories resp. wrong named directories ( e.g. expected directory oenhab2 instead of openhab )
  • you are on the right branch ? After downgrading you have not to be on the openhab3 branch which need to be stored in the openhabian-config conf file in /etc
  • if Samba does not export any directory at all: does the samba service run ? ( what is the status of the serivce: sudo systemctl status smbd
  • did you reinstall the samba service after downgrade and making sure that you are on the right branch ?

Thank you @Wolfgang_S for your assistance!

  • did you follow the advice as described in the debug instructions file ?
    Yes, however when I try to edit openhabian.conf it says the file is not writeable - which is why I was guessing it is permissions

  • in many cases on STDOUT/STDERR ( that’s in the shell window in the background where openhabian-config runs ) you get a set of output messages; once openhabian-config is ended/closed you can read them; what are the messages esp. the error messages there ?
    Yes, I get this:

 Applying file permissions recommendations... OK
OK
OK
FAILED (persistence)
OK
OK
  • of course you ran openhabian-config with sudo, right ? Otherwise there must be erorr messages. One reason remaining for error messages could be non existing directories resp. wrong named directories ( e.g. expected directory oenhab2 instead of openhab )
    Yes, with sudo

  • you are on the right branch ? After downgrading you have not to be on the openhab3 branch which need to be stored in the openhabian-config conf file in /etc
    Correct. When I reboot the pi, it says 'Welcome to Openhabian openHAB 2.5.11 (Release Build)

  • if Samba does not export any directory at all: does the samba service run ? ( what is the status of the serivce: sudo systemctl status smbd

● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-01-21 03:03:11 CET; 11h ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 6238 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
 Main PID: 6240 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 2182)
   CGroup: /system.slice/smbd.service
           ├─6240 /usr/sbin/smbd --foreground --no-process-group
           ├─6249 /usr/sbin/smbd --foreground --no-process-group
           ├─6250 /usr/sbin/smbd --foreground --no-process-group
           └─6251 /usr/sbin/smbd --foreground --no-process-group

Jan 21 03:03:11 openHABianDevice systemd[1]: Started Samba SMB Daemon.
  • did you reinstall the samba service after downgrade and making sure that you are on the right branch ?
    After I flashed the image, I downgraded to 2.5.11, then I installed Samba from the menu

I realized my issue with updating the conf file, I didn’t use ‘sudo nano’.

Here is the result after setting the debug -

+ cond_redirect fix_permissions /opt/zram/persistence.bind openhab:openhabian 664 775
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ fix_permissions /opt/zram/persistence.bind openhab:openhabian 664 775 \033[39;49;00m'

$ fix_permissions /opt/zram/persistence.bind openhab:openhabian 664 775
+ fix_permissions /opt/zram/persistence.bind openhab:openhabian 664 775
+ [[ -e /opt/zram/persistence.bind ]]
+ chown openhab:openhabian /opt/zram/persistence.bind
+ [[ -n 664 ]]
+ find /opt/zram/persistence.bind -type f -print0
+ xargs -0 chmod 664
chmod: missing operand after ‘664’
Try 'chmod --help' for more information.
+ return 1
+ return 1
+ echo 'FAILED (persistence)'
FAILED (persistence)
+ retval=1
+ cond_redirect fix_permissions /var/log/openhab openhab:openhabian 664 775
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ fix_permissions /var/log/openhab openhab:openhabian 664 775 \033[39;49;00m'

$ fix_permissions /var/log/openhab openhab:openhabian 664 775
+ fix_permissions /var/log/openhab openhab:openhabian 664 775
+ [[ -e /var/log/openhab ]]
+ chown openhab:openhabian /var/log/openhab
+ [[ -n 664 ]]
+ find /var/log/openhab -type f -print0
+ xargs -0 chmod 664
+ [[ -n 775 ]]
+ find /var/log/openhab -type d -print0
+ xargs -0 chmod 775
+ return 0
+ echo OK
OK

According to your output of running fix_permissions it looks like your version of openhabian-config is still on openHAB3 branch. e.g. /var/log/openhab is shown to be the log directory while it is /var/log/openhab2 for OH2.
According to the status output of samba the service is running.

Looks like you get an eror to change permissions for the peristence directory because the directory exists but there is no file in that directory. As there seem not to be any file in that directory the find command does not send the file name to the xargs command and that is why the chmod command does not have a file name as parameter and thus it fails.
You can check if that theory is correct by doing a touch filename in the persistence directory and running the fix_permission command again. It shold not fail then otherwise the theory fails.

Yep! I copied a syslog.1 to /opt/zram/persistence.bind directory and that fixed the error!

If the Samba service loaded correctly, shouldn’t I be able to see the drive in Windows? Is there anything else I need to do to get Samba running?

Yes it should be reachable in the same way as you can connect other shares in windows.

Thank you SO much @Wolfgang_S for your patience and assistance. I was able to map to the Openhab folders!

1 Like

Hi ´m getting the same with a fresh install
how/where to fix this ??? Fix Permissions”

Copy a file into this folder and it will work. It is trying to set permissions on an empty folder.

As long as you refer to the persistence error message the root cause is that th directory is empty.
The files then should be changed one by one. As there is no file located in that directory you get an error message but it is more in the means of a warning as there is no file’s permission to change.
So you can put a file in that directory or create an empty one or you could ignore that message.

What files should be modified? And to what?

Where?

Why is this required on a fresh install?

$ fix_permissions /opt/zram/log.bind/samba root:root 640 750
OK

$ fix_permissions /opt/zram/persistence.bind openhab:khadas 664 775
chmod: missing operand after ‘664’
Try ‘chmod --help’ for more information.
FAILED (persistence)

$ fix_permissions /var/log/openhab openhab:khadas 664 775
OK

In response to your questions:

What files should be modified? And to what? - You aren’t changing a file. You can make a copy of a file (I used a syslog) and place it in the directory.

Where? - Place the file of your choice in this directory - /opt/zram/persistence.bind

Why is this required on a fresh install? - Because this is an open source project and sometimes bugs/issues happen.

Thanks now it runs though thanks…

Can u give any feedback why openhab wont work when I nginx location / to location /openhab ???

Sorry, I do not know the answer on nginx.