Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] APT broken in stretch?

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
towheedm
Posts: 43
Joined: 2011-11-07 01:04

[Solved] APT broken in stretch?

#1 Post by towheedm »

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.
The Definitive Guide to Theming GRUB is at https://drive.google.com/file/d/0B4ryPD ... sp=sharing.

User avatar
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

#2 Post by RU55EL »

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
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: APT broken in stretch?

#3 Post by acewiza »

Looks like somebody broke apt in stretch.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

User avatar
NFT5
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 597
Joined: 2014-10-10 11:38
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 43 times

Re: APT broken in stretch?

#4 Post by NFT5 »

I'll be interested to know how OP managed to get an adware address in there. :shock:

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re:

#5 Post by debiman »

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.

towheedm
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

#6 Post by towheedm »

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.
The Definitive Guide to Theming GRUB is at https://drive.google.com/file/d/0B4ryPD ... sp=sharing.

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: APT broken in stretch?

#7 Post by Wheelerof4te »

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).

towheedm
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

#8 Post by towheedm »

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.
The Definitive Guide to Theming GRUB is at https://drive.google.com/file/d/0B4ryPD ... sp=sharing.

User avatar
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

#9 Post by RU55EL »

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?

ruffwoof
Posts: 298
Joined: 2016-08-20 21:00

Re: APT broken in stretch?

#10 Post by ruffwoof »

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#Exa ... urces.list

User avatar
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: APT broken in stretch?

#11 Post by RU55EL »

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?

towheedm
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

#12 Post by towheedm »

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.
The Definitive Guide to Theming GRUB is at https://drive.google.com/file/d/0B4ryPD ... sp=sharing.

towheedm
Posts: 43
Joined: 2011-11-07 01:04

Re: APT broken in stretch?

#13 Post by towheedm »

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 ... 175543131/ 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.
The Definitive Guide to Theming GRUB is at https://drive.google.com/file/d/0B4ryPD ... sp=sharing.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: [Solved] APT broken in stretch?

#14 Post by debiman »

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.

Post Reply