dpkg: unrecoverable fatal error

Asked by Jim Willsher on 2010-06-07

Major problem with Lucid x64 when using apt-get update or aptitude safe-upgrade

Hit http://security.ubuntu.com lucid-security Release.gpg
Ign http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-en_GB
Hit http://gb.archive.ubuntu.com lucid Release.gpg
<snip>
Fetched 1B in 1s (1B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed
  linux-headers-2.6.32-22 linux-headers-2.6.32-22-server linux-image-2.6.32-22-server
The following packages will be upgraded:
  linux-headers-server linux-image-server linux-server
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.6MB of archives.
After this operation, 210MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get: 1 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-2.6.32-22-server 2.6.32-22.36 [30.9MB]
Get: 2 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22 2.6.32-22.36 [9,868kB]
Get: 3 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22-server 2.6.32-22.36 [748kB]
Get: 4 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-server 2.6.32.22.23 [3,964B]
Get: 5 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-server 2.6.32.22.23 [3,968B]
Get: 6 http://gb.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-server 2.6.32.22.23 [3,974B]
Fetched 41.6MB in 49s (844kB/s)
Selecting previously deselected package linux-image-2.6.32-22-server.
(Reading database ... 50996 files and directories currently installed.)
Unpacking linux-image-2.6.32-22-server (from .../linux-image-2.6.32-22-server_2.6.32-22.36_amd64.deb) ...
Done.
Selecting previously deselected package linux-headers-2.6.32-22.
Unpacking linux-headers-2.6.32-22 (from .../linux-headers-2.6.32-22_2.6.32-22.36_all.deb) ...
Selecting previously deselected package linux-headers-2.6.32-22-server.
Unpacking linux-headers-2.6.32-22-server (from .../linux-headers-2.6.32-22-server_2.6.32-22.36_amd64.deb) ...
Preparing to replace linux-headers-server 2.6.32.21.22 (using .../linux-headers-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-headers-server ...
Preparing to replace linux-server 2.6.32.21.22 (using .../linux-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-server ...
Preparing to replace linux-image-server 2.6.32.21.22 (using .../linux-image-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-image-server ...
Setting up linux-image-2.6.32-22-server (2.6.32-22.36) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-22-server
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-22-server
Found initrd image: /boot/initrd.img-2.6.32-22-server
Found linux image: /boot/vmlinuz-2.6.32-21-server
Found initrd image: /boot/initrd.img-2.6.32-21-server
Found memtest86+ image: /boot/memtest86+.bin
Found Ubuntu 10.04 LTS (10.04) on /dev/sda1
done

Setting up linux-headers-2.6.32-22 (2.6.32-22.36) ...
dpkg: unrecoverable fatal error, aborting:
 unable to create `/var/lib/dpkg/updates/tmp.i': Invalid argument
E: Sub-process /usr/bin/dpkg returned an error code (2)
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

Running dpkg --configure -a then leaves the system in an unstable state, including unbootable and requiring fsck.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu dpkg Edit question
Assignee:
No assignee Edit question
Solved by:
Jim Willsher
Solved:
2010-06-07
Last query:
2010-06-07
Last reply:
2010-06-07

Hi,

First please make sure to close all open programs, including all package managers like Synaptic, Add/remove programs, etc ...

Then please try this procedure:

Step 1: Open Terminal from "Applications->Accessories->
Terminal"

Step 2: Please COPY-PASTE each line below into the Terminal then hit <enter> after each line)

Tip: If you have a wheel mouse or 3 button mouse, you do not need to type commands into the Terminal. Highlight the command written on the webpage. Move your cursor anywhere in the Terminal and press the wheel or middle button. Automatic Copy and paste! No spelling mistakes! No Typos! No other errors!

cat /etc/lsb-release
uname -a
sudo rm /var/lib/apt/lists/lock
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo aptitude clean
LANG=C;sudo aptitude autoclean
LANG=C;sudo apt-get update
sudo dpkg --clear-avail
sudo dpkg --configure -a
LANG=C;sudo aptitude install -f
LANG=C;sudo aptitude update
LANG=C;sudo aptitude dist-upgrade

Step 3: Please post results (copy/paste terminal output from each command) on this thread

Hope it helps,

Regards,

Mark

Jim Willsher (jim-jimwillsher) said : #3

Many thanks for the quick responses folks, much appreciated.

I can recreate this on a clean install of 10.04, running under Hyper-V with the vm_ modules loaded. This seems an extremely robust setup, all except for this one niggling problem.

Here's the output from those commands immediately AFTER doing aptitude update followed by aptitude safe-upgrade, on a clean install, and when the problem has manifested itself. i've included the last few lines of the error for reference:

Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up linux-headers-2.6.32-22 (2.6.32-22.36) ...
Setting up linux-headers-2.6.32-22-server (2.6.32-22.36) ...

Setting up linux-headers-server (2.6.32.22.23) ...
Setting up linux-image-2.6.32-22-server (2.6.32-22.36) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-22-server
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-22-server
Found initrd image: /boot/initrd.img-2.6.32-22-server
Found linux image: /boot/vmlinuz-2.6.32-21-server
Found initrd image: /boot/initrd.img-2.6.32-21-server
Found memtest86+ image: /boot/memtest86+.bin
rmdir: failed to remove `/var/lib/os-prober/mount': Device or resource busy
done

Setting up apt-utils (0.7.25.3ubuntu9) ...
dpkg: unrecoverable fatal error, aborting:
 unable to create `/var/lib/dpkg/updates/tmp.i': Invalid argument
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install. Trying to recover:
dpkg: failed to open `/var/lib/dpkg/status' for writing status information: Invalid argument
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
E: Could not regain the system lock! (Perhaps another apt or dpkg is running?)
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initialising package states... Done

cat /etc/lsb-release

root@squeeze:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"

uname -a

root@squeeze:~# uname -a
Linux squeeze 2.6.32-21-server #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 x86_64 GNU/Linux

sudo rm /var/lib/apt/lists/lock

root@squeeze:~# sudo rm /var/lib/apt/lists/lock
rm: cannot remove `/var/lib/apt/lists/lock': Read-only file system

sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup

root@squeeze:~# sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
cp: cannot create directory `/var/lib/dpkg.backup': Read-only file system

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

root@squeeze:~# sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
cp: cannot create regular file `/var/lib/dpkg/status': Read-only file system

sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available

root@squeeze:~# sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot create regular file `/var/lib/dpkg/available': Read-only file system

sudo rm -rf /var/lib/dpkg/updates/*

(Haven't run the rest of the commands as I suspect they'll fail with the same read-only problem)

Jim Willsher (jim-jimwillsher) said : #4

Ok, I think I have an answer. I've done a clean install (again), only this time Hyper-V I've just enabled these modules:

hv_vmbus
hv_netvsc

instead of

hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc

aptitude now seems happy. So it looks like a conflict with hv_storvsc or hv_blkvsc which is causing the filesystem to go readonly.

Hi Jim,

Thanks for explaining how you solved it.

If the issue is still solved, please set the thread status to "solved"

Thanks,

Mark

Jim Willsher (jim-jimwillsher) said : #6

This problem is now solved via a workaround. I only need HV support for the NIC so I can safely remove the bulk storage modules. Looks like the installation of a new kernel causes the HV modules to panic?

Sincere appreciation to the people who replied to my posting. Thank you.

josephat mathayo (jmathayo) said : #7

Hi
I have got the same error when i do sudo apt-get update or sudo apt-get install xxxx

I went through the step but on here Ok, I think I have an answer. I've done a clean install (again), only this time Hyper-V I've just enabled these modules:

hv_vmbus
hv_netvsc

instead of

hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc

aptitude now seems happy. So it looks like a conflict with hv_storvsc or hv_blkvsc which is causing the filesystem to go readonly. i did not understand,

This is the error:

W: Not using locking for read only lock file /var/lib/dpkg/lock

Rihards Palaima (rihardius) said : #8

Tried to follow Mark Rijckenberg's steps, think that didn't help. Here's what I got from terminal:
rihardius@ubuntu:~$ sudo apt-get install -f
[sudo] password for rihardius:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
rihardius@ubuntu:~$ sudo apt-get install -f
\E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
rihardius@ubuntu:~$ sudo dpkg --configure -a
dpkg: error: failed to open '/var/lib/dpkg/status' for writing status database: Invalid argument
rihardius@ubuntu:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"
rihardius@ubuntu:~$ uname -a
Linux ubuntu 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
rihardius@ubuntu:~$ sudo rm /var/lib/apt/lists/lock
rihardius@ubuntu:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
cp: cannot create directory `/var/lib/dpkg.backup': Invalid argument
rihardius@ubuntu:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
rihardius@ubuntu:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
rihardius@ubuntu:~$ sudo rm -rf /var/lib/dpkg/updates/*
rihardius@ubuntu:~$ sudo rm -rf /var/lib/apt/lists
rihardius@ubuntu:~$ sudo mkdir /var/lib/apt/lists
rihardius@ubuntu:~$ sudo mkdir /var/lib/apt/lists/partial
rihardius@ubuntu:~$ LANG=C;sudo aptitude clean
sudo: aptitude: command not found
rihardius@ubuntu:~$ LANG=C;sudo aptitude clean
sudo: aptitude: command not found
rihardius@ubuntu:~$ LANG=C;sudo aptitude autoclean
sudo: aptitude: command not found
rihardius@ubuntu:~$ LANG=C;sudo apt-get update
Ign http://archive.canonical.com natty InRelease
Ign http://dl.google.com stable InRelease
Ign http://us.archive.ubuntu.com natty InRelease
Ign http://us.archive.ubuntu.com natty-updates InRelease
Get:1 http://archive.canonical.com natty Release.gpg [198 B]
Get:2 http://dl.google.com stable Release.gpg [198 B]
Get:3 http://us.archive.ubuntu.com natty Release.gpg [198 B]
Get:4 http://archive.canonical.com natty Release [5916 B]
Get:5 http://dl.google.com stable Release [1347 B]
Get:6 http://us.archive.ubuntu.com natty-updates Release.gpg [198 B]
Get:7 http://us.archive.ubuntu.com natty Release [39.8 kB]
Get:8 http://archive.canonical.com natty/partner amd64 Packages [6736 B]
Ign http://archive.canonical.com natty/partner TranslationIndex
Get:9 http://us.archive.ubuntu.com natty-updates Release [27.2 kB]
Get:10 http://us.archive.ubuntu.com natty/main Sources [862 kB]
Ign http://archive.canonical.com natty/partner Translation-en
Get:11 http://dl.google.com stable/main amd64 Packages [759 B]
Ign http://dl.google.com stable/main TranslationIndex
Ign http://security.ubuntu.com natty-security InRelease
Ign http://ppa.launchpad.net natty InRelease
Ign http://ppa.launchpad.net natty InRelease
Get:12 http://security.ubuntu.com natty-security Release.gpg [198 B]
Ign http://dl.google.com stable/main Translation-en
Get:13 http://ppa.launchpad.net natty Release.gpg [316 B]
Get:14 http://security.ubuntu.com natty-security Release [27.2 kB]
Get:15 http://ppa.launchpad.net natty Release.gpg [316 B]
Ign http://ppa.launchpad.net natty Release
Ign http://ppa.launchpad.net natty Release
Ign http://ppa.launchpad.net natty/main TranslationIndex
Ign http://security.ubuntu.com natty-security/main TranslationIndex
Ign http://security.ubuntu.com natty-security/multiverse TranslationIndex
Ign http://security.ubuntu.com natty-security/restricted TranslationIndex
Ign http://security.ubuntu.com natty-security/universe TranslationIndex
Ign http://us.archive.ubuntu.com natty/main TranslationIndex
Ign http://us.archive.ubuntu.com natty/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com natty/restricted TranslationIndex
Ign http://us.archive.ubuntu.com natty/universe TranslationIndex
Ign http://ppa.launchpad.net natty/main TranslationIndex
Ign http://us.archive.ubuntu.com natty-updates/main TranslationIndex
Ign http://us.archive.ubuntu.com natty-updates/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com natty-updates/restricted TranslationIndex
Ign http://us.archive.ubuntu.com natty-updates/universe TranslationIndex
Err http://ppa.launchpad.net natty/main Sources
  Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_sevenmachines_flash_ubuntu_dists_natty_main_source_Sources - open (22: Invalid argument)
Err http://ppa.launchpad.net natty/main amd64 Packages
  Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_sevenmachines_flash_ubuntu_dists_natty_main_binary-amd64_Packages - open (22: Invalid argument)
Err http://ppa.launchpad.net natty/main Sources
  Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_ubuntu-wine_ppa_ubuntu_dists_natty_main_source_Sources - open (22: Invalid argument)
Err http://ppa.launchpad.net natty/main amd64 Packages
  Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_ubuntu-wine_ppa_ubuntu_dists_natty_main_binary-amd64_Packages - open (22: Invalid argument)
Ign http://ppa.launchpad.net natty/main Translation-en
Ign http://ppa.launchpad.net natty/main Translation-en
Err http://security.ubuntu.com natty-security/main Sources
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/restricted Sources
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/universe Sources
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/multiverse Sources
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/main amd64 Packages
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/restricted amd64 Packages
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/universe amd64 Packages
  404 Not Found [IP: 91.189.92.167 80]
Err http://security.ubuntu.com natty-security/multiverse amd64 Packages
  404 Not Found [IP: 91.189.92.167 80]
Ign http://security.ubuntu.com natty-security/main Translation-en
Ign http://security.ubuntu.com natty-security/multiverse Translation-en
Ign http://security.ubuntu.com natty-security/restricted Translation-en
Ign http://security.ubuntu.com natty-security/universe Translation-en
Err http://us.archive.ubuntu.com natty/restricted Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/main Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/universe Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/multiverse Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/main amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/restricted amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/universe amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty/multiverse amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/main Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/restricted Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/universe Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/multiverse Sources
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/main amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/restricted amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/universe amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Err http://us.archive.ubuntu.com natty-updates/multiverse amd64 Packages
  404 Not Found [IP: 91.189.92.170 80]
Ign http://us.archive.ubuntu.com natty/main Translation-en
Ign http://us.archive.ubuntu.com natty/multiverse Translation-en
Ign http://us.archive.ubuntu.com natty/restricted Translation-en
Ign http://us.archive.ubuntu.com natty/universe Translation-en
Ign http://us.archive.ubuntu.com natty-updates/main Translation-en
Ign http://us.archive.ubuntu.com natty-updates/multiverse Translation-en
Ign http://us.archive.ubuntu.com natty-updates/restricted Translation-en
Ign http://us.archive.ubuntu.com natty-updates/universe Translation-en
Fetched 973 kB in 29s (33.4 kB/s)
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/main/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/restricted/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/universe/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/multiverse/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/restricted/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty/multiverse/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/main/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/source/Sources 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/binary-amd64/Packages 404 Not Found [IP: 91.189.92.170 80]

W: Failed to fetch http://ppa.launchpad.net/sevenmachines/flash/ubuntu/dists/natty/main/source/Sources Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_sevenmachines_flash_ubuntu_dists_natty_main_source_Sources - open (22: Invalid argument)

W: Failed to fetch http://ppa.launchpad.net/sevenmachines/flash/ubuntu/dists/natty/main/binary-amd64/Packages Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_sevenmachines_flash_ubuntu_dists_natty_main_binary-amd64_Packages - open (22: Invalid argument)

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/source/Sources 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/source/Sources 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/source/Sources 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/source/Sources 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/binary-amd64/Packages 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/binary-amd64/Packages 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/binary-amd64/Packages 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/binary-amd64/Packages 404 Not Found [IP: 91.189.92.167 80]

W: Failed to fetch http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/dists/natty/main/source/Sources Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_ubuntu-wine_ppa_ubuntu_dists_natty_main_source_Sources - open (22: Invalid argument)

W: Failed to fetch http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/dists/natty/main/binary-amd64/Packages Could not open file /var/lib/apt/lists/partial/ppa.launchpad.net_ubuntu-wine_ppa_ubuntu_dists_natty_main_binary-amd64_Packages - open (22: Invalid argument)

E: Some index files failed to download. They have been ignored, or old ones used instead.
rihardius@ubuntu:~$ sudo dpkg --clear-avail
dpkg: error: failed to open '/var/lib/dpkg/available' for writing available database: Invalid argument
rihardius@ubuntu:~$ sudo dpkg --configure -a
dpkg: unrecoverable fatal error, aborting:
 unable to create `/var/lib/dpkg/updates/tmp.i': Invalid argument
rihardius@ubuntu:~$ LANG=C;sudo aptitude install -f
sudo: aptitude: command not found
rihardius@ubuntu:~$ LANG=C;sudo aptitude update
sudo: aptitude: command not found
rihardius@ubuntu:~$ LANG=C;sudo aptitude dist-upgrade
sudo: aptitude: command not found

@Rihards Palaima

You MUST not add your own question here, on a solved question

Please add your own question here:
https://answers.launchpad.net/ubuntu/+source/dpkg/+addquestion

Try changing server in software centre. may help

Rihards Palaima (rihardius) said : #11

Changed software server to main server, restarted system and now everything is fine. Thank you for help!

No worries :)