Problem:
Register Debian Client to Foreman/Katello Expected outcome:
Debian Client registered in Foreman/Katello Foreman and Proxy versions:
Foreman 1.22.0 Foreman and Proxy plugin versions:
Katello 3.12 Other relevant data:
I have created a Debian Stretch Repository inside Foreman, built a Content View , created an Activation Key with this Content View and tried to add a debian 9 System to foreman using https://pypi.org/project/deb-subscription/ with
deb_subscription --fqdn --organization --location --activation_key
This results in the following error:
Traceback (most recent call last):
File “/usr/local/bin/deb_subscription”, line 112, in
entry = ‘deb%shttps://%s/pulp/deb/%s/%s/%s/%s/%s/%s %s %s\n’ % (trusted, KatelloBase.fqdn, org, environment_name, content_view_name, repository[‘product_type’], repository[‘product’][‘name’], repository[‘name’], release, components)
KeyError: ‘product_type’
Is there any other recommended way to register Debian Clients to Foreman ?
How far is debian supported by foreman anyway ?
Is there anyone who successfully built the deb package from source?
I cant find the build instructions in the repo. The commit says " Adding debian / ubuntu package build instructions", but I cannot find those instructions in his commit or the whole repo.
I tried to build it, but tbh, I am not very familiar with building deb packages.
mv contrib/debian …
(move the debian dir up one level in the source tree)
debuild -b -uc -us
FYI - I ran into an issue after I built it where the rhsm.sources file doesn’t seem to use the subscription info to populate the Suites and Components components field correctly. So this means you can subscribe a system and get a sources file built but you’ll get 404 errors when it actually tries to hit the pulp repos. I posted about that in another thread but I think I’m going to need the ATIX guys to chime in to help with that one.
Ahh - I think I ran into the issue you’re seeing. There was a hardcoded path in a sed replacement. I think it was in the debian/rules file. I had to replace lib64 with lib or vice versa.
Thanks for the infos. You helped me to get a bit closer to the finish line
One thing I didnt do was moving /contrib/debian to the root path.
Afterwards I could step a bit further, but I had a lot problem regarding openssl during compiling.
After installing libssl-dev, those errors were also fixed.
But now I am running into the following error:
copying build/dbus/systemd/rhsm-facts.service -> debian/python-subscription-manager/usr/lib/systemd/system
running install_egg_info
running egg_info
creating subscription_manager.egg-info
writing requirements to subscription_manager.egg-info/requires.txt
writing subscription_manager.egg-info/PKG-INFO
writing top-level names to subscription_manager.egg-info/top_level.txt
writing dependency_links to subscription_manager.egg-info/dependency_links.txt
writing entry points to subscription_manager.egg-info/entry_points.txt
writing manifest file 'subscription_manager.egg-info/SOURCES.txt'
reading manifest file 'subscription_manager.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'subscription_manager.egg-info/SOURCES.txt'
Copying subscription_manager.egg-info to debian/python-subscription-manager/usr/lib/python2.7/site-packages/subscription_manager-1.26.2-py2.7.egg-info
running install_scripts
Installing rhsmd script to debian/python-subscription-manager/usr/bin
Installing rct script to debian/python-subscription-manager/usr/bin
Installing rhsm-facts-service script to debian/python-subscription-manager/usr/bin
Installing rhsm-service script to debian/python-subscription-manager/usr/bin
Installing subscription-manager script to debian/python-subscription-manager/usr/bin
Installing rhsm-debug script to debian/python-subscription-manager/usr/bin
Installing rhn-migrate-classic-to-rhsm script to debian/python-subscription-manager/usr/bin
Installing rhsmcertd-worker script to debian/python-subscription-manager/usr/bin
Installing subscription-manager-gui script to debian/python-subscription-manager/usr/bin
mkdir -p debian/python-subscription-manager//usr/sbin/
mkdir -p debian/python-subscription-manager//
mv debian/python-subscription-manager//usr/bin/subscription-manager debian/python-subscription-manager//usr/sbin/
mv debian/python-subscription-manager//usr/bin/rhn-migrate-classic-to-rhsm debian/python-subscription-manager//usr/sbin/
mv debian/python-subscription-manager//usr/bin/rhsmcertd-worker debian/python-subscription-manager//
mv debian/python-subscription-manager//usr/bin/rhsm-service debian/python-subscription-manager//
mv debian/python-subscription-manager//usr/bin/rhsm-facts-service debian/python-subscription-manager//
mv debian/python-subscription-manager//usr/bin/rhsmd debian/python-subscription-manager//
if [[ "true" == "true" ]]; then \
mv debian/python-subscription-manager//usr/bin/subscription-manager-gui debian/python-subscription-manager//usr/sbin/; \
else \
rm debian/python-subscription-manager//usr/bin/subscription-manager-gui; \
fi; \
if [[ "0" = "1" ]]; then \
mv debian/python-subscription-manager//usr/bin/syspurpose debian/python-subscription-manager//usr/sbin/; \
fi;
find debian/python-subscription-manager//usr/lib64/python2.7/site-packages -name requires.txt -exec sed -i '/dbus-python/d' {} \;
find: ‘debian/python-subscription-manager//usr/lib64/python2.7/site-packages’: No such file or directory
Makefile:313: recipe for target 'install-via-setup' failed
make[2]: *** [install-via-setup] Error 1
make[2]: Leaving directory '/root/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 '/root/subscription-manager'
debian/rules:12: recipe for target 'binary-indep' failed
make: *** [binary-indep] Error 2
dpkg-buildpackage: error: debian/rules binary-indep subprocess returned exit status 2
I think this is the same problem you had in the past. ... /usr/lib64/python2.7/site-packages’: No such file or directory
Therefore i replaced lib with lib64 in the debian/rules file, but this does not seem to change anything, which looks like this now: sed -i -e '/dbus-python/d' debian/python-subscription-manager/usr/lib64/python2.7/site-packages/subscription_manager-1.25.1-py2.7.egg-info/requires.txt
Change the ‘sed’ line in debian/rules was correct. But its not the lib, its the hardcoded version:
Change the following line:
sed -i -e '/dbus-python/d' debian/python-subscription-manager/usr/lib64/python2.7/site-packages/subscription_manager-1.25.1-py2.7.egg-info/requires.txt
into (it might depend on your version)
sed -i -e '/dbus-python/d' debian/python-subscription-manager/usr/lib/python2.7/site-packages/subscription_manager-1.26.2-py2.7.egg-info/requires.txt
server type: Red Hat Subscription Management
subscription management server: 3.12.3-Unknown
subscription management rules: 5.35
subscription-manager: 1.26.4-1-9-gb47736bf
and register client to Foreman and I got this error during registration:
root@zubuntu:~# subscription-manager register --org=“bla” --activationkey=“ubuntu_1804_key” ‘NoneType’ object is not callable
root@zubuntu:~#
and in /var/log/rhsm/rhsm.log
2019-10-22 15:12:36,732 [INFO] subscription-manager:5303:MainThread @connection.py:905 - Connection built: host=foremansc.test.local port=443 handler=/rhsm auth=none
2019-10-22 15:12:43,931 [INFO] subscription-manager:5303:MainThread @managerlib.py:72 - Consumer created: zubuntu (75d0a750-ab07-4284-97a5-99540ec27397)
2019-10-22 15:12:43,933 [INFO] subscription-manager:5303:MainThread @connection.py:905 - Connection built: host=foremansc.test.local port=443 handler=/rhsm auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2019-10-22 15:12:43,934 [ERROR] subscription-manager:5303:MainThread @managercli.py:216 - Error during registration: ‘NoneType’ object is not callable
2019-10-22 15:12:43,934 [ERROR] subscription-manager:5303:MainThread @managercli.py:217 - ‘NoneType’ object is not callable
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/subscription_manager/managercli.py”, line 1370, in _do_command
type=self.options.consumertype
File “/usr/lib/python2.7/dist-packages/rhsmlib/services/register.py”, line 102, in register
store = syspurposelib.SyncedStore(uep, consumer_uuid=self.identity.uuid)
TypeError: ‘NoneType’ object is not callable
Can I ignore this error?
client is visible in Foreman. I would like to know:
do I have to create /etc/apt/sources.list by myself or should this be created automatically during registration, because I add apt repository to activation key?
I have also create Lifecycle Environment/Content View and if I have to create /etc/apt/sources.list by myself I just don’t understand if I promote new version with new patches this mean that all clients will see new CV even if I don’t promote to all environment. Is that correct?
Hi. I’m just setting this up now and followed lots of the help around (thanks everyone), and now am at this point, where the Suites and Components don’t get created correctly. I wasn’t able to find your other post. Was that resolved?
Also it’s trying to download i386 architecture binaries, no idea where it got that from, and I can’t make up an Architecture option in the rhsm.sources file.
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.
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
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