[MAQeia] Software / package management hints

Here you'll find the "Mostly Asked Questions" about Mageia.

Before getting to support forum, have a look here... there are great chances that MAQeia can help...

[MAQeia] Software / package management hints

Postby doktor5000 » Jan 17th, '13, 23:58

For software management under Mageia in general please have a look at the documentation:
Documentation about software management in Mageia wiki
Documentation about software management for beginners in Mageia wiki
Documentation about software management in Mageia Control Center (aka MCC)


Other useful commands related to package management, in no particular order:

List history of installed packages since the installation of Mageia:
Code: Select all
rpm -qa --last


A more fine-grained history (for all packages since Mageia installation) including which program triggered installation/removal can be seen with the following command run as root (or grant your user journalctl permissions, just add your user to the systemd-journal group)
Code: Select all
journalctl -a --no-pager | grep -F "[RPM]"


same as above, but limited to all packages installation/removal since the last two boots:
Code: Select all
journalctl -a -b-2 --no-pager | grep -F "[RPM]"


To list active repos:
Code: Select all
urpmq --list-media active

To list all configured repos including disabled repos:
Code: Select all
urpmq --list-media

To list all configured repos and their URLs:
Code: Select all
urpmq --dump

or
Code: Select all
urpmq --list-url


Those can also be combined:
Code: Select all
urpmq --list-media active --list-url


If instead of an URL you see something about mirrorlist, the following command will show the first 5 mirrors it will try (sorting ascending by geological proximity)
Code: Select all
grep url /var/cache/urpmi/mirrors.cache | head -5

Mirrorlist is a mechanism which takes a list of all available Mageia mirrors (which can be seen at http://mirrors.mageia.org/ ) and, using geolocation, tries to automatically choose those mirrors first which are near you current location and give the fastest reponses. This may not work always that well, as some mirrors sync not that often.

To enable media (e.g. nonfree&tained _release and _updates repos) use urpmi.update --no-ignore followed by urpmi.update -a. All in one:
Code: Select all
urpmi.update --no-ignore "Tainted Release" && urpmi.update --no-ignore "Tainted Updates" && urpmi.update --no-ignore "Nonfree Release" && urpmi.update --no-ignore "Nonfree Updates" && urpmi.update -av


To query the URL on mirror for a given package name, use
Code: Select all
urpmq --sources packagename


To search in package names, and ignore case sensitivity (urpmi does respect case by default) use
Code: Select all
urpmf -i --name packagename


To configure your repos from one particular mirror and not use mirrorlist, use the following commands to remove all repositories and add a complete set of repositories from one specific mirror (in the example ftp.nluug.nl is used )
Code: Select all
urpmi.removemedia -a
urpmi.addmedia --distrib 'ftp://ftp.nluug.nl/pub/os/Linux/distr/mageia/distrib/$VERSION/$ARCH'


To show all packages, which are currently installed but not available from the currently configured repositories (good way to show 3rd party packages or libaries/packages that don't exist anymore, e.g. after a distro version upgrade
Code: Select all
urpmq --not-available


To check dependencies of all installed packages (similar to yum check command)
Code: Select all
rpm -Va --nodigest --nofiles --noscripts --nosignature --nolinkto --nofiledigest --nosize --nouser --nogroup --nomtime --nomode --nordev


To download all installed packages (or all packages from a textfile, but they must be currently installed - simply replace /var/log/rpmpkgs with the path to that file)
Code: Select all
for pkg in $(cat /var/log/rpmpkgs | sed 's/.rpm$//'); do urpmi --replacepkgs --no-install ${pkg};done


To download packages from a list, which are not currently isntalled
Code: Select all
for pkg in $(cat file_with_rpm_filenames | sed 's/.rpm$//'); do urpmi --download-all --force --no-install ${pkg};done

check viewtopic.php?f=7&t=6901 for more information about this.


To search for a package name or part of a package name, and to show the full name and version for the packages in the results and in which repository those packages are contained
Code: Select all
urpmf -f --name -m part_of_packagename


Tell urpmi to be verbose, useful in case of package installation/update errors to see the underlying dependency solver and why it really fails or does not what you expect it to do
Code: Select all
urpmi --debug


To debug circular dependencies, since Mageia 4 there is a new option to help with that:
Code: Select all
urpmi --deploops


To simply mark all orphaned packages as manually installed, one can use e.g.
Code: Select all
urpmi $(urpmq --auto-orphans)

WARNING: This is only listed here for completeness' sake, see https://wiki.mageia.org/en/Removing_packages for more details regarding orphans, context information and also a tool for orphan management

To install all required packages to build a given src.rpm one can also use urpmi (also on remote packages, as rpm can do it too)
Code: Select all
urpmi --buildrequires http://ftp.nluug.nl/pub/os/Linux/distr/mageia/distrib/cauldron/SRPMS/core/release/2mandvd-1.8.4-6.mga4.src.rpm


To print the full URL to any given packages
Code: Select all
urpmi --sources packagename


To skip any packages during updates/installation
Code: Select all
urpmi --skip packagename



To skip packages permanently, add them into /etc/urpmi/skip.list - for more details see also man urpmi.files


Also see
Code: Select all
man urpmihowto
and https://wiki.mageia.org/en/URPMI for more information or ask here, information will be added when requested as necessary.
Last edited by doktor5000 on Aug 26th, '14, 22:12, edited 11 times in total.
Reason: added explanations, added commands, completed, added check and download commands, added some more
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package managment hints

Postby eor2004 » Jan 26th, '14, 01:10

Thank you Doc for the wiki link, I have read it and installed "qt4urpm" tool, that tool is one marvelous tool to manage the orphaned packages, very easy, congratulations to the creators of "qt4urpm" for one of the most useful tools available for mageia! :D
Mageia 3 64-bit KDE
Gigabyte G41M-ES2L--> 3GB Ram
Intel Pentium Dual Core 2.60Ghz
Western Digital 500GB HDD--> XFS Filesystem
eor2004
 
Posts: 32
Joined: Jun 16th, '11, 20:10
Location: Puerto Rico

Re: [MAQeia] Software / package managment hints

Postby doktor5000 » Jan 26th, '14, 01:39

Why do you need to "manage" the orphans at all?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package managment hints

Postby eor2004 » Jan 28th, '14, 06:37

I just used the "qt4urpm" tool to mark all the orphaned packages as "not orphaned" because I didn't wanted anymore to be prompted everytime I install or remove programs to remove the orphaned packages!

Doc, now that you ask why I need to manage the orphaned packages, from the system stability point of view, it is wrong to mark the orphaned packages as not orphaned???
Mageia 3 64-bit KDE
Gigabyte G41M-ES2L--> 3GB Ram
Intel Pentium Dual Core 2.60Ghz
Western Digital 500GB HDD--> XFS Filesystem
eor2004
 
Posts: 32
Joined: Jun 16th, '11, 20:10
Location: Puerto Rico

Re: [MAQeia] Software / package managment hints

Postby doktor5000 » Jan 28th, '14, 12:47

System stability doesn't care about orphans.

And marking orphans un-orphaned can be done with one command, no need to click through all packages:
Code: Select all
urpmi $(urpmq --auto-orphans)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby theoldrailroader » Oct 6th, '14, 21:00

Hint me this if you would please. Now that I've learned to install programs correctly... When complete, I receive the "you may want to delete" message, also (and I assume, obviously) and am wondering if there is a reason to NOT remove the orphans and if no harm is done, what app would make this a simple process?
theoldrailroader
 
Posts: 8
Joined: Oct 4th, '14, 05:04

Re: [MAQeia] Software / package management hints

Postby doktor5000 » Oct 6th, '14, 21:19

Yep, mentioned shorty in bright red:
doktor5000 wrote:WARNING: This is only listed here for completeness' sake, see https://wiki.mageia.org/en/Removing_packages for more details regarding orphans, context information and also a tool for orphan management
Please do read that wiki page, and simply ignore the message about orphans.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby theoldrailroader » Oct 6th, '14, 21:48

Hey, man... I just wanted to drain the swamp and now I'm up to my butt in aligators! I'm not trying to wimp out here when I ask a dumb question because I've stared at the screen for a while looking for answers. It just seems I'm almost always looking somewhere else. I am not familiar with a lot of the resources available so your finger point (as above) really helps with my frustration level. I appreciate your responses. I've had lots of terse answers from people I will probably test your resolve more. I don't plan on staying ignorant forever... Again, Thank You!
theoldrailroader
 
Posts: 8
Joined: Oct 4th, '14, 05:04

Re: [MAQeia] Software / package management hints

Postby doktor5000 » Oct 6th, '14, 22:30

Hope I understood your answer correctly, it helped a bit? :)

In any case, if you want more explanations, or if you have more open questions, do not hesitate to ask.
I actually appreciate it more when people ask beforehand, instead of only asking when they created some problems themselves somehow ...
The former is usually much shorter to solve, compared to the latter - which sometimes takes several pages of a forum thread to sort out :|
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby benmc » Oct 14th, '23, 06:13

If you want to check that a package is installed you could try the below.
Operation is very similar to MCC package search.

It combines both rpm -q and urpmf -i commands.

Gives a list of possible matches if the rpm is not installed.

copy to a file of some name and make executable.

-------------------------------------------------------------------------------------------

Code: Select all
#!/bin/bash

while true ; do
echo
    # user inputs query here, exact match is not required.

read -p "Check to see if this rpm is installed: " request
   
    # the "rpm -q $rpm" part checks that there is an rpm from the user input, the "grep ... " part cleans the output up a bit.
rpmin=$(rpm -q $request)
#
rpm -q $request > rpmin1
rpmout=$( grep "is not installed" "rpmin1" )

    echo
        # check that there is an actual rpm as queried.
    if [[ $rpmin == $rpmout ]]
    then
         # if there is not a match, then list available rpms with the query as a search term.
        # can give a very large output if the query is not specific!
        echo -e "\t $rpmin " ; rm -f rpmin1 ; echo
       echo -e "\t possible matches available to install:" ; echo ;
      urpmf -i --name $request | sort  -u & disown -ah ;
     wait
    else
       
       echo -e "\t $rpmin is installed" ; rm -f rpmin1
fi
done

# to quit "ctrl+x"

-------------------------------------------
edit: added "sort" function

edit: rewrite
Last edited by benmc on Oct 15th, '23, 03:09, edited 4 times in total.
benmc
 
Posts: 1173
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand

Re: [MAQeia] Software / package management hints

Postby doktor5000 » Oct 14th, '23, 15:35

Thanks for sharing.
Although it looks a bit overly complicated. That whole script could be put in a few lines .bashrc function IMHO.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby benmc » Oct 14th, '23, 22:03

still learning ;)
Last edited by doktor5000 on Oct 14th, '23, 23:30, edited 1 time in total.
Reason: removed fullquote
benmc
 
Posts: 1173
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand

Re: [MAQeia] Software / package management hints

Postby doktor5000 » Oct 14th, '23, 23:40

This is what I'd do, would also work for multiple packages:
Code: Select all
function is_installed () {
        packages=$(rpm -qa|sort)
        for pkg in ${@}; do
          if ! echo "$packages" | grep -qi ${pkg}; then
                echo "${pkg} not found in installed packages, searching in enabled repositories"
                urpmf -i -f --name ${pkg}
          else
                echo "${pkg} found in installed packages"
                rpm -qa | sort | grep -i ${pkg}
          fi
        done
}


This is what it looks like:

Code: Select all
[doktor5000@Mageia9]─[23:38:38]─[~] is_installed bash systemd-tests
bash found in installed packages
bash-5.2.15-2.mga9
bash-completion-2.11-2.mga9
systemd-tests not found in installed packages, searching in enabled repositories
systemd-tests-253.7-1.mga9.x86_64
systemd-tests-253.10-1.mga9.x86_64
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby morgano » Oct 15th, '23, 00:04

Wonderful :)
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1301
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: [MAQeia] Software / package management hints

Postby benmc » Oct 15th, '23, 03:25

slightly different outputs:

Code: Select all
$ ./rpmcheck

Check to see if this rpm is installed: carl

         package carl is not installed
         possible matches available to install:

carla
carla-devel
carla-vst
golang-github-rwcarlsen-goexif
golang-github-rwcarlsen-goexif-devel
google-crosextra-carlito-fonts
root-montecarlo-eg
root-montecarlo-pythia8

Check to see if this rpm is installed: ^C
$ is_installed carl
carl found in installed packages
google-crosextra-carlito-fonts-1.103-0.1.20130920.8.mga9


As always, Linux allows more than one way :)
Also, I was looking for a way to find a needed package for another script, based on what it does, rather than a name, but a name would give a hint.
Vital information, but you were not to know this. ;)

I just used "carl" as an example, I wasn't looking for a package with "carl" in it at the time.
thanks for your input, hopefully I have learned something - yes!
benmc
 
Posts: 1173
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand

Re: [MAQeia] Software / package management hints

Postby doktor5000 » Oct 15th, '23, 15:08

Well how the output looks is just text strings which is arbitrary and can be adjusted to your liking ;)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17603
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [MAQeia] Software / package management hints

Postby benmc » Oct 15th, '23, 21:28

a better example would have been:

I am looking for an application to write to a usb. I don't know the name of the application, just know what it does: writes to a usb.

response from is_installed:

Code: Select all
$ is_installed usbwriter usb writer
usbwriter not found in installed packages, searching in enabled repositories
usb found in installed packages
lib64gusb2-0.4.5-1.mga9
lib64usb1.0_0-1.0.26-1.mga9
lib64usb-compat0.1_4-0.1.5-11.mga9
lib64usbmuxd2.0_6-2.0.2-2.mga9
usb_modeswitch-2.6.1-2.mga9
usb_modeswitch-data-20191128-3.mga9
usbutils-015-1.mga9
writer found in installed packages
libreoffice-writer-7.5.6.2-1.mga9
x11-font-bh-lucidatypewriter-75dpi-1.0.3-10.mga9


admittedly I would have to run 3 times in rpmcheck: usb, usbwriter, and writer, but one useful check would return:

Code: Select all
$ ./rpmcheck

Check to see if this rpm is installed: writer

         package writer is not installed

         possible matches available to install:

bitmap-lucida-typewriter-fonts
cellwriter
flash-imagewriter
focuswriter
ghostwriter
gnome-multi-writer
golang-github-olekukonko-tablewriter
golang-github-olekukonko-tablewriter-devel
ibus-table-mathwriter
isoimagewriter
jboss-classfilewriter
jboss-classfilewriter-javadoc
lib64opencolladastreamwriter1.6
libreoffice-writer
mathjax-typewriter-fonts
mediawriter
perl-Excel-Writer-XLSX
perl-RTF-Writer
perl-XML-Handler-YAWriter
perl-XML-MinWriter
perl-XML-SAX-Writer
perl-XML-Writer
perl-XML-Writer-Simple
php-xmlwriter
python3-xlsxwriter
stylewriter
x11-font-bh-lucidatypewriter-100dpi
x11-font-bh-lucidatypewriter-75dpi

scrolling through that last list:

flash-imagewriter
gnome-multi-writer
isoimagewriter
mediawriter

all look like good candidates for a USB writer.

ps. I did not know about isoimagewriter - it is new to me.
benmc
 
Posts: 1173
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand


Return to MAQeia

Who is online

Users browsing this forum: No registered users and 1 guest