Category Archives: Patch Management

How to remove product channels in Suse Manager

Quick post about how to remove the products channels in Suse Manager

Delete channels in Suse Manager

There is a way you can add products and their channels in the Suse Manager server using the command line and webpage GUI. But once added it’s not easy to get them removed from the web console. Web console does not provide a direct option to remove product channels from Suse Manager. Also, the command used for adding channel i.e.. mgr-sync also does not support any option to remove channels.

So many of first time Suse Manager administrators stumble upon roadblock on how to remove product channels which are no more needed.

So let’s get started on the process to remove product channels (using command spacewalk-remove-channel) you might have added by mistake on Suse Manager or which are no longer needed and eating up your disk space.

First, you need to list out all the channels on your Suse Manager using mgr-sync list command –

root@kerneltalks # mgr-sync list channels
Available Channels:


Status:
  - [I] - channel is installed
  - [ ] - channel is not installed, but is available
  - [U] - channel is unavailable

[ ] RHEL6-Pool for x86_64 RHEL6 Base x86_64 [rhel6-pool-x86_64]
[I] SLE-Product-HPC-15-Pool for x86_64 SUSE Linux Enterprise High Performance Computing 15 x86_64 [sle-product-hpc-15-pool-x86_64]
    [ ] SLE-Module-Basesystem15-Debuginfo-Pool for x86_64 Basesystem Module 15 x86_64 [sle-module-basesystem15-debuginfo-pool-x86_64-hpc]
    [ ] SLE-Module-Basesystem15-Debuginfo-Updates for x86_64 Basesystem Module 15 x86_64 [sle-module-basesystem15-debuginfo-updates-x86_64-hpc]
    [I] SLE-Module-Basesystem15-Pool for x86_64 Basesystem Module 15 x86_64 [sle-module-basesystem15-pool-x86_64-hpc]
    [I] SLE-Module-Basesystem15-Updates for x86_64 Basesystem Module 15 x86_64 [sle-module-basesystem15-updates-x86_64-hpc]
...

Here let’s consider we need to remove channel sle-product-hpc-15-pool-x86_64. So first you need to remove all the child channels from this base product channel & then you will be able to remove the base channel. If you try to remove parent channel directly without removing child channels you will hit below error –

root@kerneltalks # spacewalk-remove-channel -c  sle-product-hpc-15-pool-x86_64
Error: cannot remove channel sle-product-hpc-15-pool-x86_64: subchannel(s) exist:
                        sle-module-basesystem15-pool-x86_64-hpc
                        sle-module-basesystem15-updates-x86_64-hpc
                        sle-module-devtools15-pool-x86_64-hpc
....                       

You can clearly see child channels to be removed before you try for parent channel. This is also a good way to get a child channel list quickly!

Then go ahead, remove the child channel followed by base one. For example, see below child channel removal output –

root@kerneltalks #  spacewalk-remove-channel -c sle-module-devtools15-pool-x86_64-hpc
Deleting package metadata (204):
                  ________________________________________
Removing:         ######################################## - complete

Repeat the process and remove all child channels one by one. You can use shell loops to get it done quicker. Finally, remove your parent channel, and you are done.

root@kerneltalks #  spacewalk-remove-channel -c sle-product-hpc-15-pool-x86_64
Deleting package metadata (3):
                  ________________________________________
Removing:         ######################################## - complete

Once done you can confirm that channel is no more enabled in webpage console or using mgr-sync list command.

Boot SUSE Linux from old kernel after kernel upgrade

How to guide to boot Suse Linux from old kernel after kernel upgrade. 

Boot Suse Linux from old kernel after kernel upgrade

This article is basically a how-to guide for booting SUSE Linux system from the previous kernel after the kernel upgrade process. Normally, Linux like Red Hat has the option to just change boot priority of kernel in /etc/grub.conf and reboot into the kernel of your choice. But in SUSE Linux, we do not have that option. Now the question is how to boot into old kernel once I upgrade the kernel.

You can boot into the older kernel by using the below method. I explained kernel upgrade first and then how to uninstall update to boot from the older kernel. This is a kind of rollback kernel upgrade in SUSE Linux.

1. Upgrade kernel in Suse Linux

The first thing you want to check and confirm that if your SUSE supports multiversion or not.  Go to /etc/zypp/zypp.conf and make sure the below-mentioned line is not commented on. If there is # at the beginning of it, remove it.

multiversion = provides:multiversion(kernel)

There are many ways to maintain how many old kernel versions can be maintained by the system. We won’t be going through it. You can find more details about it here.

Once you are confirmed, multiversion is active then go ahead with kernel upgrade. If it’s not activated, zypper will auto-delete old kernel and you won’t be able to use it.

Check current kernel version

root@kerneltalks # uname -a
Linux kerneltalks 4.4.114-94.11-default #1 SMP Thu Feb 1 19:28:26 UTC 2018 (4309ff9) x86_64 x86_64 x86_64 GNU/Linux

Install the new kernel version using zypper.  Make sure you are installing the new kernel and not updating your current one.

root@kerneltalks # zypper in kernel-default
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
Refreshing service 'cloud_update'.
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 5 NEW packages are going to be installed:
  crash-kmp-default crda kernel-default-4.4.120-94.17.1 kernel-firmware
  wireless-regdb

5 new packages to install.
Overall download size: 81.3 MiB. Already cached: 0 B. After the operation,
additional 358.3 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package kernel-default-4.4.120-94.17.1.x86_64
                                           (1/5),  38.6 MiB (167.2 MiB unpacked)
Retrieving: kernel-default-4.4.120-94.17.1.x86_64.rpm ........[done (7.1 MiB/s)]
Retrieving package kernel-firmware-20170530-21.19.1.noarch
                                           (2/5),  42.5 MiB (191.1 MiB unpacked)
Retrieving: kernel-firmware-20170530-21.19.1.noarch.rpm .....[done (18.2 MiB/s)]
Retrieving package wireless-regdb-2017.12.23-4.3.1.noarch
                                           (3/5),  14.1 KiB ( 13.0 KiB unpacked)
Retrieving: wireless-regdb-2017.12.23-4.3.1.noarch.rpm ...................[done]
Retrieving package crash-kmp-default-7.1.8_k4.4.92_6.30-4.6.2.x86_64
                                           (4/5), 116.8 KiB (  7.8 KiB unpacked)
Retrieving: crash-kmp-default-7.1.8_k4.4.92_6.30-4.6.2.x86_64.rpm ........[done]
Retrieving package crda-1.1.3-4.2.1.x86_64 (5/5),  14.4 KiB ( 34.5 KiB unpacked)
Retrieving: crda-1.1.3-4.2.1.x86_64.rpm ..................................[done]
Checking for file conflicts: .............................................[done]
(1/5) Installing: kernel-default-4.4.120-94.17.1.x86_64 ..................[done]
Additional rpm output:
Creating initrd: /boot/initrd-4.4.120-94.17-default
dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force                                                                                         /boot/initrd-4.4.120-94.17-default 4.4.120-94.17-default
dracut: dracut module 'btrfs' will not be installed, because command 'btrfs' cou                                                                                        ld not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' c                                                                                        ould not be found!
dracut: dracut module 'mdraid' will not be installed, because command 'mdadm' co                                                                                        uld not be found!
dracut: dracut module 'btrfs' will not be installed, because command 'btrfs' cou                                                                                        ld not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' c                                                                                        ould not be found!
dracut: dracut module 'mdraid' will not be installed, because command 'mdadm' co                                                                                        uld not be found!
dracut: *** Including module: bash ***
dracut: *** Including module: systemd ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: i18n ***
dracut: No KEYMAP configured.
dracut: *** Including module: xen-tools-domU ***
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: suse-xfs ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: *** Including module: dracut-systemd ***
dracut: *** Including module: haveged ***
dracut: *** Including module: usrmount ***
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including module: shutdown ***
dracut: *** Including module: suse ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies and firmware ***
dracut: *** Installing kernel module dependencies and firmware done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done***
dracut: *** Hardlinking files ***
dracut: *** Hardlinking files done ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Store current command line parameters ***
dracut: Stored kernel commandline:
dracut:  root=UUID=26fa33a2-ad40-4a85-a495-402aca6a2127 rootfstype=ext4 rootflag                                                                                        s=rw,relatime,data=ordered
dracut: *** Creating image file '/boot/initrd-4.4.120-94.17-default' ***
dracut: *** Creating initramfs image file '/boot/initrd-4.4.120-94.17-default' d                                                                                        one ***


(2/5) Installing: kernel-firmware-20170530-21.19.1.noarch ................[done]
(3/5) Installing: wireless-regdb-2017.12.23-4.3.1.noarch .................[done]
(4/5) Installing: crash-kmp-default-7.1.8_k4.4.92_6.30-4.6.2.x86_64 ......[done]
(5/5) Installing: crda-1.1.3-4.2.1.x86_64 ................................[done]
Output of kernel-firmware-20170530-21.19.1.noarch.rpm %posttrans script:
    Creating initrd: /boot/initrd-4.4.114-94.11-default
    dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --f                                                                                        orce /boot/initrd-4.4.114-94.11-default 4.4.114-94.11-default
    dracut: dracut module 'btrfs' will not be installed, because command 'btrfs'                                                                                         could not be found!
    dracut: dracut module 'dmraid' will not be installed, because command 'dmrai                                                                                        d' could not be found!
    dracut: dracut module 'mdraid' will not be installed, because command 'mdadm                                                                                        ' could not be found!
    dracut: dracut module 'btrfs' will not be installed, because command 'btrfs'                                                                                         could not be found!
    dracut: dracut module 'dmraid' will not be installed, because command 'dmrai                                                                                        d' could not be found!
    dracut: dracut module 'mdraid' will not be installed, because command 'mdadm                                                                                        ' could not be found!
    dracut: *** Including module: bash ***
    dracut: *** Including module: systemd ***
    dracut: *** Including module: systemd-initrd ***
    dracut: *** Including module: i18n ***
    dracut: No KEYMAP configured.
    dracut: *** Including module: xen-tools-domU ***
    dracut: *** Including module: kernel-modules ***
    dracut: *** Including module: rootfs-block ***
    dracut: *** Including module: suse-xfs ***
    dracut: *** Including module: terminfo ***
    dracut: *** Including module: udev-rules ***
    dracut: Skipping udev rule: 40-redhat.rules
    dracut: Skipping udev rule: 50-firmware.rules
    dracut: Skipping udev rule: 50-udev.rules
    dracut: Skipping udev rule: 91-permissions.rules
    dracut: Skipping udev rule: 80-drivers-modprobe.rules
    dracut: *** Including module: dracut-systemd ***
    dracut: *** Including module: haveged ***
    dracut: *** Including module: usrmount ***
    dracut: *** Including module: base ***
    dracut: *** Including module: fs-lib ***
    dracut: *** Including module: shutdown ***
    dracut: *** Including module: suse ***
    dracut: *** Including modules done ***
    dracut: *** Installing kernel module dependencies and firmware ***
    dracut: *** Installing kernel module dependencies and firmware done ***
    dracut: *** Resolving executable dependencies ***
    dracut: *** Resolving executable dependencies done***
    dracut: *** Hardlinking files ***
    dracut: *** Hardlinking files done ***
    dracut: *** Stripping files ***
    dracut: *** Stripping files done ***
    dracut: *** Generating early-microcode cpio image ***
    dracut: *** Store current command line parameters ***
    dracut: Stored kernel commandline:
    dracut:  root=UUID=26fa33a2-ad40-4a85-a495-402aca6a2127 rootfstype=ext4 root                                                                                        flags=rw,relatime,data=ordered
    dracut: *** Creating image file '/boot/initrd-4.4.114-94.11-default' ***
    dracut: *** Creating initramfs image file '/boot/initrd-4.4.114-94.11-defaul                                                                                        t' done ***
    Creating initrd: /boot/initrd-4.4.120-94.17-default
    dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --f                                                                                        orce /boot/initrd-4.4.120-94.17-default 4.4.120-94.17-default
    dracut: dracut module 'btrfs' will not be installed, because command 'btrfs'                                                                                         could not be found!
    dracut: dracut module 'dmraid' will not be installed, because command 'dmrai                                                                                        d' could not be found!
    dracut: dracut module 'mdraid' will not be installed, because command 'mdadm                                                                                        ' could not be found!
    dracut: dracut module 'btrfs' will not be installed, because command 'btrfs'                                                                                         could not be found!
    dracut: dracut module 'dmraid' will not be installed, because command 'dmrai                                                                                        d' could not be found!
    dracut: dracut module 'mdraid' will not be installed, because command 'mdadm                                                                                        ' could not be found!
    dracut: *** Including module: bash ***
    dracut: *** Including module: systemd ***
    dracut: *** Including module: systemd-initrd ***
    dracut: *** Including module: i18n ***
    dracut: No KEYMAP configured.
    dracut: *** Including module: xen-tools-domU ***
    dracut: *** Including module: kernel-modules ***
    dracut: *** Including module: rootfs-block ***
    dracut: *** Including module: suse-xfs ***
    dracut: *** Including module: terminfo ***
    dracut: *** Including module: udev-rules ***
    dracut: Skipping udev rule: 40-redhat.rules
    dracut: Skipping udev rule: 50-firmware.rules
    dracut: Skipping udev rule: 50-udev.rules
    dracut: Skipping udev rule: 91-permissions.rules
    dracut: Skipping udev rule: 80-drivers-modprobe.rules
    dracut: *** Including module: dracut-systemd ***
    dracut: *** Including module: haveged ***
    dracut: *** Including module: usrmount ***
    dracut: *** Including module: base ***
    dracut: *** Including module: fs-lib ***
    dracut: *** Including module: shutdown ***
    dracut: *** Including module: suse ***
    dracut: *** Including modules done ***
    dracut: *** Installing kernel module dependencies and firmware ***
    dracut: *** Installing kernel module dependencies and firmware done ***
    dracut: *** Resolving executable dependencies ***
    dracut: *** Resolving executable dependencies done***
    dracut: *** Hardlinking files ***
    dracut: *** Hardlinking files done ***
    dracut: *** Stripping files ***
    dracut: *** Stripping files done ***
    dracut: *** Generating early-microcode cpio image ***
    dracut: *** Store current command line parameters ***
    dracut: Stored kernel commandline:
    dracut:  root=UUID=26fa33a2-ad40-4a85-a495-402aca6a2127 rootfstype=ext4 root                                                                                        flags=rw,relatime,data=ordered
    dracut: *** Creating image file '/boot/initrd-4.4.120-94.17-default' ***
    dracut: *** Creating initramfs image file '/boot/initrd-4.4.120-94.17-defaul                                                                                        t' done ***

Reboot system and you see your system is booted with the latest new kernel.

root@kerneltalks # uname -a
Linux kerneltalks 4.4.120-94.17-default #1 SMP Wed Mar 14 17:23:00 UTC 2018                                                                                         (cf3a7bb) x86_64 x86_64 x86_64 GNU/Linux

Now check all the installed kernel packages on your system using –

root@kerneltalks # zypper se -si 'kernel*'
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
Refreshing service 'cloud_update'.
Loading repository data...
Reading installed packages...

S  | Name            | Type    | Version          | Arch   | Repository
---+-----------------+---------+------------------+--------+-------------------
i+ | kernel-default  | package | 4.4.120-94.17.1  | x86_64 | SLES12-SP3-Updates
i+ | kernel-default  | package | 4.4.114-94.11.3  | x86_64 | SLES12-SP3-Updates
i  | kernel-firmware | package | 20170530-21.19.1 | noarch | SLES12-SP3-Updates

Here, you can see there are two kernels installed on the system. Old one is 4.4.114-94.11.3 and the new one is 4.4.120-94.17.1 from which the current system is booted.

2. Boot from the old kernel in SUSE Linux

For Suse with GRUB2

Now, if you want to boot the system from the old kernel 4.4.114-94.11.3 without un-installing new kernel then follow the below steps.

Make copy of /etc/default/grub file as a backup. and then edit it –

root@kerneltalks # cp /etc/default/grub /etc/default/grub.backup
root@kerneltalks # vi /etc/default/grub

Look for GRUB_DEFAULT=0and edit the number per old kernel menu number. Old kernel menu number can be found in /boot/grub2/grub.cfg

Open /boot/grub2/grub.cfg and look for entry menuentry You will be able to see different kernel entries in it. First being 0 and then counter goes on. Check and choose the menu number of your old kernel.

After editing /etc/default/grub file you need to re-create /boot/grub2/grub.cfg You can do it with below command –

root@kerneltalks # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.120-94.17-default
Found initrd image: /boot/initrd-4.4.120-94.17-default
Found linux image: /boot/vmlinuz-4.4.114-94.11-default
Found initrd image: /boot/initrd-4.4.114-94.11-default
done

Once done, reboot the system. That’s it. You can see your system is booted with an old kernel while your new kernel is still installed on the server.

For Suse with GRUB

Edit /boot/grub/grub.conf which is also link to /boot/grub/menu.lst . Look for parameter default 0 and change the number 0 to your desired kernel menu number.

You can see the kernel list to be displayed later in the same file. Remember, the numbering starts at 0. So countdown to your old kernel version number and use it for the default parameter.

Save the file and reboot the system. You will be booted with old kernel.

3. Rollback to old kernel in SUSE Linux

Now if you want to rollback system to the old kernel 4.4.114-94.11.3, remove this latest installed kernel 4.4.120-94.17.1. You need to give kernel name as <package_name>-<package_version>. You can get the version from the above command output. In this way, we are downgrading kernel in SUSE Linux.

root@kerneltalks # zypper rm kernel-default-4.4.120-94.17.1
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  kernel-default-4.4.120-94.17.1

1 package to remove.
After the operation, 167.2 MiB will be freed.
Continue? [y/n/...? shows all options] (y): y
(1/1) Removing kernel-default-4.4.120-94.17.1.x86_64 .............................................................................................................[done]
There are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run 'zypper ps -s' to list these programs.

Now as per warning lets check which all processes are using it.

root@kerneltalks # zypper ps -s
The following running processes use deleted files:

PID | PPID | UID | User | Command       | Service
----+------+-----+------+---------------+--------------
486 | 1    | 0   | root | systemd-udevd | systemd-udevd

You may wish to restart these processes.
See 'man zypper' for information about the meaning of values in the above table.

Lets reboot system and check kernel version.

root@kerneltalks # uname -a
Linux kerneltalks 4.4.114-94.11-default #1 SMP Thu Feb 1 19:28:26 UTC 2018 (4309ff9) x86_64 x86_64 x86_64 GNU/Linux

You can see the system is booted with your old kernel 4.4.114-94.11.3!

Now, Check installed kernel packages and you can see a newer kernel package is no more installed/active on the system.

root@kerneltalks # zypper se -si 'kernel*'
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
Refreshing service 'cloud_update'.
Loading repository data...
Reading installed packages...

S  | Name            | Type    | Version          | Arch   | Repository
---+-----------------+---------+------------------+--------+-------------------
i+ | kernel-default  | package | 4.4.114-94.11.3  | x86_64 | SLES12-SP3-Updates
i  | kernel-firmware | package | 20170530-21.19.1 | noarch | SLES12-SP3-Updates

If you have another method (command line) to boot into the older kernel then please share in the comments below.

How to configure the local APT repository

Learn how to configure the local APT repository in Debian based Linux systems. Useful article for package management on Linux.

APT repository configuration

APT is package manager that handles Debian packages (.deb). Linux distributions like Ubuntu, Debian uses APT whereas Red Hat, CentOS uses YUM. The package repository is an index of packages that can be used to search, view, install & update packages for Linux In this article, we will be walking through steps to configure the local APT repository.

APT has two types of repositories: complex and simple. We will see a simple repository configuration in this article. For example, we will be keeping two packages in our repository and configure APT to use it. If you know, you can even download packages in .deb format from existing APT repositories! We are keeping our test packages under /usr/mypackages directory. You can choose your own path.

Rest of the process consist of only 3 steps :

  1. Store packages in the designated directory
  2. Scan that directory to create an index
  3. Add index file path to /etc/apt/sources.list

Step 1 :

Store packages in directory (/usr/mypackages in our case here). I kept below two packages :

# ll /usr/mypackages
total 156
-rw-r--r--  1 root root 136892 May 17 10:19 python_2.7.11-1_amd64.deb
-rw-r--r--  1 root root  11064 May 17 10:20 python-tdb_1.3.8-2_amd64.deb

Step 2:

Scan packages directory with  command dpkg-scanpackagesThis command takes two arguments: first is a directory to scan and the second is override file. For simple repositories, we don’t need an override file so we can use /dev/null as the second argument.

If you get The program 'dpkg-scanpackages' is currently not installed. error then you need to install package dpkg-dev on your server.

# dpkg-scanpackages . /dev/null
Package: python
Source: python-defaults
Version: 2.7.11-1
Architecture: amd64
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Installed-Size: 635
Pre-Depends: python-minimal (= 2.7.11-1)
Depends: python2.7 (>= 2.7.11-1~), libpython-stdlib (= 2.7.11-1)
Suggests: python-doc (= 2.7.11-1), python-tk (>= 2.7.11-1~)
Conflicts: python-central (<< 0.5.5)
Breaks: update-manager-core (<< 0.200.5-2)
Replaces: python-dev (<< 2.6.5-2)
Provides: python-ctypes, python-email, python-importlib, python-profiler, python-wsgiref
Filename: ./python_2.7.11-1_amd64.deb
Size: 136892
MD5sum: af686bd03f39be3f3cd865d38b44f5bf
SHA1: eb433da2ec863602e32bbf5569ea4065bbc11e5c
SHA256: 5173de04244553455a287145e84535f377e20f0e28b3cec5a24c109e3fa3f088
Section: python
Priority: standard
Multi-Arch: allowed
Homepage: http://www.python.org/
Description: interactive high-level object-oriented language (default version)
 Python, the high-level, interactive object oriented language,
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.
 .
 This package is a dependency package, which depends on Debian's default
 Python version (currently v2.7).
Original-Maintainer: Matthias Klose <doko@debian.org>

Package: python-tdb
Source: tdb
Version: 1.3.8-2
Architecture: amd64
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Installed-Size: 50
Depends: libtdb1 (= 1.3.8-2), python (<< 2.8), python (>= 2.7~), python:any (>= 2.7.5-5~), libc6 (>= 2.2.5), libpython2.7 (>= 2.7)
Provides: python2.7-tdb
Filename: ./python-tdb_1.3.8-2_amd64.deb
Size: 11064
MD5sum: 05035155e6baf5700a19fb8308beeca1
SHA1: bd9ec7d2a902e6997651efeaa0842bfb4a782862
SHA256: c53fd7dae63a846cc9583c174e1def248f9def2c4208923704f964068f0a5ea5
Section: python
Priority: optional
Homepage: http://tdb.samba.org/
Description: Python bindings for TDB
 This is a simple database API. It is modelled after the structure
 of GDBM. TDB features, unlike GDBM, multiple writers support with
 appropriate locking and transactions.
 .
 This package contains the Python bindings.
Original-Maintainer: Debian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>

dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning:   python python-tdb
dpkg-scanpackages: info: Wrote 2 entries to output Packages file.

You can see in above output, dpkg-scanpackages checks all packages list their details on terminal. Since command sends output to stdout we will pipe this output with gunzip to create gz index file.

# dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning:   python python-tdb
dpkg-scanpackages: info: Wrote 2 entries to output Packages file.

# ll
-rw-r--r--  1 root root   1130 May 17 10:27 Packages.gz

Now your index file is ready to be used by APT. You need to let APT know that a new index is created and can be used as a new location to scan packages.

Recommended reads :
YUM configuration in Linux
EPEL repo config in Linux

Step 3:

Update the APT configuration file /etc/apt/sources.list with path of the newly created index file. Add below line :

deb file:/usr/mypackages ./

Thats it! Its done. Run apt update to pickup this new repo.

# apt update
Get:1 file:/usr/mypackages ./ InRelease
Ign:1 file:/usr/mypackages ./ InRelease
Get:2 file:/usr/mypackages ./ Release
Err:2 file:/usr/mypackages ./ Release
  File not found - /usr/mypackages/./Release (2: No such file or directory)
Hit:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [265 kB]
Reading package lists... Done
E: The repository 'file:/usr/mypackages ./ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

You can see in the above output there are security warnings since e haven’t added release files in our directory. We had configured only simple repo hence we just stick with .deb packages and rest files not included.

List of online package repositories

List of all online Linux yum or apt package repositories, mirrors, download sites. Updated continuously whenever a new link is discovered

List of online resources for linux packages

This article aimed at listing all available mirrors, repositories, package download sites for Linux distros. Let us know broken/new links in comments and we will update this post accordingly. 

Use these links on your own risk!

Fedora Mirrors

https://admin.fedoraproject.org/mirrormanager/ (Sorted by distro, arch etc)

More details here

Red Hat Mirrors

ftp://tug.ctan.org/pub/mirrors/ftp.redhat.com/mirror.html (sorted by Geo locations)

More details here

CentOS mirrors

https://www.centos.org/download/mirrors/ (sorted by Geo locations)

More details here

Articles you might be interested :

  1. How to install package in Linux
  2. Configure EPEL repo in YUM based Linux
  3. How to download package without installing
  4. Package removal in Linux

openSUSE mirrors

http://mirrors.opensuse.org/ (sorted by Geo locations, repo)

Oracle Linux mirrors

https://community.oracle.com/docs/DOC-917963

Oracle public YUM repository : http://public-yum.oracle.com/

EPEL repositories

https://dl.fedoraproject.org/pub/epel/

Debian worldwide mirrors

https://www.debian.org/mirror/list (sorted by Geo locations, Architecture)

More details here

Ubuntu

RPM search and download sites

https://www.rpmfind.net/linux/RPM/

http://rpm.pbone.net/

How to install EPEL repository in YUM based Linux

Learn how to install EPEL repository (Extra Packages for Enterprise Linux) in YUM based Linux. It enables you to install open source packages.

EPEL repository installation

What is EPEL

EPEL stands for Extra Packages for Enterprise Linux. EPEL repository is helpful and rich with packages that are normally used/needed for commonly used Linux software. This repository is managed by the EPEL group. This repository contains all 100% free open source packages which may not available in the core

EPEL repos should be used in production with extra caution.

As you know EPEL group is the Fedora project, EPEL repository can be enabled for YUM based systems like RHEL, Oracle Linux, Fedora, CentOS, etc distributions.

How to configure EPEL

Adding EPEL repository can take a different route than adding https, FTP repositories in YUM. For EPFL, you need to download related RPM from link  using any Linux downloaders. Choose correct distro and architecture while choosing a download link for the EPEL package. Or you can choose noarch rpm as I did below.

I downloaded rpm using wget as below :

# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
--2017-04-03 13:18:35--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Resolving dl.fedoraproject.org... 209.132.181.25, 209.132.181.23, 209.132.181.24
Connecting to dl.fedoraproject.org|209.132.181.25|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-rpm]
Saving to: “epel-release-latest-6.noarch.rpm”

100%[===================================================================================================================>] 14,540      51.5K/s   in 0.3s

2017-04-03 13:18:37 (51.5 KB/s) - “epel-release-latest-6.noarch.rpm” saved [14540/14540]

You should have rpm file in your current directory.

# ll
total 680
-rw-r--r--. 1 root root  14540 Nov  5  2012 epel-release-latest-6.noarch.rpm

You need to install rpm using yum command.

# yum install ./epel-release-latest-*.noarch.rpm
Loaded plugins: amazon-id, rhui-lb, security
Setting up Install Process
Examining ./epel-release-latest-6.noarch.rpm: epel-release-6-8.noarch
Marking ./epel-release-latest-6.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                              Arch                           Version                     Repository                                             Size
=============================================================================================================================================================
Installing:
 epel-release                         noarch                         6-8                         /epel-release-latest-6.noarch                          22 k

Transaction Summary
=============================================================================================================================================================
Install       1 Package(s)

Total size: 22 k
Installed size: 22 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                                                                                                   1/1
  Verifying  : epel-release-6-8.noarch                                                                                                                   1/1

Installed:
  epel-release.noarch 0:6-8

Complete!

Thats it. EPEL repository is accommodated by your YUM configuration now.

EPEL repository test

Let’s test the EPEL repository if it’s configured properly. You should see below the new repo in directory /etc/yum.repos.d This is the first indication EPEL is configured.

# pwd
/etc/yum.repos.d

# ll
total 32
-rw-r--r--. 1 root root  957 Nov  4  2012 epel.repo
-rw-r--r--. 1 root root 1056 Nov  4  2012 epel-testing.repo

Now extract repolist from yum to verify configuration.

# yum repolist
Loaded plugins: amazon-id, rhui-lb, security
repo id                                                         repo name                                                                              status
epel                                                            Extra Packages for Enterprise Linux 6 - x86_64                                         12,361
rhui-REGION-client-config-server-6                              Red Hat Update Infrastructure 2.0 Client Configuration Server 6                             0
rhui-REGION-rhel-server-releases                                Red Hat Enterprise Linux Server 6 (RPMs)                                               19,422
rhui-REGION-rhel-server-releases-optional                       Red Hat Enterprise Linux Server 6 Optional (RPMs)                                      11,057
rhui-REGION-rhel-server-rh-common                               Red Hat Enterprise Linux Server 6 RH Common (RPMs)                                        129
repolist: 48,031

You can see EPEL is configured and identified properly by YUM (highlighted line).

YUM cheat sheet

All YUM related articles in one place! Helpful YUM cheat sheet to learn, understand, revise YUM related sysadmin tasks on a single page.

YUM cheat sheet

YUM is Yellow dog Updater Modified. Its a package management tool for RPM-based systems. It has below a list of features that make it must use for every sysadmin.

  1. Simple install, uninstall, upgrade operations for packages
  2. Automatic resolves software dependency while installing or upgrading
  3. Looks for more than one source for software (supports multiple repositories)
  4. Supports CLI and GUI
  5. Automatically detects architecture of the system and search for best-fit software version
  6. Works well with remote (network connectivity) and local (without network connectivity) repositories.

In this article, I am gathering all YUM related posts in one place so that you don’t have to search them through our site!

Package Operations

  1. How to install package
  2. How to upgrade package
  3. How to remove package

Configurations

  1. YUM server configuration
  2. YUM config basics
  3. Package naming conventions
  4. Configure internet proxy for YUM

Services

  1. Automatic scheduled package updates 
  2. Download only packages without installing

Miscellaneous

  1. How to check if package is installed

Building different types of software depots in HPUX

Learn to build directory and tape software depots in HPUX. Package software or patch bundles according to the environment need to facilitate installation.

HPUX patch management is an important aspect of HPUX server administration which includes downloads, distribution for installation, and final patch installation. In this post, we will be concentrating on the patch distribution part. HPUX patches can be in two forms: directory depots and tape depots (i.e. single *.depot file)

Directory depots are those which you normally get by expanding downloaded files from the HP software portal. This is good for local and network installs. Network installs can be done using: swinstall -s hostname:/some/place/directorydepotBut they are not useful for movement. If you want to move these software depots from one location to another with FTP then it’s a bit slow since there are plenty of files to copy.

Tape depots  (i.e. single *.depot file) is just like single RPM packages in the case of Linux. These are easy to copy, move, FTP. But these depots can’t be used for network installs as we saw earlier.

In this post, we will see how to create a tape depot using a directory depot and vice versa.

Create directory depot from tape depot:

You need to use swcopy command to transfer files in tape depot to directory depot. The command should be supplied with -s as source depot and turn off checking dependencies while copying using -x option.

# /usr/sbin/swcopy -x enforce_dependencies=false -s /tmp/PACPTHP_00001.depot \* @ /tmp/depot

=======  01/07/17 02:58:58 EDT  BEGIN swcopy SESSION (non-interactive)
         (jobid=testsrv2-0397)

       * Session started for user "root@testsrv2".

       * Beginning Selection
       * "testsrv2:/tmp/depot":  This target does not exist and
         will be created.
       * Source:                 /tmp/PACPTHP_00001.depot
       * Targets:                testsrv2:/tmp/depot
       * Software selections:
             HPOvLcore.HPOVBBC,r=6.00.000,a=HP-UX_B.11.00_32/64,v=HP,fr=6.10.050,fa=HP-UX_B.11.00_32/64
             HPOvLcore.HPOVCTRL,r=6.00.000,a=HP-UX_B.11.00_32/64,v=HP,fr=6.00.060,fa=HP-UX_B.11.00_32/64
             HPOvLcore.HPOVSECCO,r=6.00.000,a=HP-UX_B.11.00_32/64,v=HP,fr=6.00.040,fa=HP-UX_B.11.00_32/64
             HPOvLcore.HPOVXPL,r=6.00.000,a=HP-UX_B.11.00_32/64,v=HP,fr=6.00.070,fa=HP-UX_B.11.00_32/64
             HPOvLcore.HPOVBBC,r=6.00.000,a=HP-UX_B.11.22_IA,v=HP,fr=6.10.050,fa=HP-UX_B.11.22_IA
             HPOvLcore.HPOVCTRL,r=6.00.000,a=HP-UX_B.11.22_IA,v=HP,fr=6.00.060,fa=HP-UX_B.11.22_IA
             HPOvLcore.HPOVSECCO,r=6.00.000,a=HP-UX_B.11.22_IA,v=HP,fr=6.00.040,fa=HP-UX_B.11.22_IA
             HPOvLcore.HPOVXPL,r=6.00.000,a=HP-UX_B.11.22_IA,v=HP,fr=6.00.070,fa=HP-UX_B.11.22_IA
             HPOvPerf.HPOVPACC,r=4.70.000,a=HP-UX_B.11.00_32/64,v=HP,fr=10.50.060,fa=HP-UX_B.11.00_32/64
             HPOvPerf.HPOVPCO,r=4.70.000,a=HP-UX_B.11.00_32/64,v=HP,fr=10.50.060,fa=HP-UX_B.11.00_32/64
             HPOvPerf.HPOVPACC,r=4.70.000,a=HP-UX_B.11.22_IA,v=HP,fr=10.50.060,fa=HP-UX_B.11.22_IA
             HPOvPerf.HPOVPCO,r=4.70.000,a=HP-UX_B.11.22_IA,v=HP,fr=10.50.060,fa=HP-UX_B.11.22_IA
       * Selection succeeded.


       * Beginning Analysis and Execution
       * Session selections have been saved in the file
         "/home/sladmin/.sw/sessions/swcopy.last".
       * The analysis phase succeeded for "testsrv2:/tmp/depot".
       * The execution phase succeeded for "testsrv2:/tmp/depot".
       * Analysis and Execution succeeded.


NOTE:    More information may be found in the agent logfile using the
         command "swjob -a log testsrv2-0397 @
         testsrv2:/tmp/depot".

=======  01/07/17 02:59:02 EDT  END swcopy SESSION (non-interactive)
         (jobid=testsrv2-0397)

NOTE: you must escape or quote the asterisk (as above) because you don’t want the shell to replace it with a list of file names.

# ll /tmp/depot
total 32
dr-x------   6 root       sys             96 Jan  7 02:59 HPOvLcore
dr-x------   6 root       sys             96 Jan  7 02:59 HPOvLcore.2
dr-x------   4 root       sys             96 Jan  7 02:59 HPOvPerf
dr-x------   4 root       sys             96 Jan  7 02:59 HPOvPerf.2
dr-x------   7 root       sys           8192 Jan  7 02:59 catalog
-rw-r--r--   1 root       sys           1999 Jan  7 02:59 swagent.log

Resulting directory depot is ready to install locally (swinstall -s /tmp/depot) or over network (swinstall -s testsrv2:/tmp/depot)!

Create tape depot from directory depot:

Here swpackage command does the work of packaging all directory depot files into one single software depot file. Same command options as described above works here. Along with them, you need to specify media type as tape so that a single depot file will be generated.

# /usr/sbin/swpackage -x media_type=tape -s /tmp/depot \* @ /tmp/output.depot

=======  01/07/17 03:03:10 EDT  BEGIN swpackage SESSION

       * Session started for user "root@testsrv2".

       * Source:        testsrv2:/tmp/depot
       * Target:        testsrv2:/tmp/output.depot
       * Software selections:
             *


       * Beginning Selection Phase.
       * Reading the source depot "/tmp/depot".
       * Reading the contained files information for each selected
         product.

NOTE:    The temporary target depot "/var/tmp/pkgAAA005349" has been
         created.
       * Selection Phase succeeded.


       * Beginning Analysis Phase.
       * Analysis Phase succeeded.


       * Beginning Package Phase.
       * Packaging the product "HPOvLcore".
       * Packaging the fileset "HPOvLcore.HPOVBBC".
       * Packaging the fileset "HPOvLcore.HPOVCTRL".
       * Packaging the fileset "HPOvLcore.HPOVSECCO".
       * Packaging the fileset "HPOvLcore.HPOVXPL".

       * Packaging the product "HPOvLcore".
       * Packaging the fileset "HPOvLcore.HPOVBBC".
       * Packaging the fileset "HPOvLcore.HPOVCTRL".
       * Packaging the fileset "HPOvLcore.HPOVSECCO".
       * Packaging the fileset "HPOvLcore.HPOVXPL".

       * Packaging the product "HPOvPerf".
       * Packaging the fileset "HPOvPerf.HPOVPACC".
       * Packaging the fileset "HPOvPerf.HPOVPCO".

       * Packaging the product "HPOvPerf".
       * Packaging the fileset "HPOvPerf.HPOVPACC".
       * Packaging the fileset "HPOvPerf.HPOVPCO".
       * Package Phase succeeded.


       * Beginning Tapemaker Phase.
       * Copying the temporary depot to the tape
         "/tmp/output.depot".
       * Calculating the tape blocks required to copy the temporary
         depot to the tape "/tmp/output.depot".
NOTE:    The temporary depot requires 40540 Kbytes on the tape
         "/tmp/output.depot".
       * Writing the tape "/tmp/output.depot" (tape 1 of 1).
       * Writing the fileset "HPOvLcore.HPOVXPL" (1 of 12)
       * Writing the fileset "HPOvLcore.HPOVSECCO" (2 of 12)
       * Writing the fileset "HPOvLcore.HPOVBBC" (3 of 12)
       * Writing the fileset "HPOvLcore.HPOVCTRL" (4 of 12)
       * Writing the fileset "HPOvLcore.HPOVXPL" (5 of 12)
       * Writing the fileset "HPOvLcore.HPOVSECCO" (6 of 12)
       * Writing the fileset "HPOvLcore.HPOVBBC" (7 of 12)
       * Writing the fileset "HPOvLcore.HPOVCTRL" (8 of 12)
       * Writing the fileset "HPOvPerf.HPOVPACC" (9 of 12)
       * Writing the fileset "HPOvPerf.HPOVPCO" (10 of 12)
       * Writing the fileset "HPOvPerf.HPOVPACC" (11 of 12)
       * Writing the fileset "HPOvPerf.HPOVPCO" (12 of 12)
       * Tape #1: CRC-32 checksum & size: 684796198 41512960

       * Removing the temporary depot.
       * Tapemaker Phase succeeded.


=======  01/07/17 03:03:12 EDT  END swpackage SESSION

The .depot files are actually images of swinstall tapes, hence media_type=tape. Resulting .depot files can be used with swinstall for installation (swinstall -s /tmp/output.depot).

Merging multiple depots to create single depot:

Even multiple depots can be copied to single one using swcopy command.

# swcopy -x enforce_dependencies=false -s /some/where/thing1.depot \* @ /some/place/directorydepot
# swcopy -x enforce_dependencies=false -s /some/where/thing2.depot \* @ /some/place/directorydepot
# swcopy -x enforce_dependencies=false -s /some/where/thing3.depot \* @ /some/place/directorydepot

In the above example, we copied 3 tape software depots into the same directory depot. Now, this final directory depot contains all 3 tape depots patches/software ready to install. You can even create a single tape depot of this resulting directory depot using swpackage command. So you will have one tape depot which is having all 3 software depots inside!