14

I keep getting this error everytime i use yum :

yum install unison240
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Error: File contains no section headers.
file: file://///etc/yum.repos.d/CentOS-Base.repo, line: 12
'priority=1\n'

I am very new to this world (A small month) and didnt use it very much yet because i just started engineering school.

It seems as if CentOs-Base.repo had an error in it and i actually tried to create priorities.sh in order to follow this tutorial from my school : https://ensiwiki.ensimag.fr/index.php/Portail:Centos which could have done the error.

(First Section named "Depots Centos 6.5")

I dont know if it helps you.

This error happens with every use of yum. Here, I was just trying to get Unison from the package epel that i already got on my computer.

Thank you for your help!

6
  • Please explain what the expected result should be. The error message you provide doesn't make that clear.
    – Jason D
    Oct 16, 2014 at 14:43
  • @Jason D It was just a test to test yum. What i wanted to do was to download Unison so I typed : sudo yum install unison240 And received the same message : Loaded plugins: fastestmirror, priorities, refresh-packagekit, security Error: File contains no section headers. file: file://///etc/yum.repos.d/CentOS-Base.repo, line: 12 'priority=1\n'
    – Fitz
    Oct 16, 2014 at 14:48
  • You may want to add that to your original post. Also include the full package name that you want.
    – Jason D
    Oct 16, 2014 at 14:50
  • The error indicates that you have an extra line break or corruption on line 12 of your repo file. Can you delete that and try again?
    – Jason D
    Oct 16, 2014 at 18:29
  • Ok, I will delete the repo file and post the result. Thanks for your help.
    – Fitz
    Oct 18, 2014 at 10:16

2 Answers 2

14

Looks like your /etc/yum.repos.d/CentOS-Base.repo is broken - have missing [CentOS-Base] stanza. I was able to recreate the situation using:

# cat /etc/yum.repos.d/kzak-mytt-kz.repo 
[kzak-mutt-kz]
name=Copr repo for mutt-kz owned by kzak
baseurl=http://copr-be.cloud.fedoraproject.org/results/kzak/mutt-kz/fedora-$releasever-$basearch/
skip_if_unavailable=True
gpgcheck=0
enabled=1
# yum repolist
<works as expected>
# gedit /etc/yum.repos.d/kzak-mytt-kz.repo   # now I have removed first line
# cat /etc/yum.repos.d/kzak-mytt-kz.repo 
name=Copr repo for mutt-kz owned by kzak
baseurl=http://copr-be.cloud.fedoraproject.org/results/kzak/mutt-kz/fedora-$releasever-$basearch/
skip_if_unavailable=True
gpgcheck=0
enabled=1
# yum repolist
Loaded plugins: etckeeper
File contains no section headers.
file: file:///etc/yum.repos.d/kzak-mytt-kz.repo, line: 1
'name=Copr repo for mutt-kz owned by kzak\n'

So fix would be to go into /etc/yum.repos.d/CentOS-Base.repo and fix syntax of the file.

1
1

The header section of one of your mirrors in that repo is missing. It is a name inside Brackets []. You can add it yourself.

In terminal, type:

nano /etc/yum.repos.d/CentOS-Base.repo

Then go to the line 12 and add a section header like [Name] ABOVE the line beginning with "name"

Assuming the header section is called "update", it should look like:

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.