Ph: 19216812

Archive

Posts Tagged ‘rpm’

How to avoid stripping when building RPMs

April 21st, 2009

I’ve found 3 ways to disable the strip binary option when building RPMs. Any one of these methods will get the job done. The last one is obviously pretty ghetto, but they all work!

If you’re doing normal builds, the first two are good choices, but if you’re trying to package a bunch of binaries using RPM, I’ve found that the build will still fail, even using both the %define and the shell variable.

extracting debug info from ...
*** ERROR: No build ID note found in ...

At the top of your spec file, where the rest of your defines are, add this:

%define __os_install_post %{nil}

In the install section, export this variable:

export DONT_STRIP=1

Or find the script that’s getting called and swap it out with an empty script that does nothing when it is called. You can’t just delete it because rpmbuild will fail if it’s not there, but a simple one liner will work.

#!/bin/sh

On Fedora systems that script is /usr/lib/rpm/find-debuginfo.sh
Don’t forget to chmod +x so it will be executable.

Linux binary, define, export, find-debuginfo.sh, rpm, rpmbuild, strip

How to figure out RPM dependencies

April 20th, 2009

If you have access to YUM, YAST, APTITUDE, or other such package manager, you can generally rely on these tools to sort out dependencies for you. In a modern day linux system, you can just install a package and all the dependencies are figured out, downloaded, and installed for you.

But what if your system is disconnected from the world. What if your network is a stand-alone network with no access to repositories and external stores of packages. You might need to look at an RPM file and figure out what it needs, retrieve it by hand, and install the packages yourself.

$ rpm –query –package –requires xpad-2.14-2.fc8.ppc.rpm
or simply:

$ rpm -qpR xpad-2.14-2.fc8.ppc.rpm

/bin/sh
/bin/sh
hicolor-icon-theme
libICE.so.6
libSM.so.6
libatk-1.0.so.0
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.4)
libcairo.so.2
libdl.so.2
libgdk-x11-2.0.so.0
libgdk_pixbuf-2.0.so.0
libglib-2.0.so.0
libgmodule-2.0.so.0
libgobject-2.0.so.0
libgtk-x11-2.0.so.0
libpango-1.0.so.0
libpangocairo-1.0.so.0
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)

You don’t need to be root to use the rpm query commands. But you do need root privileges to install rpms.

$ rpm -Uvh zvbi-fonts-0.2.30-1.fc8.ppc.rpm

error: can't create transaction lock on /var/lib/rpm/__db.000

Linux aptitude, dependencies, install, packages, query, rpm, xpad, yast, yum

Reinstall customized RPMs with repackage and rollback

April 8th, 2009

Here’s one very specific way to temporarily remove an RPM package where I think I want it gone, but I want to test to see how the system reacts when the package is completely removed. I dont’ want to just remove it because i’ve made some changes to the config files and perhaps I’ve spliced in a few custom binaries here and there, so it’s really iffy.

I’ll just use preload.x86_64 as an example. Here’s the files installed by the preload package.

# rpm -ql preload

/etc/logrotate.d/preload
/etc/preload.conf
/etc/rc.d/init.d/preload
/etc/sysconfig/preload
/usr/sbin/preload
/usr/share/doc/preload-0.4
/usr/share/doc/preload-0.4/AUTHORS
/usr/share/doc/preload-0.4/COPYING
/usr/share/doc/preload-0.4/ChangeLog
/usr/share/doc/preload-0.4/NEWS
/usr/share/doc/preload-0.4/README
/usr/share/doc/preload-0.4/THANKS
/usr/share/doc/preload-0.4/TODO
/usr/share/man/man8/preload.8.gz
/var/lib/preload
/var/lib/preload/preload.state
/var/log/preload.log

Now i’ll repackage it so my modifications to /etc/preload.conf are saved. This will keep the changes to any files that are listed above in the package. If you’ve added some custom files but they’re not really part of the original list of files in the rpm, this won’t know what to do, but since the conf file is part of the package, it will work just fine.

# rpm -e –repackage preload.x86_64

Now it’s gone, and I can do some testing, install more packages, whatever…

# run stuff here

Ok, time to rollback and put my preload package back on the system. I don’t need the original rpm and I don’t need to worry about any files. Since I removed it with the –repackage option, it will pull it from spool or wherever it’s stored. The key here is that i’m just sitting in some directory, any directory, and I don’t need to supply the packaged file.

# rpm -Uvh –rollback ‘3:00am’

Rollback packages (+1/-0) to Wed Apr  8 06:09:14 2009 (0x47dd277a):
Preparing...                ############################# [100%]
   1:preload                #Cleaning up repackaged packages:########(104%)
        Removing /var/spool/repackage/preload-0.8-7.fc11.x86_64.rpm:

Poof, it’s back. And my /etc/preload.conf has my custom configuration.

# yum list installed | grep preload

preload.x86_64                         0.8-7.fc11               installed

Linux broken, fix, history, install, restore, rollback, rpm, upgrade, yum

How to remove yum packages without dependencies

April 8th, 2009

I can’t figure out how to make yum ignore dependencies and I can’t find it by googling either. The yum-allowdowngrade package doesn’t do what I expected it to do. So I’ll just have to ignore yum for now and force rpm to do the job. Yum will be fine with this, it will not break at all. Yum will reflect the new versions after the splice, so it doesn’t matter that you’re not calling yum to do this.

# rpm -qa | grep gtk2

pygtk2-codegen-2.12.0-2.fc11
pygtk2-libglade-2.12.0-2.fc11
pygtk2-devel-2.12.0-2.fc11
gtk2-devel-2.12.8-2.fc11
gtk2-2.12.8-2.fc11
gtk2-2.12.8-2.fc11
pygtk2-2.12.0-2.fc11
gtk2-engines-2.12.2-1.fc11
gtk2-engines-2.12.2-1.fc11
gtk2-devel-2.12.8-2.fc11

I need to downgrade gtk2 and gtk2-devel packages without touching anything else. If I were a doctor, downgrading through yum would be the equivalent of performing a heart transplant to fix heart burn.

Transaction Summary
==========================================
Install      0 Package(s)
Update       0 Package(s)
Remove     278 Package(s)         

Is this ok [y/N]: no!

So i’ll just remove the 32 bit and 64 bit gtk2 packages manually without processing dependencies. You should not get any standard output from these commands, just right back to your prompt. If you’re really worried, echo the $? variable to make sure you got a return value of zero right after each rpm command.

# rpm -e –nodeps gtk2.i386

# rpm -e –nodeps gtk2.x86_64

# rpm -ivh gtk2-2.12.3-3.fc11.i386.rpm

Preparing...                ########################### [100%]
   1:gtk2                   ############################ [100%]

# rpm -ivh gtk2-2.12.3-3.fc11.x86_64.rpm

Preparing...                ########################### [100%]
   1:gtk2                   ############################ [100%]

# rpm -e –nodeps gtk2-devel.i386

# rpm -e –nodeps gtk2-devel.x86_64

# rpm -ivh gtk2-devel-2.12.3-3.fc11.i386.rpm

Preparing...                ############################ [100%]
   1:gtk2-devel             ############################ [100%]

# rpm -ivh gtk2-devel-2.12.3-3.fc11.x86_64.rpm

Preparing...                ############################ [100%]
   1:gtk2-devel             ############################ [100%]

The new versions show up when I ask yum to list the packages. All is good.

# yum list installed | grep gtk2

gtk2.x86_64                              2.12.3-3.fc11          installed
gtk2.i386                                2.12.3-3.fc11          installed
gtk2-devel.i386                          2.12.3-3.fc11          installed
gtk2-devel.x86_64                        2.12.3-3.fc11          installed

Linux dependencies, downgrade, gtk2, packages, remove, repository, rpm, without, yum

Setup your own YUM repository, the easy way!

September 25th, 2008

I don’t understand why some people think this is a complicated thing to set up, so here goes my approach which I think is the easiest method.  Perhaps you’re behind a very restrictive corporate firewall or you want to conserve bandwidth when you’re setting up several machines.  You can set up your own repositories on one machine in your network and have it download the packages and updates in the off-hours.  Whenever a client machine on your network wants updates, they’ll get them much faster and you’ll save bandwidth too.

Step-by-step:

Install createrepo on the machine you want to be your update server.

[user@hostname ~]$ sudo yum install createrepo

Now you’ll create a few crons to create and maintain your mirror.  Let’s start with the one that does the grunt work of downloading the packages.  I’ll go ahead and set a bandwidth limit and log my mirroring.  I don’t care about debug stuff so i’ll exclude that and any iso’s that may get dumped in there too.

#!/bin/sh
# GET THE LATEST PACKAGES
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/i386.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/i386.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/i386/
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/x86_64.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/x86_64.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/x86_64/

Create a cron to update your repo as new rpms get mirrored.

#!/bin/sh
# CREATE/MAINTAIN MY LOCAL REPOSITORY
/usr/bin/createrepo –update /opt/yum/base/8/i386
/usr/bin/createrepo –update /opt/yum/base/8/x86_64

Create another cron to rotate your logs, saving the last week’s worth.

#!/bin/sh
# ROTATE THE LOGS
rm -f /var/log/rsync/yum-rsync-log7.tar.gz
mv -f /var/log/rsync/yum-rsync-log6.tar.gz /var/log/rsync/yum-rsync-log7.tar.gz
mv -f /var/log/rsync/yum-rsync-log5.tar.gz /var/log/rsync/yum-rsync-log6.tar.gz
mv -f /var/log/rsync/yum-rsync-log4.tar.gz /var/log/rsync/yum-rsync-log5.tar.gz
mv -f /var/log/rsync/yum-rsync-log3.tar.gz /var/log/rsync/yum-rsync-log4.tar.gz
mv -f /var/log/rsync/yum-rsync-log2.tar.gz /var/log/rsync/yum-rsync-log3.tar.gz
mv -f /var/log/rsync/yum-rsync-log1.tar.gz /var/log/rsync/yum-rsync-log2.tar.gz
mv -f /var/log/rsync/yum-rsync-log.tar.gz /var/log/rsync/yum-rsync-log1.tar.gz
tar -czf /tmp/yum-rsync-log.tar.gz /var/log/rsync/*.log
rm -rf /var/log/rsync/*.log
mv -f /tmp/yum-rsync-log.tar.gz /var/log/rsync/

On your client machines, move or delete the existing repo definitions and create a new one that points to your local repositories.  Assuming your server machine’s IP address is 192.168.1.2 and you’re using Fedora your new repo definitions would look something like this:

[fairfield-base]
name=My_Local_Repo - base - Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://192.168.1.2/yum/base/$releasever/$basearch
enabled=1
gpgcheck=1

[fairfield-updates]
name=My_Local_Repo - updates - Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://192.168.1.2/yum/updates/$releasever/$basearch
enabled=1
gpgcheck=1

Wait until your cron fills your repositories or download a few packages and run your createrepo.  From now on your updates will execute much faster.  And if you want to build new machines, you can point your kickstart to get packages from your local mirror instead of just your cdrom so you can build machines that are fully up to date right out of the box.  Try updating on your clients.  You should notice it takes ten times longer to install the updates than it does to download them.

[user@hostname ~]$ sudo yum update

http://blog.rootninja.com/wp-content/uploads/2008/09/rootninja_80×151.jpg“>[image]http://blog.rootninja.com/wp-content/uploads/2008/09/rootninja_80×151.jpg” alt=”root|ninja” width=”80″ height=”15″ />

Linux Linux, packages, repo, rpm, rsync, server, updates, yum


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics