Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
877 views
in Technique[技术] by (71.8m points)

centos - File contains no sections headers

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
'

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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
'

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...