Dpkg: unrecoverable fatal error, aborting: files list file for package 'wireless-regdb' is missing final newline

Hi,

I am running Ubuntu Mate 16.04.2 on a Raspberry Pi2.

I tried installing the latest updates for the system this week but I got an error:

rph@Pi2:~$ sudo apt-get update && sudo apt-get upgrade -y
[sudo] password for rph: 
Hit:1 http://ppa.launchpad.net/flexiondotorg/minecraft/ubuntu xenial InRelease 
Hit:2 http://ports.ubuntu.com xenial InRelease                                 
Get:3 http://ports.ubuntu.com xenial-updates InRelease [102 kB]                
Get:4 http://ports.ubuntu.com xenial-security InRelease [102 kB]               
Get:5 http://ports.ubuntu.com xenial-backports InRelease [102 kB]              
Hit:6 http://ppa.launchpad.net/ubuntu-mate-dev/welcome/ubuntu xenial InRelease
Hit:7 http://ppa.launchpad.net/ubuntu-mate-dev/xenial-mate/ubuntu xenial InRelease
Hit:8 https://dev2day.de/pms jessie InRelease                                 
Hit:9 http://ppa.launchpad.net/ubuntu-pi-flavour-makers/ppa/ubuntu xenial InRelease
Fetched 306 kB in 7s (38.6 kB/s)                                               
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apport apport-gtk bind9-host dnsutils firefox gir1.2-javascriptcoregtk-4.0
  gir1.2-webkit2-4.0 indicator-sound-gtk2 libbind9-140 libdns-export162
  libdns162 libisc-export160 libisc160 libisccc140 libisccfg140
  libjavascriptcoregtk-4.0-18 liblwres141 libperl5.22 libwebkit2gtk-4.0-37
  perl perl-base perl-modules-5.22 python3-apport python3-problem-report
  ubuntu-minimal ubuntu-standard xul-ext-ubufox
27 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 59.3 MB of archives.
After this operation, 4,676 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com xenial-updates/main armhf libperl5.22 armhf 5.22.1-9ubuntu0.2 [2,706 kB]
Get:2 http://ports.ubuntu.com xenial-updates/main armhf perl armhf 5.22.1-9ubuntu0.2 [237 kB]
Get:3 http://ports.ubuntu.com xenial-updates/main armhf perl-base armhf 5.22.1-9ubuntu0.2 [1,178 kB]
Get:4 http://ports.ubuntu.com xenial-updates/main armhf perl-modules-5.22 all 5.22.1-9ubuntu0.2 [2,661 kB]
Get:5 http://ports.ubuntu.com xenial-updates/main armhf libisc-export160 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [136 kB]
Get:6 http://ports.ubuntu.com xenial-updates/main armhf libdns-export162 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [603 kB]
Get:7 http://ports.ubuntu.com xenial-updates/main armhf ubuntu-minimal armhf 1.361.1 [2,540 B]
Get:8 http://ports.ubuntu.com xenial-updates/main armhf dnsutils armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [85.9 kB]
Get:9 http://ports.ubuntu.com xenial-updates/main armhf bind9-host armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [36.5 kB]
Get:10 http://ports.ubuntu.com xenial-updates/main armhf libisc160 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [185 kB]
Get:11 http://ports.ubuntu.com xenial-updates/main armhf libdns162 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [786 kB]
Get:12 http://ports.ubuntu.com xenial-updates/main armhf libisccc140 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [14.2 kB]
Get:13 http://ports.ubuntu.com xenial-updates/main armhf libisccfg140 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [33.1 kB]
Get:14 http://ports.ubuntu.com xenial-updates/main armhf liblwres141 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [29.4 kB]
Get:15 http://ports.ubuntu.com xenial-updates/main armhf libbind9-140 armhf 1:9.10.3.dfsg.P4-8ubuntu1.9 [21.9 kB]
Get:16 http://ports.ubuntu.com xenial-updates/main armhf ubuntu-standard armhf 1.361.1 [2,606 B]
Get:17 http://ports.ubuntu.com xenial-updates/main armhf python3-problem-report all 2.20.1-0ubuntu2.12 [9,860 B]
Get:18 http://ports.ubuntu.com xenial-updates/main armhf python3-apport all 2.20.1-0ubuntu2.12 [79.4 kB]
Get:19 http://ports.ubuntu.com xenial-updates/main armhf apport all 2.20.1-0ubuntu2.12 [120 kB]
Get:20 http://ports.ubuntu.com xenial-updates/main armhf apport-gtk all 2.20.1-0ubuntu2.12 [9,526 B]
Get:21 http://ports.ubuntu.com xenial-updates/main armhf firefox armhf 57.0+build4-0ubuntu0.16.04.5 [37.7 MB]
Get:22 http://ports.ubuntu.com xenial-updates/main armhf libwebkit2gtk-4.0-37 armhf 2.18.3-0ubuntu0.16.04.1 [9,400 kB]
Get:23 http://ports.ubuntu.com xenial-updates/main armhf libjavascriptcoregtk-4.0-18 armhf 2.18.3-0ubuntu0.16.04.1 [3,064 kB]
Get:24 http://ports.ubuntu.com xenial-updates/main armhf gir1.2-webkit2-4.0 armhf 2.18.3-0ubuntu0.16.04.1 [68.4 kB]
Get:25 http://ports.ubuntu.com xenial-updates/main armhf gir1.2-javascriptcoregtk-4.0 armhf 2.18.3-0ubuntu0.16.04.1 [21.3 kB]
Get:26 http://ports.ubuntu.com xenial-updates/main armhf xul-ext-ubufox all 3.4-0ubuntu0.16.04.2 [3,302 B]
Get:27 http://ports.ubuntu.com xenial-updates/universe armhf indicator-sound-gtk2 armhf 12.10.0.1-0ubuntu5.16.04.1 [68.8 kB]
Fetched 59.3 MB in 2min 32s (389 kB/s)                                         
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'wireless-regdb' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2) 

Can someone please tell me why it's giving that error ?

These are the updates that are trying to be installed as shown by Software Updater:

Thanks

Seems /var/lib/dpkg/info/ has some file for that package corrupt. Try …

sudo dpkg --configure -a
sudo apt update
sudo apt upgrade

Hi, I tried what you said but I get the exact same error at the end:

rph@Pi2:~$ sudo dpkg --configure -a
[sudo] password for rph: 

rph@Pi2:~$ sudo apt update
Hit:1 http://ppa.launchpad.net/flexiondotorg/minecraft/ubuntu xenial InRelease
Hit:2 http://ports.ubuntu.com xenial InRelease                                 
Get:3 http://ports.ubuntu.com xenial-updates InRelease [102 kB]                
Hit:4 http://ppa.launchpad.net/ubuntu-mate-dev/welcome/ubuntu xenial InRelease 
Hit:5 http://ppa.launchpad.net/ubuntu-mate-dev/xenial-mate/ubuntu xenial InRelease
Get:6 http://ports.ubuntu.com xenial-security InRelease [102 kB]               
Hit:7 http://ppa.launchpad.net/ubuntu-pi-flavour-makers/ppa/ubuntu xenial InRelease
Hit:8 https://dev2day.de/pms jessie InRelease                                  
Get:9 http://ports.ubuntu.com xenial-backports InRelease [102 kB]
Fetched 306 kB in 7s (40.5 kB/s)                                               
Reading package lists... Done
Building dependency tree       
Reading state information... Done
27 packages can be upgraded. Run 'apt list --upgradable' to see them.

rph@Pi2:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apport apport-gtk bind9-host dnsutils firefox gir1.2-javascriptcoregtk-4.0
  gir1.2-webkit2-4.0 indicator-sound-gtk2 libbind9-140 libdns-export162
  libdns162 libisc-export160 libisc160 libisccc140 libisccfg140
  libjavascriptcoregtk-4.0-18 liblwres141 libperl5.22 libwebkit2gtk-4.0-37
  perl perl-base perl-modules-5.22 python3-apport python3-problem-report
  ubuntu-minimal ubuntu-standard xul-ext-ubufox
27 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/59.3 MB of archives.
After this operation, 4,676 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'wireless-regdb' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

Please any other suggestions to fix this ? I have no idea what went wrong. The last time I ran an update (about a week ago) everything worked perfectly and I have not made any other changes since then…

Thanks

Do you have a file(s) in /var/lib/dpkg/info/wireless-regdb with some extension? Can you remove it and run the dpkg --configure -a again? Another idea is to remove that package with apt remove, make sure apt update/upgrade is clean, and then re-install that package … (I dont have a pi with mate to test but this is the theory …)

1 Like

I googled this earlier today, and I believe your solution might work.

Found a simular solution here that sounds reasonable as well:

http://www.solvium.de/blog/2013/raspberrypi-apt-get-error-dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-dmsetup-is-missing-final-newline/

1 Like

Thank-you very much ! This worked perfectly. :grinning:

There were 3 different files in the folder, I deleted them, repeated the steps, and everything went fine with no errors.