Debian Client Support in Foreman/Katello

In debian/python-subscription-manager/usr/lib/python2.7/dist-packages/subscription_manager/repofile.py around line 440, there’s this:

        apt_cont = content.copy()
        apt_cont['Types'] = 'deb'
        apt_cont['URIs'] = baseurl
        apt_cont['Suites'] = 'default'
        apt_cont['Components'] = 'all'
        apt_cont['Trusted'] = 'yes'
        return apt_cont

Looks like Suites and Components is hard-coded. I doubt I’ll be able to figure out how to get it to properly read anything out of the foreman server config, but if it helps anyone, that’s where it is.

Sharing some steps I followed but facing the ’NoneType’ object is not callable from jost when issuing the “subscription-manager register” command

ubuntu 18 build notes

git clone https://github.com/ATIX-AG/subscription-manager.git
sudo apt install build-essential devscripts equivs
cd subscription-manager
cp -r contrib/debian .
dch -i # enter the release notes
mk-build-deps debian/control
sudo apt install ./subscription-manager-build-deps*.deb
dpkg-buildpackage -b

After build

bzanaj@ubuntu18:~/subscription-manager$ cd ..
bzanaj@ubuntu18:~$ ll *.deb
apt-transport-katello_1.25.1-2ubuntu1_all.deb
katello-upload-profile_1.25.1-2ubuntu1_all.deb
python-subscription-manager_1.25.1-2ubuntu1_amd64.deb
python-subscription-manager-doc_1.25.1-2ubuntu1_all.deb

Install dependencies:

sudo apt install httpie jq libdw1 libjq1 liblua5.2-0 libnl-route-3-200 libnspr4 libnss3 libonig4 librpm8 librpmbuild8 librpmio8 librpmsign8 python-apt python-asn1crypto python-certifi python-cffi-backend python-chardet python-cryptography python-debian python-decorator python-ethtool python-gobject python-gobject-2 python-idna python-iniparse python-ipaddress python-openssl python-requests python-rpm python-urllib3 python3-pygments rpm-common virt-what

Install the debs

sudo dpkg -i *.deb

Get the sh script from katello-ca-consumer rpm and execute in the ubuntu system.

sudo bash katello-ca-consumer.sh 
sudo subscription-manager register --org="<ORG>" --activationkey="Ubuntu_1804_live"

repos

bzanaj@ubuntu18:~$ sudo subscription-manager repos
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   <ORG>_Ubuntu_18_Helper_Repo
Repo Name: Helper Repo
Repo URL:  https://foreman.server.com/pulp/deb/<ORG>/Live/Ubuntu_Content_View/custom/Ubuntu_18/Helper_Repo
Enabled:   1

rhsm.sources

bzanaj@ubuntu18:~$ cat /etc/apt/sources.list.d/rhsm.sources 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "apt-get update" to refresh available repos
#
# *** DO NOT EDIT THIS FILE ***
#
Suites: default
sslverify: 1
enabled_metadata: 1
sslclientkey: /etc/pki/entitlement/<ID>-key.pem
sslclientcert: /etc/pki/entitlement/<ID>.pem
Trusted: yes
enabled: 1
baseurl: https://forema.server.com/pulp/deb/<ORG>/Live/Ubuntu_Content_View/custom/Ubuntu_18/Helper_Repo
id: <ORG>_Ubuntu_18_Helper_Repo
sslcacert: /etc/rhsm/ca/katello-server-ca.pem
Components: all
gpgcheck: 0
metadata_expire: 1
URIs: katello://3847035710451318546@foreman.server.com/pulp/deb/<ORG>/Live/Ubuntu_Content_View/custom/Ubuntu_18/Helper_Repo
Types: deb
name: Helper Repo

It can be fixed by adjusting rhsm.sources suites and components to the correct values.

@taylor1, just specify architectures separated by , in repository.

i.e: amd64, i386

@besmirzanaj
which release note have to specify in the file?. katello or foreman release note?

@besmirzanaj,

sudo bash katello-ca-consumer.sh , from where we can get it?.

Sorry I forgot the details on this step, adding a bit more info.

Download the certificate rpm package from katello on the same debian/ubuntu server you are using for building. then convert that package from RPM to a DEB. In the RPM there is basically just one bash script (the one in my previous comment)

replace that line with the following:
$ sudo alien -d katello-ca-consumer-latest.noarch.rpm
$ sudo chown $USER:$GROUPS katello-ca-consumer-foreman.domain.com_1.0-2_all.deb
$ sudo apt install -f katello-ca-consumer-foreman.domain.com_1.0-2_all.deb

these is the subscription manager version

after successful installation, im getting below error.

File “/usr/lib/apt/methods/katello”, line 31
from future import print_function
SyntaxError: from future imports must occur at the beginning of the file
Reading package lists… Done
E: Method katello has died unexpectedly!
E: Sub-process katello returned an error code (1)
E: Method /usr/lib/apt/methods/katello did not start correctly
E: Failed to fetch katello://fqdn/CS/Library/Ubuntu18_04CV/custom/Ubunu1804/bionic/dists/default/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.

Make sure you have a ubuntu product with a repo, on a content view and the
activation key with that subscription activated

Hello all,

I’m wondering if anyone encountered this issue when building the debian package (currently using the repo from - https://github.com/candlepin/subscription-manager.git)?

It seems to trip up at the syspurpose part of the build due to some unexpected parameters in the python command;

/subscription-manager/syspurpose /subscription-manager
running install
running build
running build_py
running build_trans
running install_lib
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/files.py to files.pyc
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/i18n.py to i18n.pyc
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/cli.py to cli.pyc
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/main.py to main.pyc
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/init.py to init.pyc
byte-compiling debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose/utils.py to utils.pyc
running install_data
running install_egg_info
running egg_info
creating src/syspurpose.egg-info
writing src/syspurpose.egg-info/PKG-INFO
writing top-level names to src/syspurpose.egg-info/top_level.txt
writing dependency_links to src/syspurpose.egg-info/dependency_links.txt
writing entry points to src/syspurpose.egg-info/entry_points.txt
writing manifest file ‘src/syspurpose.egg-info/SOURCES.txt’
reading manifest file ‘src/syspurpose.egg-info/SOURCES.txt’
writing manifest file ‘src/syspurpose.egg-info/SOURCES.txt’
removing ‘debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose-1.28.0-py2.7.egg-info’ (and everything under it)
Copying src/syspurpose.egg-info to debian/python-subscription-manager/usr/lib/python2.7/site-packages/syspurpose-1.28.0-py2.7.egg-info
running install_scripts
Installing syspurpose script to debian/python-subscription-manager/usr/bin
/subscription-manager
EXCLUDE_PACKAGES="""" python ./setup.py clean --all" python ./setup.py build --quiet --gtk-version=2 --rpm-version=1.28.0-1-38-g720aee96" python ./setup.py install --root debian/python-subscription-manager --gtk-version=2 --rpm-version=1.28.0-1-38-g720aee96 --prefix=/usr
–with-systemd=true --with-subman-gui=true --with-cockpit-desktop-entry=true
–with-subman-migration=true
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] …]
or: setup.py --help [cmd1 cmd2 …]
or: setup.py --help-commands
or: setup.py cmd --help

error: option --all python ./setup.py build --quiet --gtk-version not recognized
Makefile:341: recipe for target ‘install-via-setup’ failed
make[2]: *** [install-via-setup] Error 1
make[2]: Leaving directory ‘/subscription-manager’
debian/rules:24: recipe for target ‘override_dh_auto_install’ failed
make[1]: *** [override_dh_auto_install] Error 2
make[1]: Leaving directory ‘/subscription-manager’
debian/rules:12: recipe for target ‘binary’ failed
make: *** [binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

I was following the instructions posted earlier in the thread from @besmirzanaj

I am attempting to do the same, adding Ubuntu servers to Katello, any updates? was anyone able to accomplish this?

Hi, even if you subscribe the system to katello, you won’t be able to manage packages from it. There’s a problem with katello ddbb and seems fixing it is not really a priority for now. (I’m also waiting for it, btw ) .
There’s a workaround via a PR, but you need to rebuild whole foreman+katello from scratch and it’s strongly discouraged/not ready for production environments.
check also : 'Content hosts' not showing installable updates for Debian like systems
Sorry for the bad news.

2 Likes

I see the same here trying to build on Debian 10. Did you find a solution for this?

I was able to build current git version by applying these changes (… and then copying contrib/debian one level higher) and running “debuild -b -uc -us”.

~/subscription-manager# git diff Makefile  contrib/debian/changelog 
diff --git a/Makefile b/Makefile
index 427e92795..0cfd3be4e 100644
--- a/Makefile
+++ b/Makefile
@@ -135,12 +135,12 @@ build-subpackages:
 # any cruft so developers don't end up install old builds.
 ifeq ($(WITH_SUBMAN_GUI),true)
     build: rhsmcertd rhsm-icon build-subpackages
-        EXCLUDE_PACKAGES:="$(EXCLUDE_PACKAGES)" $(PYTHON) ./setup.py clean --all
-        EXCLUDE_PACKAGES:="$(EXCLUDE_PACKAGES)" $(PYTHON) ./setup.py build --quiet --gtk-version=$(GTK_VERSION) --rpm-version=$(VERSION)
+       $(PYTHON) ./setup.py clean --all
+       $(PYTHON) ./setup.py build --quiet --gtk-version=$(GTK_VERSION) --rpm-version=$(VERSION)
 else
     build: rhsmcertd build-subpackages
-        EXCLUDE_PACKAGES:="$(EXCLUDE_PACKAGES)" $(PYTHON) ./setup.py clean --all
-        EXCLUDE_PACKAGES:="$(EXCLUDE_PACKAGES)" $(PYTHON) ./setup.py build --quiet --gtk-version=$(GTK_VERSION) --rpm-version=$(VERSION)
+       $(PYTHON) ./setup.py clean --all
+       $(PYTHON) ./setup.py build --quiet --gtk-version=$(GTK_VERSION) --rpm-version=$(VERSION)
 endif
 
 # we never "remake" this makefile, so add a target so
diff --git a/contrib/debian/changelog b/contrib/debian/changelog
index 088fe1271..c1695770d 100644
--- a/contrib/debian/changelog
+++ b/contrib/debian/changelog
@@ -1,3 +1,9 @@
+subscription-manager (1.28.2-1) unstable; urgency=medium
+
+  * Update to version 1.28.2
+
+ -- Jan Lentfer <jan.lentfer@web.de>  Tue, 25 Aug 2020 11:54:00 +0200
+
 subscription-manager (1.25.1-2) unstable; urgency=medium
 
   * Change the path to rhsmd in /etc/cron.daily/rhsmd

I was using 1.25 IIRC, not much juice from it. did you get anything interesting from this newer version?

As I mentioned (probably in another thread), we (ATIX) are currently working to release our debian / ubuntu packages including subscription-manager, apt-transport-katello and katello-upload-profile.

Its just a question of “days” (hopefully).

2 Likes

No - no difference. Just building was a bit easier with the newer version.

Would be cool if you could make aarch64 packages available, too :slight_smile:
Really looking forword for improved Debian / Ubuntu support, also professionally.

any news on the Debian packages?