[Solved] APT broken in stretch?

Help with issues regarding installation of Debian

[Solved] APT broken in stretch?

Postby towheedm » 2017-08-13 03:34

Just upgraded from Jessie to Stretch.

Apt or dpkg is now broken. Trying to run any apt commands such as apt-get always result in he following error:

Code: Select all
apt-get update
.
.
0% [Connecting to dpvctowv9b08b.cloudfront.net] [4 Release 0 B]terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 1) > this->size() (which is 0)
Aborted

Any apt command, even apt-cache results in the same error
Code: Select all
apt-cache search linux-image
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 1) > this->size() (which is 0)
Aborted

Is apt or dpkg broken, or a problem during the upgrade?

Any help fixing this is greatly appreciated.
Thanks.
Last edited by towheedm on 2017-08-15 04:54, edited 1 time in total.
towheedm
 
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

Postby RU55EL » 2017-08-13 12:21

Please post the output of

Code: Select all
# cat /etc/apt/sources.list


By the way, the link in your signature has been dead since July 31, 2014. You may want to update it.
User avatar
RU55EL
 
Posts: 285
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

Postby acewiza » 2017-08-13 13:52

Looks like somebody broke apt in stretch.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.
User avatar
acewiza
 
Posts: 245
Joined: 2013-05-28 12:38
Location: Out West

Re: APT broken in stretch?

Postby NFT5 » 2017-08-13 13:59

I'll be interested to know how OP managed to get an adware address in there. :shock:
User avatar
NFT5
 
Posts: 209
Joined: 2014-10-10 11:38
Location: Canberra, Australia

Re:

Postby debiman » 2017-08-13 16:57

towheedm wrote:APT broken in stretch?
lol, thats a strong claim, even with a question mark behind it:
an absolutely essential system tool in debian stable is broken.
sure.

much more likely to be the culprit:
Code: Select all
Connecting to dpvctowv9b08b.cloudfront.net

ouch.
User avatar
debiman
 
Posts: 1331
Joined: 2013-03-12 07:18

Re: APT broken in stretch?

Postby towheedm » 2017-08-13 17:20

First off, I'm not saying it's broken, hence the question mark.

I followed the procedure for updating Jessie to Stretch from https://www.debian.org/releases/stretch ... ng.en.html

This is my sources.list
Code: Select all
# ------------------  Original Jessie repo list  ---------------------------
# #

# # deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

# # deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

# deb http://ftp.us.debian.org/debian/ jessie main non-free contrib
# deb-src http://ftp.us.debian.org/debian/ jessie main non-free contrib

# deb http://security.debian.org/ jessie/updates main contrib non-free
# deb-src http://security.debian.org/ jessie/updates main contrib non-free

# # jessie-updates, previously known as 'volatile'
# deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free

# # jessie-backports, previously on backports.debian.org
# deb http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free

# --------------  New Jessie repo list  --------------------------------------
#

# deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

# deb cdrom:[Debian GNU/Linux 8.1.0 _Jessie_ - Official amd64 DVD Binary-1 20150606-14:19]/ jessie contrib main

# deb  http://deb.debian.org/debian jessie main contrib non-free
# deb-src  http://deb.debian.org/debian jessie main contrib non-free

# deb  http://deb.debian.org/debian jessie-updates main contrib non-free
# deb-src  http://deb.debian.org/debian jessie-updates main contrib non-free

# deb http://security.debian.org/ jessie/updates main contrib non-free
# deb-src http://security.debian.org/ jessie/updates main contrib non-free


# -------------  Stretch Repo list  -----------------------------------------

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free


Not sure about the adware address. From deb.debian.org:
This is deb.debian.org. This service provides mirrors for the following Debian archive repositories:

/debian/
/debian-debug/
/debian-ports/
/debian-security/

The server deb.debian.org does not have packages itself, but the name has SRV records in DNS that let apt in stretch and later find places.

To use it with a sufficiently recent apt, you for instance can put

deb http://deb.debian.org/debian unstable main
deb http://deb.debian.org/debian-debug unstable-debug main
deb http://deb.debian.org/debian-ports unstable main

in your sources.list.

As of October 2016 the SRV record is

_http._tcp.deb.debian.org. IN SRV 10 1 80 prod.debian.map.fastly.net.
_http._tcp.deb.debian.org. IN SRV 10 1 80 dpvctowv9b08b.cloudfront.net.



I'll update the sigs soon enough.
towheedm
 
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

Postby Wheelerof4te » 2017-08-13 17:34

Wow, that sources.list looks way too complicated. You don't need jessie repos anymore, so just leave

Code: Select all
deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free


on it. Even if jessie repos are disabled, it is much easier to keep it clean. The fact that you left them makes us doubt you did do it right. The upgrade, that is. If you don't use source packages, you can delete them too (the ones that start with deb-src).
User avatar
Wheelerof4te
 
Posts: 392
Joined: 2015-08-30 20:14

Re: APT broken in stretch?

Postby towheedm » 2017-08-13 17:42

It's there until I get everything going, hence the commented out Jessie lines.

It'll get cleaned up once I've sorted out this issue.

And I did follow each and every step from the procedure, including returning my system to a pure Jessie install, which meant removing all backports and proprietary NVidia drivers and updating before doing the Jessie-Stretch upgrade.
towheedm
 
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

Postby RU55EL » 2017-08-13 22:08

If you are not building software from source code, you can comment out the source code lines in your sources.list. Also, add trailing forward slashes to the URLs:

Such as:
deb http://deb.debian.org/debian/ stretch main contrib non-free

Rather than:
deb http://deb.debian.org/debian stretch main contrib non-free

Code: Select all
# -------------  Stretch Repo list  -----------------------------------------

deb http://deb.debian.org/debian/ stretch main contrib non-free
# deb-src http://deb.debian.org/debian/ stretch main contrib non-free

deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
# deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free

deb http://security.debian.org/ stretch/updates main contrib non-free
# deb-src http://security.debian.org/ stretch/updates main contrib non-free


Assuming that you have corrected the URLs by adding a trailing "/", are you still having problems?
User avatar
RU55EL
 
Posts: 285
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

Postby ruffwoof » 2017-08-13 22:14

RU55EL wrote:Also, add trailing forward slashes to the URLs:

Such as:
deb http://deb.debian.org/debian/ stretch main contrib non-free

Rather than:
deb http://deb.debian.org/debian stretch main contrib non-free

!!! I took my trailing slash out ... in reflection of https://wiki.debian.org/SourcesList#Example_sources.list
ruffwoof
 
Posts: 195
Joined: 2016-08-20 21:00

Re: APT broken in stretch?

Postby RU55EL » 2017-08-13 23:29

Sometimes it seems to make a difference, sometime it doesn't, having the trailing slash in the sources.list URLs.

If you look at the list of Debian mirrors, notice that all the URLs have trailing slashes: https://www.debian.org/mirror/list

Also, if you haven't, you may be interested in reading: Wiki error re sources.list?
User avatar
RU55EL
 
Posts: 285
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

Postby towheedm » 2017-08-14 01:19

Adding or not adding the trailing slash would still throw the error since
Code: Select all
apt-get update
also throws the error.

Re-quoting parts of my previous quote:
The server deb.debian.org does not have packages itself, but the name has SRV records in DNS that let apt in stretch and later find places.

To use it with a sufficiently recent apt, you for instance can put

deb http://deb.debian.org/debian unstable main
deb http://deb.debian.org/debian-debug unstable-debug main
deb http://deb.debian.org/debian-ports unstable main


in your sources.list.

Notice no trailing slashes.
towheedm
 
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

Postby towheedm » 2017-08-14 02:36

I've been replaying the upgrade script and came across this:
Code: Select all
N: Ignoring file '50unattended-upgrades.ucf-old' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension


This occurred at the end of the upgrade. The problem started right after this. I've checked my backup of /etc/apt/apt.conf.d and there is no such file in the backup.

Sorry I just remembered this. I totally forgot about it. I remember deleting the file but the error persisted, even after re-installing the apt package.

Still testing, but deleting the directory and re-installing from the backup seems to have fixed the problem (or so it seems at the moment). apt-get, apt-cache now works without throwing the error.

At this point, I think the problem may have been data corruption on /. This was a known issue with certain configuration, namely SSD, RAID0 and the 3.18 kernel (and others). See http://www.linuxquestions.org/questions/slackware-14/critical-ssd-raid0-bug-under-kernel-4-0-0-4-0-1-4-0-2-and-3-18-14-a-4175543131/ for a discussion. I corrected the issue by dis-continuing the use of the 3.18 kernel from Jessie and installing a custom 4.3 (then a 4.5) kernel.

To make a pure Jessie system prior to the upgrade (as per the upgrade instructions), I switched to the 3.18 kernel and purged all of my custom kernels. I did not check whether the patch was applied to the 3.18 kernel in Jessie. I assume it would have been after this length of time.

Now to install the 4.9 kernel from Stretch and fsck the filesystems before going further,

I've updated my sig to point to the new link.
towheedm
 
Posts: 43
Joined: 2011-11-07 01:04

Re: [Solved] APT broken in stretch?

Postby debiman » 2017-08-16 14:42

so the cloudfront server (and the error associated with this) disappeared from 'apt-get update's output after you delete a file in /etc/apt/sources.list.d?
i honestly don't think this is data coruption, but something very fishy going on on your system.
for your own sake, check it out.
some softwares provide debian packages, and install their own sources.lists along the way. not good practice imo.
User avatar
debiman
 
Posts: 1331
Joined: 2013-03-12 07:18


Return to Installation

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable