85832

File contains no sections headers

Question:

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 : <a href="https://ensiwiki.ensimag.fr/index.php/Portail:Centos" rel="nofollow">https://ensiwiki.ensimag.fr/index.php/Portail:Centos</a> 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!

Answer1:

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.

Answer2:

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

Recommend

  • CakePHP3.4: How to send a json object response?
  • Using `diff` from R via `system(..)`
  • Check for stdout or stderr
  • ant copy copying order
  • Running exec() command with dev>null & doesn't work, but dev>null does
  • python - terminate child process when script invoked from bash
  • Python: Adding to dict of one object in a list changes all dicts of every other object in the list
  • How is user.dir configured for Tomcat servlets?
  • Error building MEX-files (MATLAB 2012a) on Kubuntu '/usr/bin/ld: cannot find -lstdc++'
  • Modifying files nested in tar archive
  • date: illegal option — d, Find difference between two dates
  • missing pie chart and other elements when display serenity report from jenkins
  • mCamera.setpreview{@override onPreviewFrame() } not work
  • setSelected() with JRadioButton r[]=new JRadioButton[3] not working [duplicate]
  • MongoDB GeoJSON “Can't extract geo keys from object, malformed geometry?” when inserting type P
  • Syntax error near unexpected token 'elif'
  • Building jamvm 1.5.4 on OS X Lion
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • How can I get the full list of running processes on a Mac from a python app
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • CERN ROOT exporting data to plain text
  • Uncaught TypeError: $(…).select2 is not a function
  • bad substitution shell- trying to use variable as name of array
  • Reading a file into a multidimensional array
  • Django simple Captcha “No module named fields” error
  • Test if a set exists before trying to drop it
  • Why does access(2) check for real and not effective UID?
  • Django: Count of Group Elements
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • javaw.exe and eclipse startup problems
  • SSO with signing and signature validation doesn't work
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • A cron job substitute?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Proper way to use connect-multiparty with express.js?
  • need help with bizarre java.net.HttpURLConnection behavior
  • Conditional In-Line CSS for IE and Others?