[Ubuntu][dpkg][自分用メモ] パッケージのインストールの際に、dpkg error: “trying to overwrite file, which is also in…”が出たときの対処方法

2019-02-02 14:17:51Ubuntucrda, dpkg, trouble, ubuntu, wireless-regdb, インストール

yusril-permana-ali-482077-unsplash

自宅環境のLinuxのアップデートをしていたところ、以下のようなメッセージが出力されていることに気が付きました。

dpkg: error processing archive /var/cache/apt/archives/armbian-firmware_5.74.190131_all.deb (--unpack):
trying to overwrite '/lib/firmware/regulatory.db', which is also in package wireless-regdb 2018.05.09-0ubuntu1~18.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/armbian-firmware_5.74.190131_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


どうやら何らかの原因で依存性のあるパッケージのために置き換えることができない、というもののようです。

対応方法

この場合は、「wireless-regdb」パッケージを削除して対応するのが良さそうです。

$ sudo dpkg -P wireless-regdb
dpkg: dependency problems prevent removal of wireless-regdb:
crda depends on wireless-regdb.
dpkg: error processing package wireless-regdb (--purge):
dependency problems - not removing
Errors were encountered while processing:
wireless-regdb

あら、今度は「crda」パッケージみたいです。というわけでこちらのパッケージも削除。

$ sudo dpkg -P crda
(Reading database ... 56160 files and directories currently installed.)
Removing crda (3.18-1build1) ...
Purging configuration files for crda (3.18-1build1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
$ sudo dpkg -P wireless-regdb
(Reading database ... 56140 files and directories currently installed.)
Removing wireless-regdb (2018.05.09-0ubuntu1~18.04.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

確認

再度パッケージのアップデートができるか試してみます。

$ sudo apt-fast upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  armbian-firmware
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
13 not fully installed or removed.
Need to get 0 B/5,755 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 56130 files and directories currently installed.)
Preparing to unpack .../armbian-firmware_5.74.190131_all.deb ...
Unpacking armbian-firmware (5.74.190131) over (5.72.190122) ...
Setting up armbian-config (5.74.190131) ...
Setting up sunxi-tools (1.4.2-2~armbian5.74.190131+1) ...
Setting up armbian-tools-bionic (5.74.190131) ...
Setting up linux-image-rockchip64 (5.74.190131) ...
update-initramfs: Generating /boot/initrd.img-4.4.172-rockchip64
update-initramfs: Converting to u-boot format
Setting up hostapd (3:2.7-99~armbian5.74.190131+1) ...
Setting up linux-headers-rockchip64 (5.74.190131) ...
Compiling headers - please wait ...
Setting up armbian-firmware (5.74.190131) ...
Setting up libkmod2:arm64 (24-1ubuntu3.2) ...
Setting up kubelet (1.13.3-00) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up linux-u-boot-rock64-default (5.74.190131) ...
Processing triggers for systemd (237-3ubuntu10.11) ...
Setting up kubectl (1.13.3-00) ...
Setting up kubeadm (1.13.3-00) ...
Setting up linux-dtb-rockchip64 (5.74.190131) ...
Setting up kmod (24-1ubuntu3.2) ...
Installing new version of config file /etc/modprobe.d/blacklist.conf ...
$

問題なさそうです。

各々のパッケージについて

ちなみに、wireless-regdbcrdaですが、無線LAN関係のLinuxとの仲立ちをするものみたいですね。
この環境では無線LANは使用しないので私は問題なかったですが、無線LANを使用する環境だと、少し考える必要がありそうです。


2019-02-02 14:17:51Ubuntucrda, dpkg, trouble, ubuntu, wireless-regdb, インストール