Page 4 of 14 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 132

Thread: HowTo: Create a list of installed packages

  1. #31
    Join Date
    Apr 2006
    Location
    Coventry
    Beans
    1,379
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HowTo: Create a list of installed packages

    My question:

    I have installed programs through apt, as deb packages and used checkinstall. So all my programs are listed in synaptic and when I create the list using the original command.

    However, what I would like to know is when I try to re-install everything will the programs that are NOT in the official repos install? What will happen say for the program avast4workstation? It is listed in the dpkg list but I downloaded it as a separate .deb file from avast.

    Thanks in advance!

  2. #32
    Join Date
    Mar 2008
    Beans
    4,714
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HowTo: Create a list of installed packages

    I think the reinstall would fail because dpkg would not know where the .deb files are (checkinstall just puts the .debs it creates in the current working directory, no place special where dpkg would find it. `dpkg -i` only installs the deb; it does not copy the deb to /var/cache/apt/archives as far as I know.)

    However, I could be wrong, and there is an easy way for you to discover the answer. (Please tell us when you do).

    Make a file with contents like this:

    Code:
    avast4workstation				install
    Save it as "installed-software".
    Then run

    Code:
    dpkg --set-selections < installed-software
    dselect
    Last edited by unutbu; June 10th, 2008 at 09:36 PM.

  3. #33
    Join Date
    Apr 2006
    Location
    Coventry
    Beans
    1,379
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HowTo: Create a list of installed packages

    Just to test i uninstalled avast, and brasero.

    I then added the following to the file "installed-software":

    Code:
    avast4workstation				install
    brasero               				install
    I then ran dpkg, and dselect (with sudo).

    When it opened up the prompt for dselect I choose 3 (install and upgrade wanted packages).

    The following was the output (neither brasero NOR avast installed):

    Code:
    abhiroop@Vanimo:~$ sudo dpkg --set-selections < installed-software
    abhiroop@Vanimo:~$ sudo dselect
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      nvidia-glx* virtualbox-ose-modules-2.6.22-14-generic*
    The following NEW packages will be installed:
      brasero
    0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
    Need to get 1363kB of archives.
    After unpacking 5181kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://archive.ubuntu.com gutsy-backports/main brasero 0.7.1-1~gutsy1 [1363kB]
    Fetched 1363kB in 16s (82.8kB/s)                                               
    (Reading database ... 134148 files and directories currently installed.)
    Removing nvidia-glx ...
    Purging configuration files for nvidia-glx ...
    dpkg-divert: mismatch on package
      when removing `diversion of /usr/lib/libGL.so.1 to /usr/lib/nvidia/libGL.so.1.xlibmesa by nvidia-glx'
      found `diversion of /usr/lib/libGL.so.1 to /usr/lib/nvidia/libGL.so.1.xlibmesa by nvidia-glx-new'
    dpkg: error processing nvidia-glx (--purge):
     subprocess post-removal script returned error exit status 2
    Removing virtualbox-ose-modules-2.6.22-14-generic ...
    Purging configuration files for virtualbox-ose-modules-2.6.22-14-generic ...
    update-rc.d: /etc/init.d/vboxdrv exists during rc.d purge (use -f to force)
    dpkg: error processing virtualbox-ose-modules-2.6.22-14-generic (--purge):
     subprocess post-removal script returned error exit status 1
    Errors were encountered while processing:
     nvidia-glx
     virtualbox-ose-modules-2.6.22-14-generic
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Some errors occurred while unpacking. I'm going to configure the
    packages that were installed. This may result in duplicate errors
    or errors caused by missing dependencies. This is OK, only the errors
    above this message are important. Please fix them and run [I]nstall again
    Press enter to continue.
    It seems nvidia-glx, and virtualbox are giving problems. But I don't know what to do. I use nvidia-glx-new (I think), and NOT the OSE version of virtualbox. Whats happening?

  4. #34
    Join Date
    Mar 2008
    Beans
    4,714
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HowTo: Create a list of installed packages

    Let's try to fix things:

    Code:
    sudo apt-get update        # update the list of packages available
    sudo apt-get -f install    # correct broken dependencies
    
    sudo apt-get install nvidia-glx-new   # try to reinstall nvidia-glx-new 
    sudo apt-get install brasero   
    sudo apt-get purge virtualbox-ose-modules-2.6.22-14-generic
    avast4workstation is not in the official repos, so you'll need the deb to reinstall this on.

  5. #35
    Join Date
    Apr 2006
    Location
    Coventry
    Beans
    1,379
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HowTo: Create a list of installed packages

    All that worked, but it didn't take away the problem of using dselect. I think there is stills some prooblem with the two packages. So I deleted them and completely re-installed it all. Now it seems to ok. Anyway I guess to install packages not in repos you can take a look at something I discovered:

    http://ubuntuforums.org/showthread.php?t=819396

  6. #36
    Join Date
    Oct 2007
    Location
    NY, NY
    Beans
    77
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: HowTo: Create a list of installed packages

    how about just "apt-show-versions" ?
    HP Pavilion dv6700t
    Ubuntu 12.04/Unity

  7. #37
    Join Date
    Sep 2006
    Beans
    Hidden!

    Re: HowTo: Create a list of installed packages

    The output file is formatted with package try per line, so manipulating the file is easy. Once you have the files from the initial and current states, you can run a text-file comparison between the two files to determine which lines are different. Alternately, you can import them into a simply database and run standard SQL queries to identify the new files. If you need to make these changes often then you might want to keep an updated database. SQLite might work well for this as you can store it anywhere. You can simply take the extra package names and append them to the "sudo apt-get remove [packageName1] [packageName2]" command. You may also want to run "sudo apt-get autoremove" afterward to remove the orphans that were previously installed as dependencies.

    UPDATE: Sorry, this was in response to post number 10, but that was really old.
    Last edited by jnk0906; July 26th, 2008 at 02:19 AM.

  8. #38
    Join Date
    Nov 2006
    Location
    North Carolina
    Beans
    26
    Distro
    Ubuntu Development Release

    Re: HowTo: Create a list of installed packages

    I've written a small script that I run to record my installed packages. Hopefully someone else will find it useful as well.

    It only outputs the core packages, not their dependencies. I believe this is important as dependencies may change between distributions, and you don't want to be installing unnecessary packages.

    The script uses deborphan and will automatically install it if you so desire

    Bonus: I have this executing in my ~/.gnomerc file and outputting to a file in my homedir, so I always have an up-to-date list of packages every time my machine boots up. I'd rather have it record them on logout, however I don't want it placed in an init.d script or GDM (I want something user-specific). If anyone else knows how to get gnome to execute a script on logout, please share!

    The core command my script uses is:
    Code:
    deborphan --all-packages --no-show-section | egrep --invert-match "linux-.*|.*ubuntu-(server|desktop|minimal|standard)"
    The only downfall is it doesn't seem to list packages installed from 3rd party repositories (I have wine installed and it does not output the wine package on my system). Not sure why this is and I'd love to have it show these packages too...

    And here is the whole script:
    Code:
    #!/bin/bash
    # record manually-installed packages using deborphan
    # (will install deborphan using aptitude if not installed)
    #
    # by Zach [xak .:at:. xak.us]
    
    
    QUIET=no
    if [ "$1" == "-y" ]; then
      QUIET=yes
    elif [ "$1" == "--help" ]; then
      echo "Usage: $0 [-y]"
      echo "-y indicates quiet and auto-install deborphan if necessary"
      echo ""
      echo "Prints installed debian packages, excluding their depenencies and base system packages"
      exit -1
    fi
    
    
    if [ `which deborphan >/dev/null 2>&1 ; echo $?` == 0 ]; then
      deborphan --all-packages --no-show-section | egrep --invert-match "linux-.*|.*ubuntu-(server|desktop|minimal|standard)"
    
    else
      if [ $QUIET == "no" ]; then
        echo -n "deborphan not installed.  install now?  (yes/no) "
        read q
      fi
        if [ $QUIET == "yes" ] || [ "$q" == "y" ] || [ "$q" == "Y" ] || [ "$q" == "yes" ] || [ "$q" == "Yes" ] || [ "$q" == "YES" ]; then
          if [ $QUIET == "no" ]; then echo "" && echo "installing..."; fi
          sudo aptitude install deborphan >/dev/null 2>&1
          if [ $? == 1 ]; then
            if [ $QUIET == "no" ]; then echo "install failed!"; fi
            exit 2
          else
            if [ $QUIET == "no" ]; then echo "install succeeded"; fi
            $0
          fi
      else
        echo "cannot proceed without deborphan"
        exit 1
      fi
    fi
    Cheers!

    Last edited by xak; October 15th, 2008 at 07:23 PM. Reason: updated script syntax
    Lenovo ThinkPad W520 | Mint 14 MATE x86_64
    Core i7 i7-2860QM - 20GB DDR3 1333MHz - Quadro 2000M - Samsung 830 256GB SSD - Hitachi 500GB HDD

    Google Cr-48 | Mint 15 XFCE & Chrome OS (GPT + GRUB2)
    Insyde BIOS - 4GB DDR3 - 40GB Intel SSD

  9. #39
    Join Date
    Oct 2007
    Location
    Taipei 台北
    Beans
    59

    Re: HowTo: Create a list of installed packages

    Hey xak,

    Thanks for the script. However, I think there may be a flaw in the logic here. See below.

    First, I think your main command should look like this:

    Code:
    deborphan --all-packages --no-show-section --nice-mode | egrep -v "linux-.*|.*ubuntu-(server|desktop|minimal|standard)" | sort
    1) standard practice is to use long-form options in scripts ('cos short-forms may be subject to change in the future)

    2) adding --no-show-section removes the need for the pipe to awk (and the sort should go after the awk, but that doesn't matter if you do it this way)

    3) you need parentheses "()" not brackets "[]" around 'server|desktop|..." etc. Using brackets in a regexp is interpreted as a character class, with the result that any of the characters inside are matched once and once only (including the pipe). The problem here is that it means that your regexp matches, e.g., 'ubuntu-restricted-extras', which is not a default package and so should not be excluded from this list, if I understand the logic).

    try adding --color=auto to see what I mean
    Code:
    deborphan -a | egrep --color=auto ".*ubuntu-[server|desktop|minimal|standard]"
    Code:
    deborphan -a | egrep --color=auto ".*ubuntu-(server|desktop|minimal|standard)"
    4) The reason why wine doesn't show up on your list is not because it's from a third-party repository. Deborphan will not report a package if you have another installed which depends on it, but, by default, it will also pass over a package if you have another installed which merely 'suggests' or 'recommends' it. (In the case of wine, it is 'suggested' by gnome-volume-manager. Go figure!). You should disable this feature of deborphan (using --nice-mode).

    However, there is still a problem here: circular dependencies. Some packages depend on each other, and will therefore not make it onto this list using deborphan, no matter what you do. A quick example: I mainly use Gnome-based Ubuntu, but I usually install Amarok. The package amarok depends on amarok-xine, and amarok-xine depends on amarok, so it won't appear on this list. Thunderbird is another example from my system.

    So although I thinks it's a smart idea to use deborphan in this way, I would urge caution.

    Oh - and to execute a script on Gnome logout, call it from /etc/gdm/PostSession/Default.

    Hope that helps - thanks for the idea!

    Simon

  10. #40
    Join Date
    Nov 2006
    Location
    North Carolina
    Beans
    26
    Distro
    Ubuntu Development Release

    Re: HowTo: Create a list of installed packages

    Quote Originally Posted by simon_w View Post
    1) standard practice is to use long-form options in scripts ('cos short-forms may be subject to change in the future)

    2) adding --no-show-section removes the need for the pipe to awk (and the sort should go after the awk, but that doesn't matter if you do it this way)
    I agree on long-form parameter names. The sort was to sort the list by package types, not on package names. I am a bit quirky sometimes in how I do things, but this was intentional

    Quote Originally Posted by simon_w View Post
    3) you need parentheses "()" not brackets "[]" around 'server|desktop|..." etc. Using brackets in a regexp is interpreted as a character class, with the result that any of the characters inside are matched once and once only (including the pipe). The problem here is that it means that your regexp matches, e.g., 'ubuntu-restricted-extras', which is not a default package and so should not be excluded from this list, if I understand the logic).
    Good catch here as well! I will update the script.

    Quote Originally Posted by simon_w View Post
    4) The reason why wine doesn't show up on your list is not because it's from a third-party repository. Deborphan will not report a package if you have another installed which depends on it, but, by default, it will also pass over a package if you have another installed which merely 'suggests' or 'recommends' it. (In the case of wine, it is 'suggested' by gnome-volume-manager. Go figure!). You should disable this feature of deborphan (using --nice-mode).

    However, there is still a problem here: circular dependencies. Some packages depend on each other, and will therefore not make it onto this list using deborphan, no matter what you do. A quick example: I mainly use Gnome-based Ubuntu, but I usually install Amarok. The package amarok depends on amarok-xine, and amarok-xine depends on amarok, so it won't appear on this list. Thunderbird is another example from my system.

    So although I thinks it's a smart idea to use deborphan in this way, I would urge caution.
    Well this just means my goal is set back a little. There must be a way to accomplish creating this list of packages. Any other ideas? Do you think the best way might be to diff the full installed-package list against a default distro package installation list? What about dependencies?


    Quote Originally Posted by simon_w View Post
    Oh - and to execute a script on Gnome logout, call it from /etc/gdm/PostSession/Default.
    I'm aware of this as well, but I wanted a user-specific way of accomplishing this, like ~/.gnomerc, without modifying the system. The best ideas I have come up with so far are a script launched by .gnomerc or a session which waits for the gnome processes to die (very ugly approach), or sourcing a user's file such as ~/.gnome-logout from PostSession/Default (but this requires system modification).


    Thanks a bunch for your comments and suggestions!
    Last edited by xak; October 15th, 2008 at 07:22 PM.
    Lenovo ThinkPad W520 | Mint 14 MATE x86_64
    Core i7 i7-2860QM - 20GB DDR3 1333MHz - Quadro 2000M - Samsung 830 256GB SSD - Hitachi 500GB HDD

    Google Cr-48 | Mint 15 XFCE & Chrome OS (GPT + GRUB2)
    Insyde BIOS - 4GB DDR3 - 40GB Intel SSD

Page 4 of 14 FirstFirst ... 23456 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •