kanotix.com

General Support - Apt-get error

aking469 - 23.05.2006, 12:15 Uhr
Titel: Apt-get error
I keep getting the following message in apt-get:

Unable to parse package file /etc/apt/preferences (1)

What does this mean?

How do I fix it?

In addition, Kpackage doesn't want to retrieve updated files....
Is this part of the same problem?
devil - 23.05.2006, 12:26 Uhr
Titel: Apt-get error
just add a linefeed (empty line) to /etc/apt/preferences, save and good to go.

greetz
devil
Superrakete - 23.05.2006, 12:27 Uhr
Titel: Apt-get error
Hi!

As root:
Code:
echo >> /etc/apt/preferences

aking469 - 24.05.2006, 02:40 Uhr
Titel: Apt-get error
That solved the problem nicely...
ai4kh - 04.06.2006, 04:58 Uhr
Titel: RE: Apt-get error
First submisson:

I just had the same no-parse problem with /etc/apt/preferences that aking469 had. I found this thread and used devil28's guidance, 'add a linefeed...' to solve this little poser.

Now I'm curious why that worked? It wasn't very intuitive from my, ancient newbie, side of the field (my last serious programming was done in Fortran - card punch machines and all!).

kilo hotel
devil - 04.06.2006, 06:28 Uhr
Titel: RE: Apt-get error
well, that empty line should have been there in the first place to meet unix file-format, but someone forgot.
apt upgraded itself to a new version and from then on demanded unix file-format and not dos file-format. who knows why....

btw.: old dogs can learn new operating systems:wink:

greetz
devil
h2 - 04.06.2006, 19:48 Uhr
Titel: RE: Apt-get error
What's annoying is that all the package maintainers had to do was have apt add the linefeed to that file when the new apt package is installed. Why that wasn't done is hard to understand since there may be nothing easier to do.

A linefeed at the end will not alter the existing file in any way, and you can have a hundred extra line feeds without changing how apt works.

this one is definitely the weakest failing I've seen so far in debian sid, that should have been fixed within a day of the package release, but it's still in it.

I don't agree with devil28 as to the cause however, the absence of a linefeed does not have to be a dos/unix issue, it's simply how the file is parsed.

As I've noted before, .htaccess files have the same issue, the parser goes through them line by line, it knows it's reached the end of a line by the presence of the \n character, linefeed.

So what happens when you don't have that linefeed on the last line? The parser sits there, waiting for the last line to be parsed, but it can't be parsed, because it doesn't end.

If you remove the linefeed from the last line of any website using .htaccess files, the entire website will instantly fail, with a 500 error, for I assume the exact same reason.

So I'd guess, though I could of course be wrong, that apt simply changed how it parses it, not sure exactly what the change would be. With htacess, this has nothing to do with dos/unix at all, it's just the presence or absence of a closing \n character on each line. And since it's by definition present on each line before the last line, the only line that could suffer from its absence would be the last line.

I have scripts that parse input slightly differently, they parse each line after a line feed, so if the last one doesn't have it, it still gets parsed, but there are different ways to do it.
ai4kh - 04.06.2006, 22:03 Uhr
Titel: RE: Apt-get error
devil,
Thanks!

re: "btw.: old dogs can learn new operating systems:wink:"

It would seem the latter have the bulge on the former:nudge:

73, kilo hotel
KStorm - 08.06.2006, 10:09 Uhr
Titel: Re: RE: Apt-get error
ai4kh hat folgendes geschrieben::
First submisson:

I just had the same no-parse problem with /etc/apt/preferences that aking469 had. I found this thread and used devil28's guidance, 'add a linefeed...' to solve this little poser.

Now I'm curious why that worked? It wasn't very intuitive from my, ancient newbie, side of the field (my last serious programming was done in Fortran - card punch machines and all!).

kilo hotel
Same here. Actually, this is the 2nd time I tried to correct this problem...after inserting the linefeed at the beginning of /apt/preferences, I inserted it at the end, now everything is working again.
Alle Zeiten sind GMT + 1 Stunde
PNphpBB2 © 2003-2007