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=1n'
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!
asked Oct 16, 2014 at 14:40
FitzFitz
3271 gold badge6 silver badges19 bronze badges
6
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 kzakn'
So fix would be to go into /etc/yum.repos.d/CentOS-Base.repo
and fix syntax of the file.
answered Oct 31, 2014 at 22:53
jhutarjhutar
1,3592 gold badges17 silver badges32 bronze badges
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
answered Jun 7, 2018 at 7:46
FeriFeri
2304 silver badges11 bronze badges
SUMMARY
As per documentation for Ansible Configuration Settings, we can place ansible.cfg
in current directory of the project we are working on and Ansible will search for a config file in the order specified in link above.
However, it appears that ansible is unable to read ansible.cfg
file
ISSUE TYPE
- Bug Report
COMPONENT NAME
I am not sure but I think it has to be with the Ini Config Parser
ANSIBLE VERSION
ansible 2.6.3
config file = /Users/pnotes/Code/Terraform/Blog/ansible/ansible.cfg
configured module search path = ['/Users/pnotes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/pnotes/.pyenv/versions/3.6.4/lib/python3.6/site-packages/ansible
executable location = /Users/pnotes/.pyenv/versions/3.6.4/bin/ansible
python version = 3.6.4 (default, Feb 26 2018, 21:07:35) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
CONFIGURATION
Error reading config file (/Users/pnotes/Code/Terraform/Blog/terraform/ansible.cfg): File contains no section headers.
file: '/Users/pnotes/Code/Terraform/Blog/terraform/ansible.cfg', line: 3
'vault_password_file = ~/.vault_pass.txtn'
OS / ENVIRONMENT
macOS High Sierra
STEPS TO REPRODUCE
directory layout:
- project_dir
- terraform
- ansible.cfg
- base.tf
- terraform.tfvars
- variables.tfvars
- ansible
- roles
- user
- tasks
- main.yml
- vars
- creds.yml
- provison.yml
Note: Within role dir, have a task that makes sure of an encrypted file (roles/user/vars/creds.yml)
- contents of
terraform/ansible.cfg
:
# If set, configures the path to the Vault password file as an alternative to
# specifying --vault-password-file on the command line.
vault_password_file = ~/.vault_pass.txt
Running terraform (terraform init && terraform apply
ends up calling ansible via local-exec
` provisioner "local-exec" {
command = "sleep 30; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root --ask-pass -i '${linode_linode.base.ip_address},' ../ansible/provision.yml --extra-vars 'ip=${linode_linode.base.ip_address}' -vvvv"
}
`
Note: when project_directory/terraform/ansible.cfg
is commented out, ansible uses ~/.ansible.cfg
and is able to decrypt encrypted files.
EXPECTED RESULTS
I expect playbook to decrypt all encrypted vars using the ansible vault password saved in the path provide in the configuration file (ansible.cfg) provided in the project directory.
ACTUAL RESULTS
I get the error below:
terraform init && terraform apply
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "null" (1.0.0)...
- Downloading plugin for provider "template" (1.0.0)...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
<= read (data resources)
Terraform will perform the following actions:
<= data.template_file.hosts
id: <computed>
rendered: <computed>
template: "[public]n${api_public}n"
vars.%: <computed>
+ linode_linode.base
id: <computed>
disk_expansion: "false"
group: "Test-group"
helper_distro: "true"
image: "Ubuntu 16.04 LTS"
ip_address: <computed>
kernel: "Latest 64 bit"
manage_private_ip_automatically: "true"
name: "Test"
plan_storage: <computed>
plan_storage_utilized: <computed>
private_ip_address: <computed>
region: "Newark, NJ, USA"
root_password: "QLWOVauEwNxWGbj2ErWF9vFYIXsxW/2duL/og8gtV84="
size: "1024"
ssh_key: "Gb4DfTd6icrN49GevRjx+9IwmSgVVCLU8WjL0PY2p0s="
status: <computed>
swap_size: "512"
+ null_resource.hosts
id: <computed>
triggers.%: <computed>
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
linode_linode.base: Creating...
disk_expansion: "" => "false"
group: "" => "Test-group"
helper_distro: "" => "true"
image: "" => "Ubuntu 16.04 LTS"
ip_address: "" => "<computed>"
kernel: "" => "Latest 64 bit"
manage_private_ip_automatically: "" => "true"
name: "" => "Test"
plan_storage: "" => "<computed>"
plan_storage_utilized: "" => "<computed>"
private_ip_address: "" => "<computed>"
region: "" => "Newark, NJ, USA"
root_password: "" => "QLWOVauEwNxWGbj2ErWF9vFYIXsxW/2duL/og8gtV84="
size: "" => "1024"
ssh_key: "" => "Gb4DfTd6icrN49GevRjx+9IwmSgVVCLU8WjL0PY2p0s="
status: "" => "<computed>"
swap_size: "" => "512"
linode_linode.base: Still creating... (10s elapsed)
linode_linode.base: Still creating... (20s elapsed)
linode_linode.base: Still creating... (30s elapsed)
linode_linode.base: Still creating... (40s elapsed)
linode_linode.base: Still creating... (50s elapsed)
linode_linode.base: Provisioning with 'remote-exec'...
linode_linode.base (remote-exec): Connecting to remote host via SSH...
linode_linode.base (remote-exec): Host: 172.104.29.185
linode_linode.base (remote-exec): User: root
linode_linode.base (remote-exec): Password: true
linode_linode.base (remote-exec): Private key: false
linode_linode.base (remote-exec): SSH Agent: true
linode_linode.base (remote-exec): Checking Host Key: false
linode_linode.base: Still creating... (1m0s elapsed)
linode_linode.base (remote-exec): Connecting to remote host via SSH...
linode_linode.base (remote-exec): Host: 172.104.29.185
linode_linode.base (remote-exec): User: root
linode_linode.base (remote-exec): Password: true
linode_linode.base (remote-exec): Private key: false
linode_linode.base (remote-exec): SSH Agent: true
linode_linode.base (remote-exec): Checking Host Key: false
linode_linode.base (remote-exec): Connected!
linode_linode.base (remote-exec): foo
linode_linode.base: Provisioning with 'local-exec'...
linode_linode.base (local-exec): Executing: ["/bin/sh" "-c" "sleep 30; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root --ask-pass -i '172.104.29.185,' ../ansible/provision.yml --extra-vars 'ip=172.104.29.185' -vvvv"]
linode_linode.base: Still creating... (1m10s elapsed)
linode_linode.base: Still creating... (1m20s elapsed)
linode_linode.base: Still creating... (1m30s elapsed)
linode_linode.base (local-exec): Error reading config file (/Users/pnotes/Code/Terraform/Test/terraform/ansible.cfg): File contains no section headers.
linode_linode.base (local-exec): file: '/Users/pnotes/Code/Terraform/Test/terraform/ansible.cfg', line: 3
linode_linode.base (local-exec): 'vault_password_file = ~/.vault_pass.txtn'
Error: Error applying plan:
1 error(s) occurred:
* linode_linode.base: Error running command 'sleep 30; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root --ask-pass -i '172.104.29.185,' ../ansible/provision.yml --extra-vars 'ip=172.104.29.185' -vvvv': exit status 5. Output: Error reading config file (/Users/pnotes/Code/Terraform/Test/terraform/ansible.cfg): File contains no section headers.
file: '/Users/pnotes/Code/Terraform/Test/terraform/ansible.cfg', line: 3
'vault_password_file = ~/.vault_pass.txtn'
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
-
Donn
- Posts: 3
- Joined: 2015/01/01 13:00:50
[SOLVED] How to solve «File contains no section headers»
I ran into the error bellow when trying to install google page speed on Centos 6.5. nginx with Plesk running. Right now yum can’t update due to the error. I tried reverting the change by deleting the file with command «rm /etc/yum.repos.d/google-mode-pagespeed.repo» but It says no file in directory. Any ideas on how to solve this?
Error: File contains no section headers.
file: file:///etc/yum.repos.d/google-mod-pagespeed.repo, line: 2
‘ogle-mod-pagespeed]n’
Thanks In Advance
-
avij
- Retired Moderator
- Posts: 3046
- Joined: 2010/12/01 19:25:52
- Location: Helsinki, Finland
- Contact:
Re: How to solve «File contains no section headers»
Post
by avij » 2015/01/01 13:24:41
Plesk installations are not supported here, but please notice the difference between
….rm /etc/yum.repos.d/google-mode-pagespeed.repo and
file:///etc/yum.repos.d/google-mod-pagespeed.repo
-
Donn
- Posts: 3
- Joined: 2015/01/01 13:00:50
Re: How to solve «File contains no section headers»
Post
by Donn » 2015/01/01 16:00:26
avij wrote:Plesk installations are not supported here, but please notice the difference between
….rm /etc/yum.repos.d/google-mode-pagespeed.repo and
file:///etc/yum.repos.d/google-mod-pagespeed.repo
I know, but the problem is not on Plesk, it’s on the OS, centos. I did notice the difference and tried it with «file:///» but still got file not found.
But when I try running «vi /etc/yum.repos.d/google-mod-pagespeed.repo» I get the error bellow.
E325: ATTENTION
Found a swap file by the name «/etc/yum.repos.d/.google-mod-pagespeed.repo.swp»
owned by: root dated: Thu Jan 1 12:38:35 2015
file name: /etc/yum.repos.d/google-mod-pagespeed.repo
modified: YES
user name: root host name: mydomain.com
process ID: 3678
While opening file «/etc/yum.repos.d/google-mod-pagespeed.repo»
dated: Thu Jan 1 08:39:36 2015
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use «:recover» or «vim -r /etc/yum.repos.d/google-mod-p
agespeed.repo»
to recover the changes (see «:help recovery»).
If you did this already, delete the swap file «/etc/yum.repos.d/.google-mod-
pagespeed.repo.swp»
to avoid this message.
-
avij
- Retired Moderator
- Posts: 3046
- Joined: 2010/12/01 19:25:52
- Location: Helsinki, Finland
- Contact:
Re: How to solve «File contains no section headers»
Post
by avij » 2015/01/01 16:39:57
I was merely trying to make a distinction between mode and mod … notice the extra e in your rm command.
How about you reboot your server or kill 3678 the editor that may be hanging around, then navigate to the /etc/yum.repos.d directory, use ls -la to see which files there are and then remove the offending files with rm ? This is not rocket science.
-
Donn
- Posts: 3
- Joined: 2015/01/01 13:00:50
Re: How to solve «File contains no section headers»
Post
by Donn » 2015/01/01 17:05:04
avij wrote:I was merely trying to make a distinction between mode and mod … notice the extra e in your rm command.
How about you reboot your server or kill 3678 the editor that may be hanging around, then navigate to the /etc/yum.repos.d directory, use ls -la to see which files there are and then remove the offending files with rm ? This is not rocket science.
Hi, I managed to get it working. I noticed there was a space before the code line. Deleted it and all worked perfectly. Thanks a lot
I’m working on setting up Fail2ban for my linux (debian) server. When I check the status of the fail2ban service I am getting this error:
● fail2ban.service - Fail2Ban Service
Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-11-01 13:15:05 EST; 5s ago
Docs: man:fail2ban(1)
Process: 17851 ExecStartPre=/bin/mkdir -p /var/run/fail2ban (code=exited, status=0/SUCCESS)
Process: 17852 ExecStart=/usr/bin/fail2ban-server -xf start (code=exited, status=255/EXCEPTION)
Main PID: 17852 (code=exited, status=255/EXCEPTION)
Nov 01 13:15:05 raspberrypi systemd[1]: Starting Fail2Ban Service...
Nov 01 13:15:05 raspberrypi systemd[1]: Started Fail2Ban Service.
Nov 01 13:15:05 raspberrypi fail2ban-server[17852]: Failed during configuration: File contains no section headers.
Nov 01 13:15:05 raspberrypi fail2ban-server[17852]: file: '/etc/fail2ban/jail.local', line: 21
Nov 01 13:15:05 raspberrypi fail2ban-server[17852]: 'bantime = 1hn'
Nov 01 13:15:05 raspberrypi fail2ban-server[17852]: Async configuration of server failed
Nov 01 13:15:05 raspberrypi systemd[1]: fail2ban.service: Main process exited, code=exited, status=255/EXCEPTION
Nov 01 13:15:05 raspberrypi systemd[1]: fail2ban.service: Failed with result 'exit-code'.
I have a feeling this has something to do with my config file, here is the first 30 lines of it:
#
# WARNING: heavily refactored in 0.9.0 release. Please review and
# customize settings for your setup.
#
# Changes: in most of the cases you should not modify this
# file, but provide customizations in jail.local file,
# or separate .conf files under jail.d/ directory, e.g.:
#
# HOW TO ACTIVATE JAILS:
#
# YOU SHOULD NOT MODIFY THIS FILE.
#
# It will probably be overwritten or improved in a distribution update.
#
# Provide customizations in a jail.local file or a jail.d/customisation.local.
# For example to change the default bantime for all jails and to enable the
# ssh-iptables jail the following (uncommented) would appear in the .local file.
# See man 5 jail.conf for details.
#
# [DEFAULT]
bantime = 1h
#
# [sshd]
enabled = true
#
# See jail.conf(5) man page for more information
# Comments: use '#' for comment lines and ';' (following a space) for inline comments
[INCLUDES]
#before = paths-distro.conf
before = paths-debian.conf
# The DEFAULT allows a global definition of the options. They can be overridden
# in each jail afterwards.
[DEFAULT]
#
# MISCELLANEOUS OPTIONS
#
asked Nov 1, 2020 at 18:22
For the case still actual or someone would find it later.
Firstly, don’t copy jail.conf into jail.local, use empty one.
Then, this is wrong:
# [sshd]
enabled = true
Before enabled is no section in your file (lines started with #
are comments).
This would be correct jail.local file:
[DEFAULT]
# here you can overwrite some defaults:
[sshd]
enabled = true
[other-jail]
enabled = true
...
answered Dec 19, 2020 at 23:10
sebressebres
3211 silver badge6 bronze badges
When I tried to install CMake but writing the following
sudo yum install cmake
I got the following error
File contains no section headers.
file: file:///etc/yum.repos.d/mcepl-vim8-epel-7.repo, line: 2
'<!doctype html>n
asked Feb 27, 2019 at 10:53
3
I solve by
rm /etc/yum.repos.d/mcepl-vim8-epel-7.repo
answered May 27, 2019 at 14:33
As a safer solution, it’s just enough to rename that repo file:
# cd /etc/yum.repos.d/
# mv <repo_file>.repo <repo_file>.repo.orig
answered May 16, 2022 at 4:10
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.