openhab / openhabian

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

[OH3] openhabian-config path error in openHAB related (40) --> Upgrade to OH3 (42) #1272

Closed mj1911 closed 3 years ago

mj1911 commented 3 years ago

When running openhabian-config --> openHAB Related (40) --> upgrade to openHAB 3 (42) menu, it fails near the end on "swapping" samba from OH2 to OH3. OH3 upgrade has previously completed and is running, but gave this error. Re-running gives same error:

+ 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
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-11-28_11:34:19_EST [openHABian] Migrating Amanda config... '
+ for i in $amandaConfigs
+ [[ -s /etc/amanda/openhab-*/disklist ]]
+ echo OK
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-11-28_11:34:19_EST [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
+ return 0
+ cond_redirect systemctl disable --now 'srv-openhab2\x2daddons.mount' 'srv-openhab2\x2dconf.mount' 'srv-openhab2\x2dlogs.mount' 'srv-openhab2\x2duserdata.mount' 'srv-openhab2\x2dsys.mount'
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl disable --now srv-openhab2\x2daddons.mount srv-openhab2\x2dconf.mount srv-openhab2\x2dlogs.mount srv-openhab2\x2duserdata.mount srv-openhab2\x2dsys.mount \033[39;49;00m'
+ systemctl disable --now 'srv-openhab2\x2daddons.mount' 'srv-openhab2\x2dconf.mount' 'srv-openhab2\x2dlogs.mount' 'srv-openhab2\x2duserdata.mount' 'srv-openhab2\x2dsys.mount'
Failed to disable unit: Unit file srv-openhab2\x2daddons.mount does not exist.
+ return 1
+ echo '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*'
+ services='srv-openhab\x2daddons.mount srv-openhab\x2dconf.mount srv-openhab\x2dlogs.mount srv-openhab\x2duserdata.mount  srv-openhab\x2dsys.mount'
+ cond_redirect systemctl enable --now 'srv-openhab\x2daddons.mount' 'srv-openhab\x2dconf.mount' 'srv-openhab\x2dlogs.mount' 'srv-openhab\x2duserdata.mount' 'srv-openhab\x2dsys.mount'
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ systemctl enable --now srv-openhab\x2daddons.mount srv-openhab\x2dconf.mount srv-openhab\x2dlogs.mount srv-openhab\x2duserdata.mount srv-openhab\x2dsys.mount \033[39;49;00m'
+ systemctl enable --now 'srv-openhab\x2daddons.mount' 'srv-openhab\x2dconf.mount' 'srv-openhab\x2dlogs.mount' 'srv-openhab\x2duserdata.mount' 'srv-openhab\x2dsys.mount'
Failed to enable unit: Unit file srv-openhab\x2daddons.mount does not exist.
+ return 1
+ echo '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

Afterwards, running Apply Improvements (10) --> Samba (16) enables samba shares correctly, and they are browesable from the network:

+ echo -n '2020-11-28_11:52:09_EST [openHABian] Setting up Samba network shares... '
2020-11-28_11:52:09_EST [openHABian] Setting up Samba network shares... + cond_echo '\nCopying over custom '\''smb.conf'\''... '
+ [[ -z '' ]]
+ echo -e '\033[33;01m\nCopying over custom '\''smb.conf'\''... \033[39;49;00m'

Copying over custom 'smb.conf'...
+ cond_redirect cp /opt/openhabian/includes/smb.conf /etc/samba/smb.conf
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ cp /opt/openhabian/includes/smb.conf /etc/samba/smb.conf \033[39;49;00m'

$ cp /opt/openhabian/includes/smb.conf /etc/samba/smb.conf
+ cp /opt/openhabian/includes/smb.conf /etc/samba/smb.conf
+ return 0
+ cond_echo '\nWriting authentication data to openHABian default... '
+ [[ -z '' ]]
+ echo -e '\033[33;01m\nWriting authentication data to openHABian default... \033[39;49;00m'

Writing authentication data to openHABian default...
+ smbpasswd -e openhabian
+ echo OK
OK
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-11-28_11:52:10_EST [openHABian] Setting up Samba service... '
2020-11-28_11:52:10_EST [openHABian] Setting up Samba service... + cond_redirect mkdir -p /var/log/samba /var/run/samba
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ mkdir -p /var/log/samba /var/run/samba \033[39;49;00m'

$ mkdir -p /var/log/samba /var/run/samba
+ mkdir -p /var/log/samba /var/run/samba
+ return 0
+ cond_redirect sed -i -E -e '/PIDFile/d; /NotifyAccess/ a PIDFile=smbd.pid\nRuntimeDirectory=samba' /lib/systemd/system/smbd.service
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ sed -i -E -e /PIDFile/d; /NotifyAccess/ a PIDFile=smbd.pid\nRuntimeDirectory=samba /lib/systemd/system/smbd.service \033[39;49;00m'

$ sed -i -E -e /PIDFile/d; /NotifyAccess/ a PIDFile=smbd.pid
RuntimeDirectory=samba /lib/systemd/system/smbd.service
+ sed -i -E -e '/PIDFile/d; /NotifyAccess/ a PIDFile=smbd.pid\nRuntimeDirectory=samba' /lib/systemd/system/smbd.service
+ return 0
+ cond_redirect systemctl -q daemon-reload
+ cond_redirect systemctl enable --now smbd.service
+ echo OK
OK
+ '[' 0 -ne 0 ']'
+ true
+ show_main_menu
mstormi commented 3 years ago

Cannot reproduce with a fresh install. Seems /etc/systemd/system/srv-openhab2\x2daddons.mount is missing on your box while the mount files for the other shares are there.

Are all shares missing afterwards or just the addons share ? Try again please to install with a fresh install from the image. Make sure you use the masterbranch right away so put clonebranch=master in openhabian.conf BEFORE you install. Is there a /etc/systemd/system/srv-openhab2\x2daddons.mount after install? List all srv-.mount files please and show `systemctl status srv-openhab` output

Right after fresh install and again after selecting OH3 migration.

mstormi commented 3 years ago

tried again still cannot reproduce thus closing. If you still encounter this with a fresh install you can reopen