Why APT Preferences doesn't work as expect - preferences

I want to install puppet which version higher than 2.7.11 on Ubuntu, but the origin source version is 2.7.11, so I add the puppetlabs's source:
echo "deb http://apt.puppetlabs.com precise devel" > /etc/apt/sources.list.d/puppetlabs.list
then I use apt-get and then find the latest version is already 3.0.0 .But I just want to use 2.7.19 .So I edit the /etc/apt/preferences:
package:puppet
Pin: release v=2.7.19*, o= "http://apt.puppetlabs.com/"
Pin-Priority: 1001
then I use apt-cache policy puppet ,but it seems this does not works as I expect:
puppet:
Installed: 3.0.0-0.1rc6puppetlabs1
Candidate: 3.0.0-0.1rc6puppetlabs1
Package pin: (not found)
Version table:
*** 3.0.0-0.1rc6puppetlabs1 1001
500 http://apt.puppetlabs.com/ precise/devel amd64 Packages
100 /var/lib/dpkg/status
2.7.19-0.1rc3puppetlabs1 1001
500 http://apt.puppetlabs.com/ precise/devel amd64 Packages
I have read the man 5 apt_preferences, but still can't make it works right.

Read the file here
The "o=" means the Origin in the Release file.
If you want to use http (as the source in sources.list)... you should write:
Pin: origin "http..."
Check at man apt_preferences to get more help about it!

Related

Install Obsolete Devtoolset Collection for CentOS

At present time Devtoolset-5 (and earlier) cannot be istalled from Software Collection Repository (centos-release-scl) using yum (only Devtoolset-6 and 7 are available). Nevertheless, this collection can be downloaded as a list of rpm-packages. Is it possible to enable such EOL collections for yum, or maybe there is another way to install them correctly?
There was no DTS 5 release. It was skipped to align the DTS version with the GCC major release, once GCC switched to a yearly increasing version number.
DTS versions 3 and 4 are available from the centos-release-scl repository.
While Devtoolset-3 and 4 are located on the Centos mirror site, yum will not be able to find them as they were not included in the repodata on the site. These were probably excluded because they are EOL (end-of-life), and have dependency bugs (Bug 1410152). Try using the older Devtoolset-3 packages here, which do not have the dependency issues:
https://copr.fedorainfracloud.org/coprs/rhscl/devtoolset-3/
If you really want the packages from the centos.org site, I went with wget to download all the RPMs, then recreated a local yum repo. However, you'll see the dependency issues and yum install devtoolset-3 will fail.
$ wget -r -p -e robots=off --directory-prefix="/mnt/local-devtoolset3-repo" --recursive --no-clobber --no-parent http://mirror.centos.org/centos/6/sclo/x86_64/rh/devtoolset-3/
$ sudo yum install createrepo
$ cd /mnt/local-devtoolset3-repo
$ createrepo --database .
You can install the obsolete devtoolset-3 in this way:
sudo yum --obsolete install devtoolset-3

centos yum fails installing anything or updating system

I am trying to install a package on CentOS, but it throws error when I run the "yum" command. The internet connection is working fine.
I try to yum clean all but problem persist.
Error:
[root#dcos-master3 ~]# yum install ntp
Loaded plugins: fastestmirror
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/$releasever/x86_64
My yum repolist is the next:
[root#dcos-master3 ~]# yum repolist list
Loaded plugins: fastestmirror
https://yum.dockerproject.org/repo/main/centos/%24releasever/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/solutions/69319
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
repolist: 0
If I list the repolist:
[root#dcos-master3 ~]# yum repolist
Loaded plugins: fastestmirror
https://yum.dockerproject.org/repo/main/centos/%24releasever/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/solutions/69319
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
repo id repo name status
base/$releasever/x86_64 CentOS-$releasever - Base 0
dockerrepo/$releasever Docker Repository 0
extras/$releasever/x86_64 CentOS-$releasever - Extras 0
updates/$releasever/x86_64 CentOS-$releasever - Updates 0
repolist: 0
BEFORE TRYING ANY OF THIS, HAVE A BACKUP OF YOUR MACHINE, YOU COULD DAMAGE YOUR OS MORE/COMPLETELY
It seems that your yum variable $releasever is somehow corrupt,
it usually is caused by missing centos-release package on the machine for some obscure reasons.
You can check if you have the package by:
rpm -qi centos-release
You will probably see:
"package centos-release is not installed"
First find out the exact centos version that you have by executing as root:
cat /etc/redhat-release
You will see something like this:
CentOS Linux release 7.3.1611 (Core)
You can fetch the centos-release package from repo by:
wget http://vault.centos.org/centos/7.3.1611/updates/x86_64/Packages/centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm
Now run reinstall centos-release package via rpm:
sudo rpm -Uvh --replacepkgs centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm
As next you can try to install something with yum and you might get:
[root#dcos-master3 ikerlan]# sudo yum install wget
error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
error: cannot open Packages index using db5 - (-30969)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
Now you can try to reboot the machine or try to use the following command to rebuild the rpm db:
rpm --rebuilddb
I came across the same issue while downloading some packages in centos 7. After days of search, I found the solution:
Go to the yum repo directory.
cd /etc/yum.repos.d.
Make a copy of the CentOS-Base.repo file.
cp CentOS-Base.repo CentOS-Base.repo.old
Edit the CentOS-Base.repo file. Comment mirrorlist and uncomment baseurl.
vi CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Now when you use yum, do the following.
sudo yum --disablerepo=* --enablerepo=base install httpd
Likewise for yum update.
sudo yum --disablerepo=* --enablerepo=base install httpd
It should work now.
I ran into this problem when attempting to install MariaDB on CentOS 7. I was super frustrated and after much searching found the answer at this link.
Here is what fixed this problem for me. Run as root.
# yum --disablerepo "*" --enablerepo epel install [package]
# yum clean all
"epel" can be whatever repo you like, but this one worked for me. Place [package] in the command just as written, not what package you are trying to install.
After you run the above, exit root and run whatever install you were attempting before encountering the error.
I noticed that in the failing url, your $releasever is %24releasever, but it should be 7 or 7.14.xx. Please check your yum config file at /etc/yum/var, or search in every .repo file, to see what is its value. It may be corrupted.
See Red Hat documentation for more information about how to set these variables.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-using_yum_variables
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum -y install yum-utils
yum-config-manager --enable remi-php74
Then proceed to your installation/updates/etc
Always make sure NAT is active on your centos7. Specially when there is a VMnet2 for host. Because sometimes VMNet2 can be active instead of NAT and because of that you will not be able to connect to the internet through centos7. This is just a one reason for getting that error.

SBT install failure with aptitude on Ubuntu 14.04

I receive several errors when I attempt to install sbt on Ubuntu via aptitude with the instructions from the scala-sbt homepage:
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-get update
sudo apt-get install sbt
http://www.scala-sbt.org/0.13/tutorial/Installing-sbt-on-Linux.html
First I get a package validation error and then a segmentation fault.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
sbt
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1,041 kB of archives.
After this operation, 1,224 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
sbt
Install these packages without verification? [y/N] y
E: Method https has died unexpectedly!
E: Sub-process https received a segmentation fault.
EDIT:
I can browse the mirror fine without any cert errors.
Confirming which mirror it's using with apt-cache.
$ sudo apt-cache policy sbt
sbt:
Installed: (none)
Candidate: 0.13.7
Version table:
0.13.7 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.13.6 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.13.5 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.13.2 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.13.1-0.1-build-001 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.13.0-0.1-build-001 0
500 https://dl.bintray.com/sbt/debian/ Packages
0.12.4-0.1-build-001 0
500 https://dl.bintray.com/sbt/debian/ Packages
EDIT 2: I ended up just downloading the package manually and installing it with dpkg.
There are related answers which lead me to this solution:
wget https://dl.bintray.com/sbt/debian/sbt-0.13.7.deb
sudo dpkg -i sbt-0.13.7.deb
P.S. I think that officially documented way does not work because they didn't provide the public key used by apt to authenticate packages.
P.P.S. After some research I've found that this issue is more related to the apt package, there are many reports about this error at bugs.launchpad.net. So, while it's still an issue that sbt didn't provide public key, but it shouldn't cause this error. I hope canonical will resolve this soon.
Related:
Install sbt on ubuntu [closed]
Install Java Scala and SBT on Debian (useless pain in the ass)
Manual install is also available:
http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html
Also, as a temporary workaround, you could use HTTP repository address instead of HTTPS.
Just open file /etc/apt/sources.list.d/sbt.list and replace
deb https://dl.bintray.com/sbt/debian /
with
deb http://dl.bintray.com/sbt/debian /

unable to update to Ruby 2.1.4

Currently running Yosemite and unable to update to ruby 2.1.4 , see below.
Guidos-MacBook-Pro:~ Guido$ rvm install 2.1.4
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 26: /usr/local/Library/brew.rb: Undefined error: 0
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
So after I stepped away from the computer for a few hours and came back again, I figured out the issue was that Homebrew was broken after I updated OS to Yosemite. Here is the link http://ryantvenge.com/2014/09/ruby-homebrea-yosemite/ to the solution. If that is not working see commands below.
To fix Homebrew:
cd /System/Library/Frameworks/Ruby.framework/Versions
sudo ln -s Current 1.8
brew update
sudo rm 1.8
To update to ruby 2.1.4:
rvm install 2.1.4
rvm use 2.1.4

Pacman transaction error

Today I installed Arch Linux onto my Raspberry Pi and as one of my first steps I tried to install some new packages. However, I always get the same error if I try to install a package:
error: failed to commit transaction (wrong or NULL argument passed)
Errors occurred, no packages were upgraded.
I checked some other repository servers, but it still does not work. Here is my current mirrorlist:
#
# Arch Linux ARM repository mirrorlist
# Generated on 2013-06-13
#
## Geo-IP based mirror selection and load balancing
# Server = http://mirror.archlinuxarm.org/armv6h/$repo
## Berlin
Server = http://de.mirror.archlinuxarm.org/armv6h/$repo
Then I tried to clear my cache:
pacman -Sc
rm /var/cache/pacman/pkg/*.part
pacman -Syyu
It did not work! Any ideas?
First, make sure your system is up-to-date with "sudo pacman -Syu" Then you can try selecting new mirrors and "sudo pacman -Syy" to refresh your mirrorlist. It's good to have a main mirror, and a few backups.
Try checking the wiki:
Mirrors - ArchWiki
Also check Mirrors status page:
Mirror Status
Just as a side note, I couldn't find your mirror in the list of current mirrors, so there could be your problem.
If all else fails, I'd take it to the arch forums, but just a warning, you're going to have to provide a lot more information, packages you're trying to install, and possible the pacman jorunal error messages, etc...
Try this in your terminal
sudo pacman-mirrors --country all --api --protocols all --set-branch stable && sudo pacman -Syyu