[Software][Solved] Can't update using sudo apt update (debian 12)

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Rens
Posts: 4
Joined: 2024-10-12 14:02
Has thanked: 1 time

[Software][Solved] Can't update using sudo apt update (debian 12)

#1 Post by Rens »

Hello, I am kind of new to linux and I am using debian 12 as my server OS. When I try to sudo apt update I get this message:

Code: Select all

rens@ServerRens:~$ sudo apt update
[sudo] password for rens:
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease
Ign:4 http://deb.debian.org/debian -backports InRelease
Err:5 http://deb.debian.org/debian -backports Release
  404  Not Found [IP: 151.101.38.132 80]
Hit:6 https://download.docker.com/linux/debian bookworm InRelease
Reading package lists... Done
E: The repository 'http://deb.debian.org/debian -backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Last edited by Rens on 2024-10-15 13:53, edited 1 time in total.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 times

Re: [Software] Can't update using sudo apt update (debian 12)

#2 Post by fabien »

Hello, welcome!

Correct your sources.list according to Debian Backports ›› Instructions

Your problem occurs because you copied a line that uses a variable. When this variable is not assigned, it does not work.

Code: Select all

$> echo "deb https://deb.debian.org/debian ${codename}-backports main contrib non-free non-free-firmware"
deb https://deb.debian.org/debian -backports main contrib non-free non-free-firmware
$> codename="bookworm"
$> echo "deb https://deb.debian.org/debian ${codename}-backports main contrib non-free non-free-firmware"
deb https://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
note: please use code tags for terminal outputs, I fixed it for you this time.
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Rens
Posts: 4
Joined: 2024-10-12 14:02
Has thanked: 1 time

Re: [Software] Can't update using sudo apt update (debian 12)

#3 Post by Rens »

It still does not work, can be that I put your lines of code in wrong. The sources.list shows this:

Code: Select all

#deb cdrom:[Debian GNU/Linux 12.7.0 _Bookworm_ - Official amd64 NETINST with firmware 20240831-10:38]/ bookw>

deb http://deb.debian.org/debian/ bookworm main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.


User avatar
fabien
Forum Helper
Forum Helper
Posts: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 times

Re: [Software] Can't update using sudo apt update (debian 12)

#4 Post by fabien »

There is no backports line in your (presumably) /etc/apt/sources.list
Check files in the /etc/apt/sources.list.d/ directory.
Rens wrote: 2024-10-12 16:17 It still does not work, can be that I put your lines of code in wrong.
My lines are just an example to demonstrate how variables work, they do nothing else.
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Rens
Posts: 4
Joined: 2024-10-12 14:02
Has thanked: 1 time

Re: [Software] Can't update using sudo apt update (debian 12)

#5 Post by Rens »

There is nothing in the /etc/apt/sources.list.d/ file or the file just doesn't exist

User avatar
fabien
Forum Helper
Forum Helper
Posts: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 times

Re: [Software] Can't update using sudo apt update (debian 12)

#6 Post by fabien »

Rens wrote: 2024-10-12 17:18 There is nothing in the /etc/apt/sources.list.d/ file or the file just doesn't exist
/etc/apt/sources.list.d/ is a directory.

What gives

Code: Select all

$> grep --color=auto -r "backports" /etc/apt/
?
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Rens
Posts: 4
Joined: 2024-10-12 14:02
Has thanked: 1 time

Re: [Software] Can't update using sudo apt update (debian 12)

#7 Post by Rens »

After reading your suggestions again I saw what my error was.

In the directory: /etc/apt/sources.list.d
There was a file named: backports.list

And here I saw this line was not set correctly.

Code: Select all

deb http://deb.debian.org/debian -backports main
Here I set the bookworm name back and after that the apt command worked as expected!

Code: Select all

deb http://deb.debian.org/debian bookworm-backports main
Thank you so much for your help!


I am wondering why this value was not set in the first place? Because I had not done anything with this before hand?

User avatar
fabien
Forum Helper
Forum Helper
Posts: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 times

Re: [Software] Can't update using sudo apt update (debian 12)

#8 Post by fabien »

You're welcome, I'm glad I helped solve this issue. Please mark your topic as [Solved] by editing the title of your first post, i.e.
[Software][Solved] Can't update using sudo apt update (debian 12)
Rens wrote: 2024-10-15 09:14 I am wondering why this value was not set in the first place?
As I said in my first post, I assume you applied a command line you found somewhere that uses a variable that was not assigned in your environment.

Code: Select all

$> echo "${codename}-backports" >/tmp/test.file
$> cat /tmp/test.file 
-backports
$> codename="bookworm"
$> echo "${codename}-backports" >/tmp/test.file
$> cat /tmp/test.file 
bookworm-backports
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Post Reply