I'm very new to linux, and I am using CentOS in a VM for program testing. Everything seems to be fine, except for every few minutes I get this error:
Error Type: <class 'yum.Errors.ConfigError'>

Error Value: File contains no section headers.

I looked in a few forums, and one said to use this command
cat /etc/yum.repos.d/fedora-updates.repo, but when I did so it said there was no such file or directory. Any thoughts on how I can go about fixing this?

I'm very much a beginner when it comes to linux, so step by step would be greatly appreciated..

2 Answers
2

Your coworker has apparently been hacking on that file. If you diff -wu it against the stock version, you get this:

--- /etc/yum.repos.d/CentOS-Base.repo 2011-12-08 20:03:29.000000000 -0700
+++ x 2012-09-06 21:24:38.244907083 -0600
@@ -1,14 +1,7 @@
-# CentOS-Base.repo
-#
-# The mirror system uses the connecting IP address of the client and the
-# update status of each mirror to pick mirrors that are updated to and
-# geographically close to the client. You should use this for CentOS updates
-# unless you are manually picking other mirrors.
-#
-# If the mirrorlist= does not work for you, as a fall back you can try the
-# remarked out baseurl= line instead.
-#
-#
+CentOS-Base.repo
+
+
+enabled=1
[base]
name=CentOS-$releasever - Base
@@ -20,7 +13,8 @@
#released updates
[updates]
name=CentOS-$releasever - Updates
-mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
+mirrorlist=http://mirrorlist.centos.org/?
+release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Breaking that down:

Header comments removed.

This is harmless. You do not need to replace them.

Added CentOS-Base.repo line. This has to be a mistake, likely due to trying to apply step-by-step tutorial instructions from some random web site without trying to understand them first.

Remove this line.

Added enabled=1 outside of any section. According to yum.conf(5) this is illegal. Your coworker was probably trying to follow an instruction to change one of the existingenabled settings from 0 to 1.

Remove this line, too.

Broken mirrorlist line. This was probably a result of editing the file in a word processor, rather than in a plain text editor. It got word-wrapped, then saved. (This is the change most likely to have caused the actual harm.)

I got this error that pops up regurarly. I am really new to centos and am using it for schools work. I must have tried to change something in the yum file to follow some directives from our website but must have provoked some error. Also, when i try some yum commands as this one, i get this response :