**Problem: I created a custom deb repository within an ubuntu container on my foreman server. I did the dpkg-scanpacakges, created InRelease. But when trying to sync the repository I keep getting the error:
**
decode() argument ‘encoding’ must be str, not None
Expected outcome:
I can sync my custom create d repository
Foreman and Proxy versions: 3.15
Foreman and Proxy plugin versions:
Distribution and version:
Other relevant data:
The baseOS is rhel9. I already spammed copilot and first I had it as an upstream with file then exposed it with a nginx container but always the same result. Tried to iconv the Release files, tried with changing my locale but nothing seems to work.
Tried UTF-8 BOM with sed but then he complains no architecture is in my release file
Can you add more details about the error like stacktrace from the task during sync and if you see only Katello::Pulp3::Error message then possibly the relevant pulp log from /var/log/messages.
The issue seems to be created by the way I made my Release file. I created it with an apt-ftparchive-repository.conf file and the apt-ftparchive -c apt-ftparchive-repository.conf release dists/jammy > dists/jammy/Release command.
I found another website where they created the custom repository differently then what I found before. So I changed multiple parts of my procedure and now the sync in my foreman works. I can’t really pinpoint which of the changes solved my issue. But for those who encounter them this is what I did:
The packages were moved from the dists/jammy/binary-amd64/ subfolder to a pool/main subfolder in my repository structure.
dpkg-scan packages was done to a Packages file and zippend afterward and not in a oneliner as I did before (old command: dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz) + gzip was with -9 instead of -9c
The Release file was created with a script instead of the apt-ftparchive command.
I trigger the below script when located in my dists/jammy folder with argumest <repository_name> <os_release> and send the output to Release. Afterward I sign the InRelease and Release.gpg keys and now the sync works like a charm.
#!/bin/sh
set -e
do_hash() {
HASH_NAME=$1
HASH_CMD=$2
echo "${HASH_NAME}:"
for f in $(find -type f); do
f=$(echo $f | cut -c3-) # remove ./ prefix
if [ "$f" = "Release" ]; then
continue
fi
echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)"
done
}
cat << EOF
Origin: $1
Label: $1
Suite: $2
Codename: $2
Version: 1.0
Architectures: amd64 arm64 arm7
Components: main
Description: Custom created $1 repository
Date: $(date -Ru)
EOF
do_hash "MD5Sum" "md5sum"
do_hash "SHA1" "sha1sum"
do_hash "SHA256" "sha256sum"