Just saw this on some field units that are iOT type devices and
sometimes get shutdown non-cleanly.  We run apt-update on startup and we
noticed one machine would not update and had no knowledge of any
packages in one of the repos in the sources.list.

We noticed the Packages file has 0 size, and no amount of apt update or
apt-cache clean could fix it besides deleting/removing the corrupt file.

Deleting it resolved the issue:

```
$ ls -lat /var/lib/apt/lists/
total 71252
drwx------ 2 _apt root     4096 Apr 23 16:18 partial
drwxr-xr-x 5 root root     4096 Apr 23 15:40 ..
drwxr-xr-x 4 root root     4096 Apr 22 21:13 .
-rw-r--r-- 1 root root     4342 Apr 22 20:12 
[redacted-package-server]-experimental_dists_focal_InRelease
-rw-r--r-- 1 root root        0 Apr 22 20:12 
[redacted-package-server]-experimental_dists_focal_main_binary-amd64_Packages
-rw-r--r-- 1 root root     4362 Jan 27  2023 
[redacted-package-server]-ubuntu-experimental_dists_focal_InRelease
```

Note the 0 file size on the `[redacted-package-
server]-experimental_dists_focal_main_binary-amd64_Packages` file.

During this time, it would not Get any new information from the package
server.  Even with updates pushed to the package server.

After removing the file, it does a `Get` and now can see all the
packages again:

$ sudo mv 
/var/lib/apt/lists/[redacted-package-server]-experimental_dists_focal_main_binary-amd64_Packages
$ sudo apt update
Hit:1 [redacted-server]-experimental focal InRelease
Hit:2 [redacted-server]-ubuntu-experimental focal InRelease
Get:3 [redacted-server]-experimental focal/main amd64 Packages [3524 kB]
Fetched 3524 kB in 6s (571 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.
```

Server software is aptly.  apt version is `apt 2.0.6 (amd64)`

Happy to track this down and submit a patch for checking the file size
of 0, or the algorithm as suggested above.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1809174

Title:
  apt doesn't detect file corruption in /var/lib/apt/lists

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1809174/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to