openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown #154

Closed dwrobel closed 4 years ago

dwrobel commented 4 years ago

I have tried to update from 2.5.0 to 2.5.1-2 on RPi4 on Fedora31 and I’m observing the following error during update:

error: unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown
    error: openhab2-0:2.5.1-2.noarch: install failed

A full log (please ignore the everything related to mosquitto - it has no impact on openhab2 installation):

$ sudo dnf update
[sudo] password for dw:
Last metadata expiration check: 1:13:29 ago on Mon 13 Jan 2020 09:46:01 CET.
Dependencies resolved.

 Problem: package mosquitto-1.6.8-1.fc30.armv7hl requires libwebsockets.so.14, but none of the providers can be installed
  - cannot install both libwebsockets-3.2.1-1.fc30.armv7hl and libwebsockets-3.1.0-2.fc30.armv7hl
  - cannot install both libwebsockets-3.1.0-2.fc30.armv7hl and libwebsockets-3.2.1-1.fc30.armv7hl
  - cannot install the best update candidate for package mosquitto-1.6.8-1.fc30.armv7hl
  - cannot install the best update candidate for package libwebsockets-3.1.0-2.fc30.armv7hl
==============================================================================================================================================================================================================================================
 Package                                                     Architecture                                        Version                                                     Repository                                                  Size
==============================================================================================================================================================================================================================================
Upgrading:
 openhab2                                                    noarch                                              2.5.1-2                                                     openHAB-Stable                                              79 M
 openhab2-addons                                             noarch                                              2.5.1-2                                                     openHAB-Stable                                             181 M
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
 libwebsockets                                               armv7hl                                             3.2.1-1.fc30                                                updates                                                    197 k

Transaction Summary
==============================================================================================================================================================================================================================================
Upgrade  2 Packages
Skip     1 Package

Total download size: 261 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): openhab2-2.5.1-2.noarch.rpm                                                                                                                                                                            3.8 MB/s |  79 MB     00:21    
(2/2): openhab2-addons-2.5.1-2.noarch.rpm                                                                                                                                                                     5.8 MB/s | 181 MB     00:31    
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         8.3 MB/s | 261 MB     00:31     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Running scriptlet: openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       1/1 
  Preparing        :                                                                                                                                                                                                                      1/1 
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/4 
  Upgrading        : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/4 
Error unpacking rpm package openhab2-2.5.1-2.noarch
  Running scriptlet: openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       2/4 
error: unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown
error: openhab2-0:2.5.1-2.noarch: install failed

  Upgrading        : openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       2/4 
  Running scriptlet: openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       2/4 
  Running scriptlet: openhab2-addons-2.5.0-1.noarch                                                                                                                                                                                       3/4 
  Cleanup          : openhab2-addons-2.5.0-1.noarch                                                                                                                                                                                       3/4 
warning: file /usr/share/openhab2/addons/openhab-addons-2.5.0.kar: remove failed: No such file or directory

  Running scriptlet: openhab2-addons-2.5.0-1.noarch                                                                                                                                                                                       3/4 
  Running scriptlet: openhab2-2.5.0-1.noarch                                                                                                                                                                                              4/4 
  Cleanup          : openhab2-2.5.0-1.noarch                                                                                                                                                                                              4/4 
  Running scriptlet: openhab2-2.5.0-1.noarch                                                                                                                                                                                              4/4 
  Running scriptlet: openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       4/4 
  Running scriptlet: openhab2-2.5.0-1.noarch                                                                                                                                                                                              4/4 
  Verifying        : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/4 
  Verifying        : openhab2-2.5.0-1.noarch                                                                                                                                                                                              2/4 
  Verifying        : openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                       3/4 
  Verifying        : openhab2-addons-2.5.0-1.noarch                                                                                                                                                                                       4/4 

Upgraded:
  openhab2-addons-2.5.1-2.noarch                                                                                                                                                                                                              

Skipped:
  libwebsockets-3.2.1-1.fc30.armv7hl                                                                                                                                                                                                          

Failed:
  openhab2-2.5.1-2.noarch                                                                                                                                                                                                                     

Error: Transaction failed

Interestingly, the same error happened earlier, when I tried to update from 2.4.0 to 2.5.0 using dnf, (I had to update it manually using rpm).

kaikreuzer commented 4 years ago

I have rebuilt the metadata and hope that this has fixed the issue. Could you please check?

BClark09 commented 4 years ago

It looks like in this case the repo is behaving correctly, but the package is not. This would only affect yum and dnf installs.

error: unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown

I haven't changed anything to the packages since last time I tested on Fedora 31, but I'll see what the cause of this could be.

dwrobel commented 4 years ago

I think, I have a reproducible scenario by using the following set of commands:

$ rpm -qv openhab2
$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
$ rpm -qv openhab2
$ sudo dnf localinstall -y openhab2-2.5.1-2.noarch.rpm 
$ rpm -qv openhab2
$ sudo dnf localinstall -y openhab2-2.5.1-2.noarch.rpm 
$ rpm -qv openhab2
$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
$ rpm -qv openhab2
$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
$ rpm -qv openhab2

where openhab2-2.5.0-1.noarch.rpm and openhab2-2.5.1-2.noarch.rpm should be available locally. I'm using the versions which were downloaded from the dnf repo shortly after I did an initial installation and noticed the problem with the installation.

Here is the full log:

[dw@rpi4-dw ~]$ rpm -qv openhab2
openhab2-2.5.1-2.noarch
[dw@rpi4-dw ~]$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
Verifying packages...
Preparing packages...
openhab2-0:2.5.0-1.noarch

[openHAB] openHAB was not running so will not start after upgrade.
[openHAB] Please use the command:
            sudo /bin/systemctl start openhab2.service

openhab2-0:2.5.1-2.noarch
[dw@rpi4-dw ~]$ rpm -qv openhab2
openhab2-2.5.0-1.noarch
[dw@rpi4-dw ~]$ sudo dnf localinstall -y openhab2-2.5.1-2.noarch.rpm 
Last metadata expiration check: 0:38:09 ago on Mon 13 Jan 2020 18:08:09 CET.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                  Architecture                                           Version                                                   Repository                                                    Size
==============================================================================================================================================================================================================================================
Upgrading:
 openhab2                                                 noarch                                                 2.5.1-2                                                   @commandline                                                  79 M

Transaction Summary
==============================================================================================================================================================================================================================================
Upgrade  1 Package

Total size: 79 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Preparing        :                                                                                                                                                                                                                      1/1 
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/2 
  Upgrading        : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/2 
Error unpacking rpm package openhab2-2.5.1-2.noarch
  Running scriptlet: openhab2-2.5.0-1.noarch                                                                                                                                                                                              2/2 
error: unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown
error: openhab2-0:2.5.1-2.noarch: install failed

  Cleanup          : openhab2-2.5.0-1.noarch                                                                                                                                                                                              2/2 
  Running scriptlet: openhab2-2.5.0-1.noarch                                                                                                                                                                                              2/2 
  Verifying        : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/2 
  Verifying        : openhab2-2.5.0-1.noarch                                                                                                                                                                                              2/2 

Failed:
  openhab2-2.5.1-2.noarch                                                                                                                                                                                                                     

Error: Transaction failed
[dw@rpi4-dw ~]$ rpm -qv openhab2
package openhab2 is not installed
[dw@rpi4-dw ~]$ sudo dnf localinstall -y openhab2-2.5.1-2.noarch.rpm 
Last metadata expiration check: 0:38:37 ago on Mon 13 Jan 2020 18:08:09 CET.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                  Architecture                                           Version                                                   Repository                                                    Size
==============================================================================================================================================================================================================================================
Installing:
 openhab2                                                 noarch                                                 2.5.1-2                                                   @commandline                                                  79 M

Transaction Summary
==============================================================================================================================================================================================================================================
Install  1 Package

Total size: 79 M
Installed size: 90 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Preparing        :                                                                                                                                                                                                                      1/1 
  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
  Installing       : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
warning: /etc/default/openhab2 created as /etc/default/openhab2.rpmnew

  Running scriptlet: openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 
[openHAB] Please use the following commands to launch openHAB on a system restart.
            sudo /bin/systemctl daemon-reload
            sudo /bin/systemctl enable openhab2.service

[openHAB] You can start openhab2 manually by executing the command:
            sudo /bin/systemctl start openhab2.service

  Verifying        : openhab2-2.5.1-2.noarch                                                                                                                                                                                              1/1 

Installed:
  openhab2-2.5.1-2.noarch                                                                                                                                                                                                                     

Complete!
[dw@rpi4-dw ~]$ rpm -qv openhab2
openhab2-2.5.1-2.noarch
[dw@rpi4-dw ~]$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
Verifying packages...
Preparing packages...
openhab2-0:2.5.0-1.noarch
error: unpacking of archive failed on file /var/lib/openhab2/tmp/README: cpio: chown failed - No such file or directory
error: openhab2-0:2.5.0-1.noarch: install failed
error: openhab2-0:2.5.1-2.noarch: erase skipped
[dw@rpi4-dw ~]$ rpm -qv openhab2
openhab2-2.5.1-2.noarch
[dw@rpi4-dw ~]$ sudo rpm -vU --oldpackage openhab2-2.5.0-1.noarch.rpm
Verifying packages...
Preparing packages...
openhab2-0:2.5.0-1.noarch

[openHAB] openHAB was not running so will not start after upgrade.
[openHAB] Please use the command:
            sudo /bin/systemctl start openhab2.service

openhab2-0:2.5.1-2.noarch
[dw@rpi4-dw ~]$ rpm -qv openhab2
openhab2-2.5.0-1.noarch

The failure can be observed in the first attempt of both: update and downgrade procedure.

dwrobel commented 4 years ago

Looking more closely at the log I noticed that the second attempt of installation succeeded only because due to the previous transaction failure the package is marked as not installed.

$ rpm -qv openhab2
package openhab2 is not installed

Then, the next dnf is not executed as an upgrade but as an install:

[dw@rpi4-dw ~]$ sudo dnf localinstall -y openhab2-2.5.1-2.noarch.rpm

That probably explains why it always succeeded in the second run.

BClark09 commented 4 years ago

Found the cause of the issue which has been resolved by #156. The RPM scripts were trying to force the README file from being installed even though the folder is marked for deletion on update.

Not sure if its worth creating a new package for Bintray though. Let me know your thoughts on that!

dwrobel commented 4 years ago

Found the cause of the issue which has been resolved by #156.

Great! I updated all my instances by using double dnf install trick. So, if it's just one button click operation to create an update - then I would say yes. Otherwise, I would left it to you.