# Upgrade to latest via APT gives error on configure first time

**URL:** <https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205>\
**Category:** Upgrade\
**Created:** [March 20, 2024, 9:04am UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205 "2024-03-20T09:04:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![deemon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/deemon/32/7712_2.png) [@deemon](https://forum.mattermost.com/u/deemon)\
**Post date:** [March 20, 2024, 9:04am UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/1 "2024-03-20T09:04:11Z")

</div>

**Summary**  
When I use `sudo apt upgrade` and mattermost is to be upgraded I usually get something like this:

```auto
Setting up mattermost (9.5.2-0) ...
dpkg: error processing package mattermost (--configure):
 installed mattermost package post-installation script subprocess returned error exit status 1

```

and have to `sudo apt upgrade` second time, and then it just does the mattermost configuration second time and end successfully. Why did it fail first time? Everything seems to work fine, but how can I be sure – is there some way run mattermost health check?

For reference previously was installed mattermost 9.3.0-0 and system is Ubuntu 20.04 server.  
Also just in case before `apt upgrade` did this time `systemctl stop mattermost`, which didn’t help either.

from `/var/log/dpkg.log`  
2024-03-20 09:24:26 upgrade mattermost:amd64 9.3.0-0 9.5.2-0  
2024-03-20 09:24:26 status half-configured mattermost:amd64 9.3.0-0  
2024-03-20 09:24:26 status unpacked mattermost:amd64 9.3.0-0  
2024-03-20 09:24:26 status half-installed mattermost:amd64 9.3.0-0  
2024-03-20 09:24:45 status unpacked mattermost:amd64 9.5.2-0  
…  
2024-03-20 09:25:48 configure mattermost:amd64 9.5.2-0   
2024-03-20 09:25:48 status unpacked mattermost:amd64 9.5.2-0  
2024-03-20 09:25:48 status half-configured mattermost:amd64 9.5.2-0 =\> which ended with “error 1” after 43 seconds doing something.  
2024-03-20 09:26:31 configure python3-update-manager:all 1:20.04.10.20

and then second attempt did it in 1 second successfully:  
2024-03-20 09:36:38 configure mattermost:amd64 9.5.2-0   
2024-03-20 09:36:38 status half-configured mattermost:amd64 9.5.2-0  
2024-03-20 09:36:39 status installed mattermost:amd64 9.5.2-0

**Steps to reproduce**  
just run `sudo apt update` and `sudo apt upgrade`…

**Expected behavior**  
no errors and everything works on first try.

**Observed behavior**  
had to run `sudo apt upgrade` again.

---

<div class="post-metadata">

**Author:** ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)\
**Post date:** [March 20, 2024, 1:07pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/2 "2024-03-20T13:07:02Z")

</div>

Try `sudo apt install --reinstall mattermost`

---

<div class="post-metadata">

**Author:** ![deemon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/deemon/32/7712_2.png) [@deemon](https://forum.mattermost.com/u/deemon)\
**Post date:** [March 20, 2024, 2:00pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/3 "2024-03-20T14:00:04Z")

</div>

> [@john.oliver](#):
>
> sudo apt install --reinstall mattermost

Everything seems to be “normal”. Time will tell if the next actual upgrade goes without any errors. 🙂

```auto
$ sudo apt install --reinstall mattermost
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/430 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 117145 files and directories currently installed.)
Preparing to unpack .../mattermost_9.5.2-0_amd64.deb ...
Unpacking mattermost (9.5.2-0) over (9.5.2-0) ...
Setting up mattermost (9.5.2-0) ...

```

However I still see one “leftover” link `/usr/bin/platform`:

```auto
$ cat /var/lib/dpkg/info/mattermost.list | grep "bin"
/opt/mattermost/bin
/opt/mattermost/bin/mattermost
/opt/mattermost/bin/mmctl
/usr/bin
/usr/bin/mattermost
/usr/bin/mmctl
/usr/bin/platform
$ ls -lah /usr/bin/platform 
lrwxrwxrwx 1 root root 28 Mar 1 22:15 /usr/bin/platform -> /opt/mattermost/bin/platform
$ ls -lah /opt/mattermost/bin/
total 190M
drwxr-xr-x 2 mattermost mattermost 4.0K Mar 20 15:52 .
drwxr-xr-x 12 mattermost mattermost 4.0K Mar 20 15:52 ..
-rwxr-xr-x 1 mattermost mattermost 104M Mar 1 21:03 mattermost
-rwxr-xr-x 1 mattermost mattermost 86M Mar 1 21:03 mmctl

```

---

<div class="post-metadata">

**Author:** ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)\
**Post date:** [March 20, 2024, 2:28pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/4 "2024-03-20T14:28:28Z")

</div>

![800px-Hands-Fingers-Crossed](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/1/15240a6f639a6f2f959ab79819b64604ba0fe4d3.jpeg)

---

<div class="post-metadata">

**Author:** ![deemon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/deemon/32/7712_2.png) [@deemon](https://forum.mattermost.com/u/deemon)\
**Post date:** [March 21, 2024, 1:57pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/5 "2024-03-21T13:57:08Z")

</div>

followup questions … after upgrading everything I did:

```auto
$ sudo systemctl disable mattermost.service 
Removed /etc/systemd/system/multi-user.target.wants/mattermost.service.
Removed /etc/systemd/system/mysql.service.wants/mattermost.service.

```

follower by `sudo do-release-upgrade` (from Ubuntu 20.04 to 22.04).  
Which was successfully finished.

```auto
$ sudo systemctl enable mattermost
Created symlink /etc/systemd/system/multi-user.target.wants/mattermost.service → /lib/systemd/system/mattermost.service.

```

and noticed, that … mysql isn’t anymore wanted or required for mattermost service?

---

<div class="post-metadata">

**Author:** ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)\
**Post date:** [March 21, 2024, 2:30pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/6 "2024-03-21T14:30:08Z")

</div>

You could manually (re)add to /etc/systemd/system/mattermost.service I don’t think we control the systemd unit file. I know we do not presuppose what database or where it’s located.

Please keep in mind that MySQL support will be removed soon, and PostgreSQL will be the supported option going forward. [https://docs.mattermost.com/deploy/postgres-migration.html](https://docs.mattermost.com/deploy/postgres-migration.html)

---

<div class="post-metadata">

**Author:** ![mboe](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@mboe](https://forum.mattermost.com/u/mboe)\
**Post date:** [March 27, 2024, 7:41pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/7 "2024-03-27T19:41:47Z")

</div>

I have the very same problem and previous hints do not work for me. Error is:

```auto
# dpkg --configure -a
Setting up mattermost (9.6.1-0) ...
**dpkg:** error processing package mattermost (--configure):
installed mattermost package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
mattermost

```

Wondering what else I could try. Any hints?

---

<div class="post-metadata">

**Author:** ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)\
**Post date:** [March 27, 2024, 11:45pm UTC](https://forum.mattermost.com/t/upgrade-to-latest-via-apt-gives-error-on-configure-first-time/18205/8 "2024-03-27T23:45:07Z")

</div>

Take a look at [How to debug dpkg configure error in subprocess post-installation? - Ask Ubuntu](https://askubuntu.com/questions/422264/how-to-debug-dpkg-configure-error-in-subprocess-post-installation)
