I have been trying to use rpm or dnf to remove some rpms. Most the ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex:
list.txt,
gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
On 5/23/22 15:53, Bill Cunningham wrote:
I have been trying to use rpm or dnf to remove some rpms. Most the ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex:
list.txt,
gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Write your list so that all the packages are on a single line, and just add rpm -e to the head of that line:
rpm -e foo bar baz
Or:
for i in `cat list`; do rpm -e $i
I would honestly probably use yum for this, though, since it takes care of dependencies and the like.
So if your list of packages is:
foo bar baz
I would just add "yum remove" to the beginning of the list:
yum -y remove foo bar baz
Thomas
On 5/23/2022 5:12 PM, Thomas Cameron wrote:
Write your list so that all the packages are on a single line, and just add rpm -e to the head of that line:
rpm -e foo bar baz
Or:
for i in `cat list`; do rpm -e $i
I see, thanks much Thomas, so this would then be kind of doing the work of grep. I have used cat and grep together with a pipe, which seems similar
cat list |grep "word"
And it seems to work.
I would honestly probably use yum for this, though, since it takes care of dependencies and the like.
So if your list of packages is:
foo bar baz
I would just add "yum remove" to the beginning of the list:
yum -y remove foo bar baz
Thomas
It worked using this,
yum remove $(cat list)
I have never heard of 'command substitution'. seeing the $ has always made me think of variables, like such,
echo $PATH, to see a value.
Cheers.
Be careful with a "-y" on a dnf/yum remove. I have seen yum/dnf determine that a lot of packages need to go. The protected multi-lib/packages may stop a total disaster, but you could also remove a lot of packages you don't want to remove and have to go back through the list and reinstall a lot.
I have seen people do the removes's without the -y and watch screen fulls of packages scroll by and still answer 'y', and destroy a system (pre-protected-multi-lib).
For a non-automated one-of remove the additional safety gained by having to answer y after seeing that what it wants to remove is a small price to pay.
On Mon, May 23, 2022 at 4:22 PM Thomas Cameron < thomas.cameron@camerontech.com> wrote:
On 5/23/22 15:53, Bill Cunningham wrote:
I have been trying to use rpm or dnf to remove some rpms. Most the ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex:
list.txt,gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
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
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Write your list so that all the packages are on a single line, and just add rpm -e to the head of that line:
rpm -e foo bar baz
Or:
for i in `cat list`; do rpm -e $i
I would honestly probably use yum for this, though, since it takes care of dependencies and the like.
So if your list of packages is:
foo bar baz
I would just add "yum remove" to the beginning of the list:
yum -y remove foo bar baz
Thomas _______________________________________________ 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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
rpm -e $(cat list)
On Mon, May 23, 2022 at 4:02 PM Bill Cunningham bill.cu1234@gmail.com wrote:
I have been trying to use rpm or dnf to remove some rpms. Mostthe ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex:
list.txt,gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
On 5/23/2022 5:22 PM, Roger Heflin wrote:
rpm -e $(cat list)
On Mon, May 23, 2022 at 4:02 PM Bill Cunningham bill.cu1234@gmail.com wrote:
I have been trying to use rpm or dnf to remove some rpms. Most the ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex: list.txt, gcc-devel // example, python-devel //example rpm -e // would this list content be redirectable to rpm -e ? cat list.txt lists rpms, rpm -e < cat list, or cat list | rpm -e do not work. _______________________________________________ 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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
users mailing list --users@lists.fedoraproject.org To unsubscribe send an email tousers-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 Do not reply to spam on the list, report it:https://pagure.io/fedora-infrastructure
On Mon, May 23, 2022 at 6:27 PM Roger Heflin rogerheflin@gmail.com wrote:
rpm -e $(cat list)
Even better: "dnf mark remove $(cat list)
dnf mark remove <package-spec>... Unmarks the specified packages as installed by user. Whenever you as a user don't need a specific pack‐ age you can mark it for removal. The package stays installed on the system but will be removed when Autoremove Command or Remove Command along with clean_requirements_on_remove configuration option set to True is executed. You should use this operation instead of Remove Command if you're not sure whether the package is a requirement of other user installed packages on the system.
On Mon, May 23, 2022 at 4:02 PM Bill Cunningham bill.cu1234@gmail.com wrote:
I have been trying to use rpm or dnf to remove some rpms. Mostthe ones I am concerned with are docker related, and or to do with go (golang). You certainly can't use wildcards with rpm erase. I have a list generated with the date these rpms were installed, but I am not THAT good with CLI and bash operations like cut, xargs, sed and so on to alter the list; and I wouldn't be sure how to pipe the list contents or redirect to rpm the text's content from the ascii text file, to erase these particular rpms. Is there a way to mass erase many files (with rpm switches or such) using rpm? Here is an example of what I have been trying to do, ex:
list.txt,gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Hi,
Bill Cunningham wrote:
I have been trying to use rpm or dnf to remove some rpms.
I'd use dnf. It provides a much wider safety net.
You can do this with rpm as well, but it requires greater care.
Here is an example of what I have been trying to do, ex:
list.txt,
gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
Indeed, rpm doesn't take the list of packages on stdin. You can use a number of techniques here (we all develop our favorite habits, but knowing "there is more than one way to do it"™ is always handy.
Here's how I setup a test:
$ printf '%s\n' gcc-devel python-devel >/tmp/list
$ cat /tmp/list gcc-devel python-devel
You could use xargs:
$ xargs sudo dnf remove </tmp/list
This will display the 'dnf remove' output, showing you what it would do. Then it will exit immediately because there is no way for it to read the 'Is this ok [y/N]:' prompt. You can run it again with the '-y' option.
Another way to feed the list to dnf (or rpm) is to use command substitution:
$ sudo dnf remove $(cat /tmp/list)
Bash¹ has a shortcut for that cat usage which is slightly faster:
$ sudo dnf remove $(< /tmp/list)
¹ Other shells likely have this is something similar, but I'm not familiar with them offhand
A for loop works too, but that doesn't work very well when there are interdependent packages in the list (particularly with rpm, but even with dnf it can cause problems). It's also a _lot_ slower to run the rpm or dnf command multiple times instead of once.
That's just two ways to go about it. Hopefully they help.
On 23 May 2022, at 23:03, Todd Zullinger tmz@pobox.com wrote:
Hi,
Bill Cunningham wrote:
I have been trying to use rpm or dnf to remove some rpms.
I'd use dnf. It provides a much wider safety net.
I have always assumed that using rpm -e will mess up dnf. so I never use rpm for any operation that modifies the system. I think I shot off a foot a decade or so ago doing that.
You can do this with rpm as well, but it requires greater care.
Here is an example of what I have been trying to do, ex:
list.txt,gcc-devel // example,
python-devel //example
rpm -e // would this list content be redirectable to rpm -e ?
cat list.txt
lists rpms,
rpm -e < cat list, or
cat list | rpm -e
do not work.
Indeed, rpm doesn't take the list of packages on stdin. You can use a number of techniques here (we all develop our favorite habits, but knowing "there is more than one way to do it"™ is always handy.
Here's how I setup a test:
$ printf '%s\n' gcc-devel python-devel >/tmp/list
$ cat /tmp/list gcc-devel python-devel
You could use xargs:
$ xargs sudo dnf remove </tmp/list
This will display the 'dnf remove' output, showing you what it would do. Then it will exit immediately because there is no way for it to read the 'Is this ok [y/N]:' prompt. You can run it again with the '-y' option.
Another way to feed the list to dnf (or rpm) is to use command substitution:
$ sudo dnf remove $(cat /tmp/list)
Bash¹ has a shortcut for that cat usage which is slightly faster:
$ sudo dnf remove $(< /tmp/list)
¹ Other shells likely have this is something similar, but I'm not familiar with them offhand
A for loop works too, but that doesn't work very well when there are interdependent packages in the list (particularly with rpm, but even with dnf it can cause problems). It's also a _lot_ slower to run the rpm or dnf command multiple times instead of once.
That's just two ways to go about it. Hopefully they help.
-- Todd _______________________________________________ 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 Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
On 5/24/22 14:28, Barry wrote:
On 23 May 2022, at 23:03, Todd Zullinger tmz@pobox.com wrote:
Hi,
Bill Cunningham wrote:
I have been trying to use rpm or dnf to remove some rpms.
I'd use dnf. It provides a much wider safety net.
I have always assumed that using rpm -e will mess up dnf. so I never use rpm for any operation that modifies the system. I think I shot off a foot a decade or so ago doing that.
It won't mess up dnf. dnf uses the rpm database, so it will know that the package isn't there. However, you won't have any history to track that you made the change. And if you force a removal, then dnf will likely be unhappy about missing dependencies at some point in the future.