You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Terminal Incompatibility with Alacritty from Arch Linux Installation #505
I am running an Arch Linux installation with the Alacritty terminal emulator. I installed the toolbox package through pacman, the default Arch package manager.
toolbox itself works fine, I was able to create a container based on fedora-toolbox:30 image. I was also able to enter the container successfully. However, I have issues running some commands inside the container.
Commands such as 'cd', 'ls', 'echo' or 'exit' work fine. But, commands such as 'clear', 'top' result in the message:
'alacritty': unknown terminal type.
and the command is not executed. Also tab, arrow keys and backspace do not work properly within the container. Tab seems to have no effect, while backspace acts like tab.
I also installed the gnome-terminal for a test. It worked fine without issue. But I would rather use the terminal emulator of my preference.
Hey @mertalpt! I only used Alacritty once and that's about 2 years ago, so I have zero idea of what could be happening here. My personal guess aims at a possible problem with environmental variables.
Hi @mertalpt @HarryMichal .. I'm running Toolbox on Alacritty (manually built from trunk at alacritty/alacritty@f0775b3). No problems here. Most time using tmux, but no problems even with using Alacritty without tmux.
@mertalpt, you can try to change the TERM variable to something else (e.g., xterm-256color, linux,..) and see if it "fixes" the issue for now. Still, we need to make this work out of the box.
I just took a look at the package definitions of Alacritty in Arch Linux and Fedora (pschyska/alacritty copr) and I may see the cause. Notice the lines 37 and 38 in the .spec file of the copr repository, the terminfo directory is being populated with data for Alacritty. I do not see that step to be done in Arch Linux's package definition. I don't know the reason for it (I actually see this terminfo thing for the first time) but it should probably be adjusted.
Still, even if ^ is fixed, Toolbox needs to be adjusted, too. On Fedora, the terminfo stuff is saved under /usr/share/terminfo. Containers usually have their own terminal info. I guess we could try to do some bind-mount magic here.
@HarryMichal Changing the TERM variable to 'xterm-256color' worked. I have not tried with others. I have no further problems, thank you.
Edit: Am I supposed to close the issue now that it is solved for me or is that on collaborators seeing that there are adjustments to be made to toolbox?
After some reading I managed to hack together a workaround. I searched for all instances of terminfo directory starting from the root file system. Among the results were /usr/share/terminfo from my system, /home/mertalpt/.local/share/containers/storage/overlay/90d9aeda29c691f01d9c2e29cecd47facbc77768696219a9c8d61f273581f3df/diff/usr/share/terminfo from the base image used for toolbox containers and various hits from flatpak runtimes.
I copied the alacritty file from my /usr/share/terminfo/a into {image_name}/diff/usr/share/terminfo/a and I was able to use toolbox from Alacritty with TERM=alacritty without problem.
I investigated the terminfo directories of various runtimes and images I have found. terminfo from Flatpak runtimes were almost as populated as my own /usr/share/terminfo, while terminfo from toolbox base image was considerably empty. For comparison, there are 322 entries in the Flatpak terminfo/a directories, 326 entries in my terminfo/a and 4 entries in toolbox image's terminfo/a. Alacritty creates 3 terminfo files which helps explain the difference between the first two. All but my own terminfo lacked the Alacritty entries.
@HarryMichal For your earlier comment on package definitions, despite the difference you noted in definitions the given data exists in my terminfo without intervention on my end.
I imagine some sort of a post-hook script to copy /usr/share/terminfo into downloaded image's /diff/usr/share/terminfo would help solve the issue, although I lack broader knowledge to know if that would cause further issues. Still, one problem with that approach is what happens if someone installs something like Alacritty after the creation of a toolbox image? A solution is to check changes to user terminfo between each calls to toolbox-enter and update accordingly. Also, note that all of my terminfo directory is about 7.1M in size.
Another alternative to copying and comparing the entire user terminfo is to get the running terminal and compile it via tic into toolbox image's diff/usr/share/terminfo directory if not supported.
I might work on a solution later on if a preferred direction is advised. Please be patient and correct my mistakes if there are any, for this is my first time getting involved in an open source project. Thank you for your time.
The default Toolbox images for Fedora already have the ncurses-base RPM which contains the terminfo entries for the most common terminals. This covers VTE, Konsole and xterm.
If someone chooses to use a more exotic terminal, which hopefully pulls in something like ncurses-term on the host for the corresponding terminfo entry, then I think it's fair to expect them to install the same entry inside the container. They'd have to do the same if they wanted to use a shell other than Bash.
You can make this somewhat smoother by building your own Fedora images locally with podman build based on the Dockerfiles provided by Toolbox, and adding the ncurses-term RPM on top.
The lesser known terminal could also try to attain compatibility with its better known cousins by implementing the same feature set. This is why VTE and xterm use the same xterm-256color entry.
Using (ie., toolbox enter and toolbox run) a Toolbox container is by far the most common operation that any user does. I feel hesitant to make everybody go through another set of potentially slow steps before using a container, only to accommodate a very niche use-case for a small subset of users.
$ podman run --rm -it --env=TERM=$TERM registry.fedoraproject.org/f31/fedora-toolbox:31 /bin/bash
After the image is pulled I get into bash but the same issue with missing terminfo entry persists.
@debarshiray While understandable I think this approach reduces out-of-the-box usability for non-standard users. If desired potentially slow steps can be hidden behind checking the existence of a single terminfo entry whose path is already known. If not, same check can be done to give an informative warning message. Currently, if an user does not already know the cause of such an issue they would have a hard time finding it.
$ podman run --rm -it --env=TERM=$TERM registry.fedoraproject.org/f31/fedora-toolbox:31 /bin/bash
After the image is pulled I get into bash but the same issue with missing terminfo entry persists.
Ok, that's what I expected. Thanks for trying it out.
While understandable I think this approach reduces out-of-the-box usability
for non-standard users. If desired potentially slow steps can be hidden behind
checking the existence of a single terminfo entry whose path is already
known. If not, same check can be done to give an informative warning message.
Currently, if an user does not already know the cause of such an issue they
would have a hard time finding it.
By potentially slow, I meant anything that requires a separate podman exec call. People already complain about sluggishness induced by an ever-burgeoning set of shell start-up scripts, so something that sets up a container environment to poke inside it is probably even worse.
I can think of two options that don't require a separate podman exec.
One is to hack something up using the actual command that gets invoked inside the container. See commit 47614b9 for an example. However, adding more voodoo to that command line is likely not the best idea because it gets harder and harder to understand what's going on.
The second option is to do something with profile.d/toolbox.sh. In the part that gets run when inside a Toolbox container, we can add a check for the terminfo entry with a suitable error message.
We could also do some magic in the container entry-point.
The way things stand at the moment, the user usually doesn't get to see the output from the container's entry-point. Not unless they do something like podman start --attach ..., and users who are already that far down the rabbit hole probably don't need any hints about missing terminfo entries. :)
The second option is to do something with profile.d/toolbox.sh.
In the part that gets run when inside a Toolbox container, we can
add a check for the terminfo entry with a suitable error message.
Activity
martymichal commentedon Jul 15, 2020
Hey @mertalpt! I only used Alacritty once and that's about 2 years ago, so I have zero idea of what could be happening here. My personal guess aims at a possible problem with environmental variables.
@debarshiray and @tpopela on the other hand could.
tpopela commentedon Jul 15, 2020
Hi @mertalpt @HarryMichal .. I'm running Toolbox on Alacritty (manually built from trunk at alacritty/alacritty@f0775b3). No problems here. Most time using tmux, but no problems even with using Alacritty without tmux.
mertalpt commentedon Jul 15, 2020
'echo $TERM' returns 'alacritty'. Any idea what information I can provide to help identify the issue?
Edit: Exitting via 'exit' or Ctrl+D does not kill the container either. I have to manually grep the process and kill it each time.
tpopela commentedon Jul 15, 2020
@mertalpt If I force the TERM=alacritty (I use xterm-256color) then I see the same problems as you.
martymichal commentedon Jul 15, 2020
This is an expected behaviour. Toolbox containers keep running after you exit them. You can stop them with
podman stop <name-of-container>.martymichal commentedon Jul 15, 2020
@mertalpt, you can try to change the
TERMvariable to something else (e.g.,xterm-256color,linux,..) and see if it "fixes" the issue for now. Still, we need to make this work out of the box.martymichal commentedon Jul 15, 2020
I just took a look at the package definitions of Alacritty in Arch Linux and Fedora (pschyska/alacritty copr) and I may see the cause. Notice the lines 37 and 38 in the .spec file of the copr repository, the
terminfodirectory is being populated with data for Alacritty. I do not see that step to be done in Arch Linux's package definition. I don't know the reason for it (I actually see thisterminfothing for the first time) but it should probably be adjusted.Still, even if ^ is fixed, Toolbox needs to be adjusted, too. On Fedora, the
terminfostuff is saved under/usr/share/terminfo. Containers usually have their own terminal info. I guess we could try to do some bind-mount magic here.mertalpt commentedon Jul 15, 2020
@HarryMichal Changing the TERM variable to 'xterm-256color' worked. I have not tried with others. I have no further problems, thank you.
Edit: Am I supposed to close the issue now that it is solved for me or is that on collaborators seeing that there are adjustments to be made to toolbox?
mertalpt commentedon Jul 15, 2020
After some reading I managed to hack together a workaround. I searched for all instances of
terminfodirectory starting from the root file system. Among the results were/usr/share/terminfofrom my system,/home/mertalpt/.local/share/containers/storage/overlay/90d9aeda29c691f01d9c2e29cecd47facbc77768696219a9c8d61f273581f3df/diff/usr/share/terminfofrom the base image used for toolbox containers and various hits from flatpak runtimes.I copied the
alacrittyfile from my/usr/share/terminfo/ainto{image_name}/diff/usr/share/terminfo/aand I was able to use toolbox from Alacritty withTERM=alacrittywithout problem.I investigated the
terminfodirectories of various runtimes and images I have found.terminfofrom Flatpak runtimes were almost as populated as my own/usr/share/terminfo, whileterminfofrom toolbox base image was considerably empty. For comparison, there are 322 entries in the Flatpakterminfo/adirectories, 326 entries in myterminfo/aand 4 entries in toolbox image'sterminfo/a. Alacritty creates 3terminfofiles which helps explain the difference between the first two. All but my ownterminfolacked the Alacritty entries.@HarryMichal For your earlier comment on package definitions, despite the difference you noted in definitions the given data exists in my
terminfowithout intervention on my end.I imagine some sort of a post-hook script to copy
/usr/share/terminfointo downloaded image's/diff/usr/share/terminfowould help solve the issue, although I lack broader knowledge to know if that would cause further issues. Still, one problem with that approach is what happens if someone installs something like Alacritty after the creation of a toolbox image? A solution is to check changes to userterminfobetween each calls totoolbox-enterand update accordingly. Also, note that all of myterminfodirectory is about7.1Min size.Another alternative to copying and comparing the entire user
terminfois to get the running terminal and compile it viaticinto toolbox image'sdiff/usr/share/terminfodirectory if not supported.I might work on a solution later on if a preferred direction is advised. Please be patient and correct my mistakes if there are any, for this is my first time getting involved in an open source project. Thank you for your time.
mgomes commentedon Jul 20, 2020
I can confirm using
TERM=xterm-kittyalso breaks things. Switching toTERM=xterm-256colorresolves it. 👍debarshiray commentedon Jul 28, 2020
What happens if you run:
debarshiray commentedon Jul 29, 2020
It seems that this is a bit of a non-issue.
The default Toolbox images for Fedora already have the
ncurses-baseRPM which contains theterminfoentries for the most common terminals. This covers VTE, Konsole and xterm.If someone chooses to use a more exotic terminal, which hopefully pulls in something like
ncurses-termon the host for the correspondingterminfoentry, then I think it's fair to expect them to install the same entry inside the container. They'd have to do the same if they wanted to use a shell other than Bash.You can make this somewhat smoother by building your own Fedora images locally with
podman buildbased on the Dockerfiles provided by Toolbox, and adding thencurses-termRPM on top.The lesser known terminal could also try to attain compatibility with its better known cousins by implementing the same feature set. This is why VTE and xterm use the same
xterm-256colorentry.Using (ie.,
toolbox enterandtoolbox run) a Toolbox container is by far the most common operation that any user does. I feel hesitant to make everybody go through another set of potentially slow steps before using a container, only to accommodate a very niche use-case for a small subset of users.mertalpt commentedon Jul 29, 2020
After the image is pulled I get into
bashbut the same issue with missingterminfoentry persists.@debarshiray While understandable I think this approach reduces out-of-the-box usability for non-standard users. If desired potentially slow steps can be hidden behind checking the existence of a single
terminfoentry whose path is already known. If not, same check can be done to give an informative warning message. Currently, if an user does not already know the cause of such an issue they would have a hard time finding it.debarshiray commentedon Jul 29, 2020
Ok, that's what I expected. Thanks for trying it out.
By potentially slow, I meant anything that requires a separate
podman execcall. People already complain about sluggishness induced by an ever-burgeoning set of shell start-up scripts, so something that sets up a container environment to poke inside it is probably even worse.I can think of two options that don't require a separate
podman exec.One is to hack something up using the actual command that gets invoked inside the container. See commit 47614b9 for an example. However, adding more voodoo to that command line is likely not the best idea because it gets harder and harder to understand what's going on.
The second option is to do something with
profile.d/toolbox.sh. In the part that gets run when inside a Toolbox container, we can add a check for theterminfoentry with a suitable error message.martymichal commentedon Jul 29, 2020
We could also do some magic in the container entry-point.
debarshiray commentedon Jul 29, 2020
The way things stand at the moment, the user usually doesn't get to see the output from the container's entry-point. Not unless they do something like
podman start --attach ..., and users who are already that far down the rabbit hole probably don't need any hints about missingterminfoentries. :)profile.d: Warn if $TERM has no terminfo entry in the container
debarshiray commentedon Aug 28, 2020
I have now implemented this in #544