Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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..

EDIT:

I used the CentOS-Base.repo command, here is the output

CentOS-Base.repo


enabled=1

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

#released updates 
[updates]
name=CentOS-$releasever - 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

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
share|improve this question
1  
Since you have got CentOS the filename will be CentOS-Base.repo. Please post the output of yum repolist. –  Nils Sep 6 '12 at 21:01
    
Also, have you been playing with the yum configuration? Maybe enabling third-party repos in order to get packages that didn't come with CentOS? Don't make us guess. –  Warren Young Sep 7 '12 at 0:36
    
Sorry, I just took this configuration from a coworker, so I actually have not touched anything. He doesn't have the same error. I'll post the output now –  nathpilland Sep 7 '12 at 1:19

1 Answer 1

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:

  1. Header comments removed.

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

  2. 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.

  3. 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 existing enabled settings from 0 to 1.

    Remove this line, too.

  4. 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.)

    Glue those two halves back together.

    Then tell your coworker that Abiword, OpenOffice.org Writer, KWord and LibreOffice Writer are not text editors. Vim, Emacs, Nano, jEdit, gedit, Kate.... these are text editors.

    With the more advanced sort of text editors, you still have to be careful you aren't turning on RTF editing or word wrapping, though, if you're going to use it for editing Linux configuration files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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