While updating the custom packages using yum, the %post script of custom build rpm is not taken into cosideration
Issue
- There are two
rpm
files. One is manually built. Saytest-1.0.rpm
and another isinitscripts-8.45.42-1.el5_8.1.x86_64
rpm which is planned to be updated. - The rpm
test-1.0.rpm
is installed into the machine and when a new update is available for the same, it will betest-1.1.rpm
The package test-1.0.rpm
is built using the following spec file.
Summary: test
Name: test
Version: 1
Release: 0
Group: Applications
License: GPL
BuildRoot: %{_topdir}/BUILDROOT
%description
%build
mkdir %{buildroot}/tmp
touch %{buildroot}/tmp/test
%files
/tmp/test
%clean
rm -rf %{buildroot}/*
Whereas the package test-1.1.rpm
is built using the following spec
file.
Summary: test
Name: test
Version: 1
Release: 1
Group: Applications
License: GPL
BuildRoot: %{_topdir}/BUILDROOT
%description
%build
mkdir %{buildroot}/tmp
touch %{buildroot}/tmp/test
%files
/tmp/test
%clean
rm -rf %{buildroot}/*
%post
echo "net.ipv4.tcp_timestamps = 0" >> /etc/sysctl.conf
- In the system, the rpm
test-1.0.rpm
andinitscripts-8.45.42-1.el5_8.1.x86_64
are installed and the updates are available for them as packagestest-1.1.rpm
andinitscripts-8.45.42-1.el5_8.1.x86_64.rpm
are available. - But as the package
test.1.1.rpm
contains a%post
script in its code which changes the file/etc/sysctl.conf
, the update ofinitscripts-8.45.42-1.el5_8.1.x86_64.rpm
over-writes it which is not expected. - Yum commands are as follows.
[root@server1.example testdir]# ll
total 1644
-rw-r--r-- 1 root root 1669709 Aug 9 04:32 initscripts-8.45.42-1.el5_8.1.x86_64.rpm
-rw-r--r-- 1 root root 1731 Nov 3 11:02 test-1.1.x86_64.rpm
[root@server1.example testdir]# yum localinstall test-1.1.x86_64.rpm initscripts-8.45.42-1.el5_8.1.x86_64.rpm -y --nogpgcheck
Loaded plugins: rhnplugin, security
Setting up Local Package Process
Examining newtest-1.1.x86_64.rpm: test-1-1.x86_64
Marking test-1.1.x86_64.rpm as an update to test-1-0.x86_64
Examining initscripts-8.45.42-1.el5_8.1.x86_64.rpm: initscripts-8.45.42-1.el5_8.1.x86_64
Marking initscripts-8.45.42-1.el5_8.1.x86_64.rpm as an update to initscripts-8.45.30-2.el5.x86_64
Resolving Dependencies
--> Running transaction check
---> Package initscripts.x86_64 0:8.45.42-1.el5_8.1 set to be updated
---> Package test.x86_64 0:1-1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Updating:
initscripts x86_64 8.45.42-1.el5_8.1 /initscripts-8.45.42-1.el5_8.1.x86_64 5.3 M
test x86_64 1-1 /test-1.1.x86_64 0.0
Transaction Summary
======================================================================================================================================
Install 0 Package(s)
Update 2 Package(s)
Remove 0 Package(s)
Total size: 5.3 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : test 1/4
Updating : initscripts 2/4
Cleanup : test 3/4
Cleanup : initscripts 4/4
Updated:
initscripts.x86_64 0:8.45.42-1.el5_8.1 test.x86_64 0:1-1
Complete!
- Checked the file
/etc/sysctl.conf
, no entries.
[root@server1.example testdir]# tail -n 2 /etc/sysctl.conf
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
- Re-installed the packages but this time in reverse order.
[root@server1.example testdir]# yum reinstall initscripts-8.45.42-1.el5_8.1.x86_64.rpm test-1.1.x86_64.rpm -y --nogpgcheck
Loaded plugins: rhnplugin, security
Setting up Reinstall Process
Examining initscripts-8.45.42-1.el5_8.1.x86_64.rpm: initscripts-8.45.42-1.el5_8.1.x86_64
Examining test-1.1.x86_64.rpm: test-1-1.x86_64
Resolving Dependencies
--> Running transaction check
---> Package initscripts.x86_64 0:8.45.42-1.el5_8.1 set to be updated
---> Package initscripts.x86_64 0:8.45.42-1.el5_8.1 set to be erased
---> Package test.x86_64 0:1-1 set to be updated
---> Package test.x86_64 0:1-1 set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
initscripts x86_64 8.45.42-1.el5_8.1 /initscripts-8.45.42-1.el5_8.1.x86_64 5.3 M
test x86_64 1-1 /test-1.1.x86_64 0.0
Removing:
initscripts x86_64 8.45.42-1.el5_8.1 installed 5.3 M
test x86_64 1-1 installed 0.0
Transaction Summary
======================================================================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 2 Package(s)
Total size: 5.3 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : initscripts 1/4
Installing : initscripts 1/4
Erasing : test 2/4
Installing : test 2/4
Removed:
initscripts.x86_64 0:8.45.42-1.el5_8.1 test.x86_64 0:1-1
Installed:
initscripts.x86_64 0:8.45.42-1.el5_8.1 test.x86_64 0:1-1
Complete!
- Check the entries in
/etc/sysctl.conf
again. This time that entry is available.
[root@server1.example testdir]# tail -n 2 /etc/sysctl.conf
kernel.shmall = 4294967296
net.ipv4.tcp_timestamps = 0
- Is this behaviour of yum expected?
Environment
- Red Hat Enterprise Linux 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.