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

OH2 > OH3 update: Error after installation (mount units) #1230

Closed eikowagenknecht closed 3 years ago

eikowagenknecht commented 3 years ago

After almost finishing the installation, I get an error message. Debug log:

+ whiptail --title 'Operation Successful!' --msgbox 'The testing release of openHAB3 is now installed on your system.\n\nPlease test the correct behavior of your setup. You might need to adapt your configuration, if available. If you made changes to the files in '\''/var/lib/openhab'\'' they were replaced, but you can restore them from backup files next to the originals.\n\nCheck the "openHAB Release Notes" and the official announcements to learn about additons, fixes and changes.' 15 80
+ echo OK
OK
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-11-14_14:32:17_CET [openHABian] Migrating Amanda config... '
2020-11-14_14:32:17_CET [openHABian] Migrating Amanda config... + for i in $amandaConfigs
+ [[ -s /etc/amanda/openhab-*/disklist ]]
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-11-14_14:32:17_CET [openHABian] Migrating samba mount units... '
2020-11-14_14:32:17_CET [openHABian] Migrating samba mount units... + cond_redirect systemctl stop smbd nmbd
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl stop smbd nmbd \033[39;49;00m'

$ systemctl stop smbd nmbd
+ systemctl stop smbd nmbd
+ return 0
+ cond_redirect systemctl disable --now '/etc/systemd/system/srv-openhab2*'
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl disable --now /etc/systemd/system/srv-openhab2* \033[39;49;00m'

$ systemctl disable --now /etc/systemd/system/srv-openhab2*
+ systemctl disable --now '/etc/systemd/system/srv-openhab2*'
Warning: Can't execute disable on the unit file path. Proceeding with the unit name.
Failed to disable unit: Invalid argument
+ return 1
+ echo 'FAILED (disable mount units)'
FAILED (disable mount units)
+ for s in ${mountUnits}
+ [[ openhab == \o\p\e\n\h\a\b ]]
+ newname='/etc/systemd/system/srv-openhab*'
+ sed -e 's|openhab2|openhab|g' '/etc/systemd/system/srv-openhab*'
+ rm -f '/etc/systemd/system/srv-openhab*'
+ cond_redirect systemctl enable --now '/etc/systemd/system/srv-openhab*'
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl enable --now /etc/systemd/system/srv-openhab* \033[39;49;00m'

$ systemctl enable --now /etc/systemd/system/srv-openhab*
+ systemctl enable --now '/etc/systemd/system/srv-openhab*'
Failed to enable unit: File /etc/systemd/system/srv-openhab*: Invalid argument
+ return 1
+ echo 'FAILED (reenable mount units)'
FAILED (reenable mount units)
+ return 1
+ '[' 1 -ne 0 ']'
+ whiptail --msgbox 'There was an error or interruption during the execution of:\n  "40 | openHAB related"\n\nPlease 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.' 14 80

Samba mounts don't work until a system restart and then still link to the old directories.

Pathes after the update:

[15:23:11] openhabian@pi-openhab:~$ cd /etc/systemd/system/
[15:24:29] openhabian@pi-openhab:/etc/systemd/system$ ls -l
total 80
-rw-r--r-- 1 root root 1551 Jun 25  2019 autologin@.service
drwxr-xr-x 2 root root 4096 Nov 14 14:19 basic.target.wants
drwxr-xr-x 2 root root 4096 Jul 10  2019 bluetooth.target.wants
lrwxrwxrwx 1 root root   42 Jul 10  2019 dbus-fi.w1.wpa_supplicant1.service -> /lib/systemd/system/wpa_supplicant.service
lrwxrwxrwx 1 root root   37 Jul 10  2019 dbus-org.bluez.service -> /lib/systemd/system/bluetooth.service
lrwxrwxrwx 1 root root   40 Jul 10  2019 dbus-org.freedesktop.Avahi.service -> /lib/systemd/system/avahi-daemon.service
lrwxrwxrwx 1 root root   45 Jul 10  2019 dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service
lrwxrwxrwx 1 root root   34 Jul 10  2019 dhcpcd5.service -> /lib/systemd/system/dhcpcd.service
drwxr-xr-x 2 root root 4096 Jul 10  2019 dhcpcd.service.d
-rw-rw-r-- 1 root root  622 Nov 14 15:03 frontail.service
drwxr-xr-x 2 root root 4096 Jul 10  2019 getty.target.wants
drwxr-xr-x 2 root root 4096 Jul 10  2019 getty@tty1.service.d
drwxr-xr-x 2 root root 4096 Jul 10  2019 halt.target.wants
lrwxrwxrwx 1 root root   36 Apr  1  2020 influxd.service -> /lib/systemd/system/influxdb.service
drwxr-xr-x 2 root root 4096 Nov 14 14:32 multi-user.target.wants
drwxr-xr-x 2 root root 4096 Jul 10  2019 network-online.target.wants
drwxr-xr-x 2 root root 4096 Nov 14 14:32 openhab2.service.d
drwxr-xr-x 2 root root 4096 Jul 10  2019 poweroff.target.wants
drwxr-xr-x 2 root root 4096 Jul 10  2019 rc-local.service.d
drwxr-xr-x 2 root root 4096 Jul 10  2019 reboot.target.wants
drwxr-xr-x 2 root root 4096 Jul 10  2019 remote-fs.target.wants
lrwxrwxrwx 1 root root    9 Feb 21  2020 samba-ad-dc.service -> /dev/null
drwxr-xr-x 2 root root 4096 Jul 10  2019 sockets.target.wants
lrwxrwxrwx 1 root root   31 Jul 10  2019 sshd.service -> /lib/systemd/system/ssh.service
drwxr-xr-x 2 root root 4096 Jul 10  2019 sysinit.target.wants
lrwxrwxrwx 1 root root   35 Jul 10  2019 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 Jul 10  2019 timers.target.wants
lrwxrwxrwx 1 root root    9 Mar 24  2020 triggerhappy.service -> /dev/null
lrwxrwxrwx 1 root root    9 Mar 24  2020 triggerhappy.socket -> /dev/null
lrwxrwxrwx 1 root root    9 Nov 14 14:19 unattended-upgrades.service -> /dev/null
-rw-r--r-- 1 root root  293 Nov 14 14:19 zram-config.service
-rw-r--r-- 1 root root  453 Nov 14 14:19 zramsync.service

[15:29:01] openhabian@pi-openhab:/etc/systemd/system$ cd /srv
[15:29:06] openhabian@pi-openhab:/srv$ ls -l
total 24
drwxrwxr-x+  2 openhab openhab 4096 Nov 14 14:21 openhab2-addons
drwxrwxr-x+ 14 openhab openhab 4096 Nov 14 14:25 openhab2-conf
drwxrwxr-x+  2 openhab openhab 4096 Nov 14 14:21 openhab2-logs
drwxrwxr-x+  3 openhab openhab 4096 Nov 14 14:21 openhab2-sys
drwxrwxr-x+ 11 openhab openhab 4096 Nov 14 15:07 openhab2-userdata
-rw-rw-rw-   1 openhab openhab 1480 Feb 21  2020 README.txt
[15:29:07] openhabian@pi-openhab:/srv$

How to fix this manually?

eikowagenknecht commented 3 years ago

I edited /etc/fstab to

/usr/share/openhab          /srv/openhab-sys           none bind 0 0
/etc/openhab                /srv/openhab-conf          none bind 0 0
/var/lib/openhab            /srv/openhab-userdata      none bind 0 0
/var/log/openhab            /srv/openhab-logs          none bind 0 0
/usr/share/openhab/addons   /srv/openhab-addons        none bind 0 0

and /etc/samba/smb.conf to

#=================== Custom Share Definitions ====================

[openHAB-share]
  comment=openHAB combined folders
  path=/srv
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

[openHAB-conf]
  comment=openHAB site configuration
  path=/etc/openhab
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

and that mostly fixed it (still have duplicate entries in smb view, probably need to remove some folders under /srv)