jbaans / iothermostat

Independent Open-source Thermostat
GNU General Public License v3.0
8 stars 1 forks source link

update base OS breaks system #3

Closed ardenking closed 3 years ago

ardenking commented 4 years ago

I wanted to add a cronie for a reboot if network lost script

I ran pacman -Syu cronie which updated the base OS and broke the thermostat

what is the safe way to update the base OS ?

jbaans commented 3 years ago

Hi Ardenking,

A somewhat delayed answer: Firstly, systemd timers might be a better we to go as systemd is already on the system. Concerning updating, yes it is possible to do late updates on this arch system. However, to quote to old cartographers: Here be dragons.

  1. Updating just pacman may already solve some future problems:

    sudo pacman -S pacman

  2. Run system wide update, saying 'Y' to the following: :: Replace geoclue2 with extra/geoclue? [Y/n] Y :: Replace libsystemd with core/systemd-libs? [Y/n] Y :: Replace libutil-linux with core/util-linux-libs? [Y/n] Y :: Replace xorg-luit with extra/luit? [Y/n] Y :: Replace xorg-mkfontdir with extra/xorg-mkfontscale? [Y/n] Y

The update will take a long time:

sudo pacman -Syu

  1. Reload daemons and fix some permissions

    sudo systemctl daemon-reload sudo chmod 0700 /var/log/audit sudo chmod 0700 /var/cache/lighttpd

  2. If step 2. showed hook errors, which are because of new versions of pacman and libalpm, reinstall all (new) packages.

    sudo pacman -S $(sudo pacman -Qq)

Then run each line resulting from catting these hook files:

cat /usr/share/libalpm/hooks/* |grep Exec | cut -c8- | sed 's/^/sudo /‘

  1. (Only required when using RTL 8188 Wifi dongle) Install rtl8188eu dkms driver from AUR because the update removed it:

    cd /home/iothermostat/builds mv 8188eu-dkms 8188eu-dkms.old git clone https://aur.archlinux.org/8188eu-dkms.git cd 8188eu-dkms makepkg -sirc

After the installation, check if 8188eu dkms is listed:

dkms status

  1. Fix mosquitto configuration: In /etc/mosquitto/conf.d/iothermostat.conf set:

    pid_file /var/run/mosquitto/mosquitto.pid

Set credential permissions:

sudo chown mosquitto:mosquitto /etc/mosquitto/credentials

Create a PID file location for mosquitto:

echo "d /var/run/mosquitto 0755 mosquitto mosquitto -" | sudo tee /usr/lib/tmpfiles.d/mosquitto.conf sudo chown mosquitto:mosquitto /var/run/mosquitto

  1. Update python packages:

    sudo python -m pip install paho-mqtt apscheduler sqlalchemy RPi.bme280

  2. Rebuild and install packages from source (bme280 is now a python package):

    cd /home/iothermostat/builds mv fake-hwclock-git fake-hwclock-git.old mv python-bme280 python-bme280.old mv python-raspberry-gpio python-raspberry-gpio.old

Fake-hwclock:

cd /home/iothermostat/builds git clone https://aur.archlinux.org/fake-hwclock-git.git cd fake-hwclock-git makepkg -sirc sudo systemctl restart fake-hwclock

python-raspberry-gpio:

cd /home/iothermostat/builds git clone https://aur.archlinux.org/python-raspberry-gpio.git cd python-raspberry-gpio makepkg -sirc

  1. Partial update IOThermostat, not config files:

    cd /home/iothermostat/builds rm -rf iothermostat git clone https://github.com/jbaans/iothermostat.git chmod +x deployIOThermostat.sh ./deployIOThermostat.sh cd /home/iothermostat sudo ./setMQTTpasswd.sh

  2. Restart services:

    sudo systemctl restart mosquitto.service sudo systemctl restart iothermostat.service

Browse to http://x.x.x.x/iothermostat/ and login with user: iothermostat and your GUI password. Check backend status is Active.

  1. Fix PAM passwd configuration:

    sudo pacman -Syu libpwquality sudo nano /etc/pam.d/passwd

comment out the pam_cracklib.so line, add the pam_pwquality line:

password required pam_cracklib.so retry=2 minlen=10 difok=6 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1

password required pam_pwquality.so retry=2 minlen=10

  1. Fix LCD touch screen:

    cd /home/iothermostat/builds git clone https://github.com/goodtft/LCD-show cd LCD-show sudo chmod +x LCD35-show nano LCD35-show

comment out this line:

sudo dpkg -i -B ./xserver-xorg-input-evdev_1%3a2.10.6-1+b1_armhf.deb 2> error_output.txt

Update evdev touch screen package:

sudo pacman -Sy xf86-input-evdev

Install the screen drivers:

sudo ./LCD35-show

Wait for reboot.

If not online, reconnect using IOTHERMOSTAT fallback wifi and SSH into system. Reconnect wifi of IOThermostat:

sudo ./connectWifi.sh YOUR_SSID

Reconnect via ssh and reboot again. Check system log of necessairy:

sudo journalctl -r

ardenking commented 3 years ago

thanks the the reply hopefully will help others ive changed to an esp8266 based solution now.