weldr / lorax

Tools for creating images, including the Anaconda boot.iso, live disk images, iso's, and filesystem images.
GNU General Public License v2.0
295 stars 157 forks source link

UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 116: ordinal not in range(128) #1276

Open filoucrackeur opened 2 years ago

filoucrackeur commented 2 years ago

Hello

i want to generate iso from RHEL 8 repositories but it fails i'm an macos system and i use an custom rhel 8 ubi base docker image to use lorax.

I run

lorax --product MYISO \
      --version 1.0 \
      --release 3 \
      --installpkgs majibox-server \
      --isfinal \
      --source /project/BaseOS \
      --source /project/AppStream  \
      --enablerepo BaseOS \
      --enablerepo AppStream \
      --force \
      --nomacboot \
      /project/MY-ISO
(1829/1835) madan-fonts-2.000-20.el8.noarch
2022-10-13 14:03:38,386: (1830/1835) sil-scheherazade-fonts-2.100-5.el8.noarch
(1830/1835) sil-scheherazade-fonts-2.100-5.el8.noarch
2022-10-13 14:03:38,447: (1831/1835) libertas-usb8388-olpc-firmware-20210702-103.gitd79c2677.el8.noarch
(1831/1835) libertas-usb8388-olpc-firmware-20210702-103.gitd79c2677.el8.noarch
2022-10-13 14:03:38,461: (1832/1835) libertas-sd8787-firmware-20210702-103.gitd79c2677.el8.noarch
(1832/1835) libertas-sd8787-firmware-20210702-103.gitd79c2677.el8.noarch
2022-10-13 14:03:38,495: (1833/1835) libertas-sd8686-firmware-20210702-103.gitd79c2677.el8.noarch
(1833/1835) libertas-sd8686-firmware-20210702-103.gitd79c2677.el8.noarch
2022-10-13 14:03:38,508: (1834/1835) iwl4965-firmware-228.61.2.24-103.el8.1.noarch
(1834/1835) iwl4965-firmware-228.61.2.24-103.el8.1.noarch
2022-10-13 14:03:38,521: (1835/1835) iwl3945-firmware-15.32.2.9-103.el8.1.noarch
(1835/1835) iwl3945-firmware-15.32.2.9-103.el8.1.noarch
2022-10-13 14:03:38,531: Performing post-installation setup tasks
Performing post-installation setup tasks
2022-10-13 14:07:07,678: writing .buildstamp file
writing .buildstamp file
Traceback (most recent call last):
  File "/usr/sbin/lorax", line 203, in <module>
    main()
  File "/usr/sbin/lorax", line 197, in main
    squashfs_only=opts.squashfs_only)
  File "/usr/lib/python3.6/site-packages/pylorax/__init__.py", line 285, in run
    rb.writepkglists(joinpaths(logdir, "pkglists"))
  File "/usr/lib/python3.6/site-packages/pylorax/treebuilder.py", line 149, in writepkglists
    fobj.write("{0}\n".format(fname))
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 116: ordinal not in range(128)
2022-10-13 14:07:12,591: Cleaning up tempdir - /var/tmp/lorax/lorax.z0zmz3lb
/var/tmp/lorax/lorax.z0zmz3lb/installtree/var/lib/rpm: No such file or directory

do you know why it's a bug ?

bcl commented 2 years ago

My guess is that one of the files you added contains utf-8 characters. You may be able to work around it by setting debug = 0 in the lorax.conf file.

I'm also not sure how well lorax will run in docker, since I use VMs for development. At the least it will need to be a privileged container.

filoucrackeur commented 2 years ago

Thanks for you quicky response

my docker command:

docker run -ti --rm --name="rhel-8-iso-maker" --privileged -v "$(pwd):/project" -w /project registry.xxxx.xxx/xxxxx/rhel8-deployer:lorax bash

my container doesn't run with systemd it cannot cause an problems ?

VladimirSlavik commented 2 years ago

As to lorax in container - we (anaconda) do that when building isos for kickstart tests. We're using podman and then the container needs to be privileged, be started under sudo, and the host must have at least two loop devices available. See here: https://github.com/rhinstaller/anaconda/blob/master/.github/workflows/kickstart-tests.yml#L211 I don't know all the details about docker but IIRC it uses a daemon that runs under root, so you may not need starting with sudo; the rest should apply.

edit: The Github actions code runs on Ubuntu, the container is selected according to branch so it routinely varies between Fedora and UBI for both RHELs 8 and 9. We also sometimes do the same thing manually locally on Fedora hosts. So I think there's a good chance you can make this work for you.

edit2: I'm not 100% sure but I believe our containers also do not have any systemd services started, either.

bcl commented 2 years ago

If the package list is in sorted order the last package under pkglists/ should be the one causing the problem. Although I did try reproducing this in a podman container and was unable to make it fail by injecting utf-8 strings into the output so I'm not really sure what's going one w/o reproducing it.

filoucrackeur commented 1 year ago

by dicotomic analyse i suspect an .rpm specfile declaration

Requires: (project-server or project-client)