The update from ChirpStack OS 4.3.1 to 4.5.2 fails on my RAK7248 using a RAK2287 shield. I can access the OpenWrt web interface, but the ChirpStack web interface fails to load. The restore.sh command also generated errors (see below).
Steps:
- Currently running ChirpStack 4.8 with tenant, API keys, device profiles applications…
- Backup Postgres and Redis databases per Changelog instructions: WRT console System > Custom Commands
- Download the new 4.5.2 Sysupgrade image for Raspberry Pi 4B (my RAK7248)
- Flash the Sysupgrade image using OpenWrt web interface
- Run the ChirpStack Restore command
- Using OpenWrt web interface, manually enable the Concentratord and MQTT Forwarder after restoring the databases.
restore.sh errors:
‘/opt/chirpstack/restore.sh’
Restore PostgreSQL database
Restore Redis database
pg_restore: error: could not execute query: ERROR: cannot drop constraint tenant_pkey on table public.tenant because other objects depend on it
DETAIL: constraint relay_gateway_tenant_id_fkey on table public.relay_gateway depends on index public.tenant_pkey
HINT: Use DROP … CASCADE to drop the dependent objects too.
Command was: ALTER TABLE ONLY public.tenant DROP CONSTRAINT tenant_pkey;
pg_restore: error: could not execute query: ERROR: cannot drop table public.tenant because other objects depend on it
DETAIL: constraint relay_gateway_tenant_id_fkey on table public.relay_gateway depends on table public.tenant
HINT: Use DROP … CASCADE to drop the dependent objects too.
Command was: DROP TABLE public.tenant;
pg_restore: error: could not execute query: ERROR: relation “tenant” already exists
Command was: CREATE TABLE public.tenant (
id uuid NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
name character varying(100) NOT NULL,
description text NOT NULL,
can_have_gateways boolean NOT NULL,
max_device_count integer NOT NULL,
max_gateway_count integer NOT NULL,
private_gateways_up boolean NOT NULL,
private_gateways_down boolean NOT NULL,
tags jsonb NOT NULL
);
pg_restore: error: COPY failed for table “tenant”: ERROR: duplicate key value violates unique constraint “tenant_pkey”
DETAIL: Key (id)=(52f14cd4-c6f1-4fbd-8f87-4025e1d49242) already exists.
CONTEXT: COPY tenant, line 1
pg_restore: error: could not execute query: ERROR: multiple primary keys for table “tenant” are not allowed
Command was: ALTER TABLE ONLY public.tenant
ADD CONSTRAINT tenant_pkey PRIMARY KEY (id);
pg_restore: warning: errors ignored on restore: 5
ln: /var/lib/redis/redis: File exists