Different MD5 sums of the same RPM package built twice - md5

I'm building binary RPM package twice from the same batch of files and getting different MD5 sums.
Package is built with rpmbuild -bb
What I investigated:
I timestamped all files in buildroot with the same date and after packages is built checked timestamps and MD5 sums of files included into RPM with rpm –q --dump -p my.rpm command. They are the same in two packages.
With rpm –qpi my.rpm I found out that package doesn't have signature.
So, what can be the reason of different MD5 sums?
My configuration: CentOS 6, rpm 4.8.0
In older version of rpm tool (4.4) there was -z option which "freezed time" so hash sum of package remained the same. But now it vanished... Does anybody know if there is substitution for it in newer versions of rpm? In man I haven't found info.

There is metadata, such as build time and date, that are always going to change. Unless you mean the files within the RPM have different MD5 signatures.

Related

How to list/download the recursive BUILD dependencies of a debian package?

I've recently learned that one can use apt to download sources and easily amend, re-build, and install the package locally from Cinnamon volume step and media keys.
# Download the sources
apt source cinnamon-settings-daemon
cd cinnamon-settings-daemon-4.4.0+tricia
# Then install the build dependencies
apt build-dep cinnamon-settings-daemon
#Then build from the modified sources
apt build
Install the modified deb file (again note the version string may differ for different Cinnamon versions)
apt deb ~/cinnamon-settings-daemon_4.4.0+tricia_amd64.deb
I now also want to be able to just download all packages needed for apt build-dep as for binary package install How to list/download the recursive dependencies of a debian package?. However, when I've tried to use --download-only and then install debs files, it resulted in several other files needed:
The following additional packages will be installed:
libarchive-cpio-perl libcupsfilters-dev libicu66:i386 libltdl-dev
libmail-sendmail-perl libpng-tools libpulse0:i386 libsys-hostname-long-perl
Even $ apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances cinnamon-settings-daemon | grep "^\w" | sort -u does not list e.g. libarchive-cpio-perl and also --download-only when I tried to substitute empty dmkg status file ($(apt-config shell STATUS Dir::State::status)) and downloaded ~500 files, not ~100, that "additional" file(s) is(are) still missing.
Added 1:
I added --no-install-recommends to apt install debs and now only two i386 remained in additional not downloaded:
The following additional packages will be installed:
libicu66:i386 libpulse0:i386
Any idea what is so special about them? These are the only i386 mentioned, 1st one listed in apt cache above. 2nd not listed, so combining two deb sets is not a way to solve.
I downloaded debs with dpkg status file corresponding to a system with less packages installed than one where I tried to install later. I assumed it ensures all required are downloaded. However, as I received an answer after facing same issue with regular (not build, sources) packages, it is not so: https://unix.stackexchange.com/a/684975/446998. Additionally installed packages included some i386 architecture packages with corresponding amd64 packages among downloaded debs, so i386 required upgrade too when amd64 were installed as needed to be kept in sync.

Could not perform backup protocol version exchange, error code -1

I need to backup iphone with libimobiledevice, using ubuntu, the device is detected but going to launch the backup commands the following error is displayed:
Started "com.apple.mobilebackup2" service on port 49343.
Could not perform backup protocol version exchange, error code -1
What could it depend on?
Several Github issues have reported this problem, like this one.
Solution:
you need to use latest version of idevicebackup and libimobiledevice
Indeed, if you use Ubuntu 20.04 (for instance), the libimobiledevice package is outdated, as of now.
If that's your case, you'll have to either wait for the next Ubuntu release (22.04) or compile it from source, what may become necessary at some point after the release of Ubuntu 22.04 anyway.
Disclaimer: downside of compiling yourself is that your binaries are not managed by the package manager. You'll have to update yourself, git pulling or downloading the newest source code releases and re-compiling everything everytime. You might have to redo all of this after a distribution upgrade. Upside is that your binaries do work...
Note: compilation steps are described on the official site only for debian; I could perform them equally well on a Linux Mint 20.3 (based on Ubuntu, based on debian). OP does not mention the OS he or she uses, but debian based seem to be the only ones available for now, so what follows should work on debian based OSes.
Compilation from source, step by step:
uninstall the official package and its dependencies and:
install the build dependencies: sudo apt install build-essential checkinstall git autoconf automake libtool-bin libplist-dev libusbmuxd-dev libssl-dev usbmuxd (see "from source" here)
get libimobiledevice source code from its repo, using for instance git clone https://github.com/libimobiledevice/libimobiledevice.git. You might get to the releases page and use the latest tar.gz instead (1.3 at the moment).
also get source code of other libraries required by libimobiledevice: libplist, libimobiledevice-glue and libusbmuxd. (I also compiled usbmuxd instead of using the official package, but I am not sure it is necessary). For each one of them, you can git clone it or download and untar the latest source code release, if available.
choose a prefix directory, where libraries and binaries will go. Create it if necessary (official libimobiledevice site suggests /opt/local and I will use this too in the next steps; in order for the compilation to work, you'll have to sudo mkdir /opt/local and export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig before starting the first compilation)
to compile and install, cd to the root of each git-cloned (or source-downloaded) directory (in this order: lipblist, libimobiledevice-glue, libusbmuxd and libimobiledevice, because each one depends on the previous one) and execute, in each one of them: ./autogen.sh --prefix=/opt/local, then make and finally sudo make install. (Note, the autogen line for libimobiledevice may be ./autogen.sh --prefix=/opt/local --enable-debug, as suggested here).
Having done all of this, the iphone was not mounted automatically, I had to manually run idevicepair pair and then could mount it using ifuse ./iphone_mount_point/ (do sudo apt install ifuse if necessary) and perform a backup using idevicebackup2 backup --full iphone_backup/. Read the help of idevicebackup2 for more information.

Which buildroot package needs to be installed to get any given utility onto the target rootfs?

I am new to buildroot. Using buildroot 2016.05, I have successfully built a target SD card for a MicroZed board with a Xilinx kernel, but it was missing some utilities that I wanted in the root file system. In particular, I wanted scp.
Looking through the buildroot documentation and web searches didn't yield the answer, but I was able to search the Config.in files in the package folders for "scp" and eventually determine that I could install either dropbear or openssh to get scp.
Other than the brute force way I searched Config.in files, is there an approach with buildroot to resolve a "which package produces binary XYZ" question?
A big part of building embedded Linux systems is understanding the components of Linux systems in general. How do you figure out what packages to install on your desktop/server Linux installation? In this way Buildroot isn't really any different. As a help we do sort packages in groups (E.G. Network applications in this case) and provide help text for each package, but you are really expected to know that 'scp' is part of the ssh package (openssh or dropbear).
What can sometimes be helpful is to check what package a program comes from on your desktop Linux installation - E.G. dpkg -S $(which scp) for this question in case you are using Debian/Ubuntu

Where magic database for filetypes

Where one can download or obtain source of magic database for libmagic (a file command). I have compiled version in /usr/share/misc/magic.mgc but can not find original source file. (Ideally I would like to know where on the Internet is original, NOT system/distribution-specific format of such file.)
I was unable to find it ever after hours of googling.
Thanks
In the sources for the file command (github; ftp). Specifically, in the "magic" subdirectory. There is not a single source file; the database is compiled from multiple sources.
("libmagic" is part of the file package).
The file utility has a GitHub repository at https://github.com/file/file and a homepage at http://www.darwinsys.com/file/
I imagine that any distribution using these sources do so in a modified form. It might even be that the local file utility and the associated libmagic library has diverged significantly from the above sources.
On OpenBSD systems, the libmagic library is available as a port. It will pull the sources from an FTP site associated with the GitHub repository above.
In Ubuntu, you can get exact source code for libmagic (with patches, if any) with the following command:
apt-get source libmagic-dev
It will download the source to the current directory.
If you didn't know the package name, you could use apt-file to find out:
apt-file search libmagic.so
You might need to install apt-file using
sudo apt-get install apt-file
sudo apt-file update

Is it possible to specify, in Puppet, to use an rpm for a different OS than the host machine's OS?

I've got a machine running an unsupported OS (rhel6.3). It no longer has access to current repos, and cannot be updated for budget reasons.
It needs to have tzdata updated, but the only version it has access to is from 2014.
tzdata is a noarch package - it's just a bunch of binary files - so it doesn't matter if I grab it from another repo, say, our local yum repo which has the latest tzdata packages for other OSs, like centos7.
I know I can simply download and put the latest tzdata rpm locally on the rhel machine, but I'd like this process to be automated - as in, Puppet checks that tzdata is the latest version - and not have to manually go put it in place whenever the tzdata is updated.
Is it possible for Puppet to specify, use this repo, but use the rpm specified for another OS?
tzdata is a noarch package - it's just a bunch of binary files - so it doesn't matter if I grab it from another repo, say, our local yum repo which has the latest tzdata packages for other OSs, like centos7.
Being a noarch package has no such implication. "Noarch" packages are independent of machine architecture, but not necessarily of OS version. For example, many Python packages are noarch, but the Python2 in EL6 is version 2.6, whereas the Python2 in EL7 is version 2.7. Noarch Python packages for EL7 do not work properly on EL6 if they rely on any of the features introduced in Python 2.7. If they are well packaged then such packages won't even install on EL6.
I suspect you're ok with tzdata in particular, but there is always a possibility that there has been a change or addition to the format of the packaged files that renders them unusable on older OS versions. You should be pretty safe, however, if you go with the CentOS 6.7 package for your EL6.3 system, rather than any EL7 package.
Is it possible for Puppet to specify, use this repo, but use the rpm specified for another OS?
Packages in the same Yum repo are not distinguished by OS or OS version. Where and to the extent that different OS flavors or versions must be served different package collections, it is done by giving them altogether different repos. So no, there is no way to instruct Puppet specifically as you describe, because there is no way to instruct yum that way.
On the other hand, if you have a local repo that is enabled on the target machine, then you can indeed drop a package built for some other RPM-based distro [version] into that repo. Clients will see it, and will (attempt to) use it where appropriate based on its name and epoch-version-release codes. You don't need to do anything special to make that happen.
On the third hand, you could also consider getting the source RPM for the version of tzdata you want, building the binary RPM from it on your EL6.3 machine, and dropping that in your local repo. You can get all manner of source (and binary) RPMs for Fedora and RHEL from Koji.

Resources