How do I sync rpm packages with another computer? I have a list of the remote's rpms generated with "rpm -qa". I expect to have to modify a couple of packages in the list due to hardware dependent rpms like xorg. Otherwise it should be a simple matter of downloading the rpms from the edited list and then installing them. Or is there already a script for this?
On 11/25/20 2:58 AM, Mayavimmer wrote:
How do I sync rpm packages with another computer? I have a list of the remote's rpms generated with "rpm -qa". I expect to have to modify a couple of packages in the list due to hardware dependent rpms like xorg. Otherwise it should be a simple matter of downloading the rpms from the edited list and then installing them. Or is there already a script for this?
dnf install $(<rpmlist.txt)
On 26/11/20 03:02, Samuel Sieb wrote:
On 11/25/20 2:58 AM, Mayavimmer wrote:
How do I sync rpm packages with another computer? I have a list of the remote's rpms generated with "rpm -qa". I expect to have to modify a couple of packages in the list due to hardware dependent rpms like xorg. Otherwise it should be a simple matter of downloading the rpms from the edited list and then installing them. Or is there already a script for this?
dnf install $(<rpmlist.txt)
Thanks. There are several subtleties though. See my next log post.
On 25 Nov 2020 at 11:58, Mayavimmer wrote:
To: fedora users@lists.fedoraproject.org From: Mayavimmer mayavimmer@gmail.com Subject: Sync rpms with other computer Date sent: Wed, 25 Nov 2020 11:58:08 +0100 Send reply to: Community support for Fedora users users@lists.fedoraproject.org
How do I sync rpm packages with another computer? I have a list of the remote's rpms generated with "rpm -qa". I expect to have to modify a couple of packages in the list due to hardware dependent rpms like xorg. Otherwise it should be a simple matter of downloading the rpms from the edited list and then installing them. Or is there already a script for this?
Rather than a using rpm -qa list, I use rpm --qf "%{NAME}.%{ARCH}\n" -qa
I use a script listrpm to make a listing #!/usr/bin/bash rpm --qf "%{NAME}.%{ARCH}\n" -qa | sort | grep -v gpg-pubkey > installed_pkgs"$(date +%F)".txt
Then you can copy the file, and run dnf install with that piped into it. Also, do this if I create a machine with a clean install of an OS, and then want to add the missing packages. Sometimes get errors on packages that might no longer be available, but then just delete those lines from file.
Good Luck.
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
+------------------------------------------------------------+ Michael D. Setzer II - Computer Science Instructor (Retired) mailto:mikes@guam.net mailto:msetzerii@gmail.com Guam - Where America's Day Begins G4L Disk Imaging Project maintainer http://sourceforge.net/projects/g4l/ +------------------------------------------------------------+
On 26/11/20 08:31, Michael D. Setzer II wrote:
On 25 Nov 2020 at 11:58, Mayavimmer wrote:
How do I sync rpm packages with another computer? I have a list of the remote's rpms generated with "rpm -qa". I expect to have to modify a couple of packages in the list due to hardware dependent rpms like xorg. Otherwise it should be a simple matter of downloading the rpms from the edited list and then installing them. Or is there already a script for this?
Rather than a using rpm -qa list, I use rpm --qf "%{NAME}.%{ARCH}\n" -qa
I use a script listrpm to make a listing #!/usr/bin/bash rpm --qf "%{NAME}.%{ARCH}\n" -qa | sort | grep -v gpg-pubkey > installed_pkgs"$(date +%F)".txt
Then you can copy the file, and run dnf install with that piped into it. Also, do this if I create a machine with a clean install of an OS, and then want to add the missing packages. Sometimes get errors on packages that might no longer be available, but then just delete those lines from file.
Good Luck.
Ah, good idea to exclude gpg-pubkey.
Why only use NAME and ARCH?
Anyway, summary of interesting points, so far: * There is probably no ready made script, then write one. * Let's call the two hosts Master and Clone. * Should probably install Master-only packages first, then remove Clone-only ones. * Clone the Master repo configuration, possibly removing Clone-only repos? .... But could have problems removing rpms! .... And may not want redundant repos?? .... Maybe solve this problem by inverting the order like this: ........ 1. Remove Clone-only rpms (ugh, could remove too much!) ........ 2. Zero Clone repo config and replace with Master repo config ........ 3. Install * Prepare rpmlist for easy parsing, maybe use the tilde char: .... rpm -qa --qf="%{NAME}-%{EVR}.%{ARCH}\n" # almost same as rpm -qa .... rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" # almost same as rpm -qa * Identify special rpms to exclude from cloning: .... *-gpg-pubkey-* .... Some xorg rpm tied to a non default graphics card .... Other rpms that were installed non from repo in Master * What to do when downgrading some rpms?? * Ok, here is a first attempt at the install-first-then-remove case: .... 1. Ensure Clone repo config is the same Master's. .... 2. Master # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > master-rpms ........ # Note: still not exactly the same as rpm -qa .... 3. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 4. Compare the two lists in various ways, using tilde fields. .... 4. Edit master-rpms to eliminate unwanted rpms. .... 5. Clone # dnf install $(<edited-master-rpms) .... # Now do it again to compare .... 6. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 7. Clone # vimdiff edited-master-rpms clone-rpms .... 8. Repeat until all differences are sorted out
On 11/27/20 2:50 AM, Mayavimmer wrote:
Why only use NAME and ARCH?
As long as the source system is fully up-to-date, the EVR is probably ok and ARCH would only be necessary if you have some multi-arch packages installed, like for wine. Otherwise, just "NAME" is the best option. Then you don't have to worry about packages getting updated in the meantime.
Anyway, summary of interesting points, so far:
- There is probably no ready made script, then write one.
- Let's call the two hosts Master and Clone.
- Should probably install Master-only packages first, then remove
Clone-only ones.
- Clone the Master repo configuration, possibly removing Clone-only repos?
Why or how do the two systems have different repo configurations? Are you adding third-party repos (other than rpmfusion)?
.... But could have problems removing rpms!
Removing rpms doesn't require the source repo config.
.... And may not want redundant repos??
repos generally have fixed filenames, unless you're doing something custom, so this won't happen.
.... Maybe solve this problem by inverting the order like this: ........ 1. Remove Clone-only rpms (ugh, could remove too much!) ........ 2. Zero Clone repo config and replace with Master repo config ........ 3. Install
- Prepare rpmlist for easy parsing, maybe use the tilde char:
.... rpm -qa --qf="%{NAME}-%{EVR}.%{ARCH}\n" # almost same as rpm -qa .... rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" # almost same as rpm -qa
- Identify special rpms to exclude from cloning:
.... *-gpg-pubkey-* .... Some xorg rpm tied to a non default graphics card
This doesn't matter.
.... Other rpms that were installed non from repo in Master
- What to do when downgrading some rpms??
Avoid this potential issue by not including the EVR.
- Ok, here is a first attempt at the install-first-then-remove case:
.... 1. Ensure Clone repo config is the same Master's. .... 2. Master # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > master-rpms ........ # Note: still not exactly the same as rpm -qa .... 3. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 4. Compare the two lists in various ways, using tilde fields. .... 4. Edit master-rpms to eliminate unwanted rpms. .... 5. Clone # dnf install $(<edited-master-rpms) .... # Now do it again to compare .... 6. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 7. Clone # vimdiff edited-master-rpms clone-rpms .... 8. Repeat until all differences are sorted out
When you get to point of removing the extra rpms from the clone, I would suggest using "--noautoremove" with the dnf command, otherwise it might remove more than you expect.