containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.5k stars 214 forks source link

toolbox enter emits Error: terminfo entry not found for foot #1244

Closed davidthewatson closed 1 year ago

davidthewatson commented 1 year ago

Describe the bug

toolbox enter emits terminfo error. terminfo built into toolbox does not contain foot

Inside toolbox:

    ⬢[watson@toolbox share]$ ls terminfo/   
    a/ A/ b/ c/ d/ e/ E/ g/ h/ j/ k/ l/ m/ n/ p/ r/ s/ t/ v/ w/ x/ 
    ⬢[watson@toolbox share]$ exit         
    logout

Outside toolbox (on host):

    [watson@fedora share]$ ls terminfo/
    a  A  b  c  d  e  E  f  g  h  j  k  l  m  n  p  r  s  t  v  w  x

Note: the appearance of the directory f where foot is kept on host but does not appear inside toolbox

See last line in debug output below:

    [watson@fedora ~]$ toolbox enter --log-level debug
    DEBU Running as real user ID 1000                 
    DEBU Resolved absolute path to the executable as /usr/bin/toolbox 
    DEBU Running on a cgroups v2 host                 
    DEBU Checking if /etc/subgid and /etc/subuid have entries for user watson 
    DEBU Validating sub-ID file /etc/subuid           
    DEBU Validating sub-ID file /etc/subgid           
    DEBU TOOLBOX_PATH is /usr/bin/toolbox             
    DEBU Migrating to newer Podman                    
    DEBU Toolbox config directory is /home/watson/.config/toolbox 
    DEBU Current Podman version is 4.4.1              
    DEBU Creating runtime directory /run/user/1000/toolbox 
    DEBU Old Podman version is 4.4.1                  
    DEBU Migration not needed: Podman version 4.4.1 is unchanged 
    DEBU Setting up configuration                     
    DEBU Setting up configuration: file /home/watson/.config/containers/toolbox.conf not found 
    DEBU Resolving image name                         
    DEBU Distribution (CLI): ''                       
    DEBU Image (CLI): ''                              
    DEBU Release (CLI): ''                            
    DEBU Resolved image name                          
    DEBU Image: 'fedora-toolbox:38'                   
    DEBU Release: '38'                                
    DEBU Resolving container name                     
    DEBU Container: ''                                
    DEBU Image: 'fedora-toolbox:38'                   
    DEBU Release: '38'                                
    DEBU Resolved container name                      
    DEBU Container: 'fedora-toolbox-38'               
    DEBU Resolving image name                         
    DEBU Distribution (CLI): ''                       
    DEBU Image (CLI): ''                              
    DEBU Release (CLI): ''                            
    DEBU Resolved image name                          
    DEBU Image: 'fedora-toolbox:38'                   
    DEBU Release: '38'                                
    DEBU Resolving container name                     
    DEBU Container: ''                                
    DEBU Image: 'fedora-toolbox:38'                   
    DEBU Release: '38'                                
    DEBU Resolved container name                      
    DEBU Container: 'fedora-toolbox-38'               
    DEBU Checking if container fedora-toolbox-38 exists 
    DEBU Inspecting mounts of container fedora-toolbox-38 
    DEBU Starting container fedora-toolbox-38         
    DEBU Inspecting entry point of container fedora-toolbox-38 
    DEBU Entry point PID is a float64                 
    DEBU Entry point of container fedora-toolbox-38 is toolbox (PID=5305) 
    DEBU Waiting for container fedora-toolbox-38 to finish initializing 
    DEBU Creating runtime directory /run/user/1000/toolbox 
    DEBU Checking if initialization stamp /run/user/1000/toolbox/container-initialized-5305 exists 
    DEBU Container fedora-toolbox-38 is initialized   
    DEBU Checking if 'podman exec' supports disabling the detach keys 
    DEBU 'podman exec' supports disabling the detach keys 
    DEBU Creating list of environment variables to forward 
    DEBU COLORTERM=truecolor                          
    DEBU DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus 
    DEBU DBUS_SYSTEM_BUS_ADDRESS is unset             
    DEBU DESKTOP_SESSION=sway                         
    DEBU DISPLAY=:1                                   
    DEBU LANG=en_US.UTF-8                             
    DEBU SHELL=/bin/bash                              
    DEBU SSH_AUTH_SOCK is unset                       
    DEBU TERM=foot                                    
    DEBU TOOLBOX_PATH=/usr/bin/toolbox                
    DEBU USER=watson                                  
    DEBU VTE_VERSION is unset                         
    DEBU WAYLAND_DISPLAY=wayland-1                    
    DEBU XAUTHORITY is unset                          
    DEBU XDG_CURRENT_DESKTOP=sway                     
    DEBU XDG_DATA_DIRS=/home/watson/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share 
    DEBU XDG_MENU_PREFIX is unset                     
    DEBU XDG_RUNTIME_DIR=/run/user/1000               
    DEBU XDG_SEAT=seat0                               
    DEBU XDG_SESSION_DESKTOP=sway                     
    DEBU XDG_SESSION_ID=2                             
    DEBU XDG_SESSION_TYPE=wayland                     
    DEBU XDG_VTNR=1                                   
    DEBU Running in container fedora-toolbox-38:      
    DEBU podman                                       
    DEBU --log-level                                  
    DEBU error                                        
    DEBU exec                                         
    DEBU --detach-keys                                
    DEBU                                              
    DEBU --interactive                                
    DEBU --tty                                        
    DEBU --user                                       
    DEBU watson                                       
    DEBU --workdir                                    
    DEBU /home/watson                                 
    DEBU --env=COLORTERM=truecolor                    
    DEBU --env=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus 
    DEBU --env=DESKTOP_SESSION=sway                   
    DEBU --env=DISPLAY=:1                             
    DEBU --env=LANG=en_US.UTF-8                       
    DEBU --env=SHELL=/bin/bash                        
    DEBU --env=TERM=foot                              
    DEBU --env=TOOLBOX_PATH=/usr/bin/toolbox          
    DEBU --env=USER=watson                            
    DEBU --env=WAYLAND_DISPLAY=wayland-1              
    DEBU --env=XDG_CURRENT_DESKTOP=sway               
    DEBU --env=XDG_DATA_DIRS=/home/watson/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share 
    DEBU --env=XDG_RUNTIME_DIR=/run/user/1000         
    DEBU --env=XDG_SEAT=seat0                         
    DEBU --env=XDG_SESSION_DESKTOP=sway               
    DEBU --env=XDG_SESSION_ID=2                       
    DEBU --env=XDG_SESSION_TYPE=wayland               
    DEBU --env=XDG_VTNR=1                             
    DEBU fedora-toolbox-38                            
    DEBU capsh                                        
    DEBU --caps=                                      
    DEBU --                                           
    DEBU -c                                           
    DEBU exec "$@"                                    
    DEBU /bin/sh                                      
    DEBU /bin/bash                                    
    DEBU -l                                           
    Error: terminfo entry not found for foot
    ⬢[watson@toolbox watson]$ 

Steps how to reproduce the behaviour

    1. boot fedora 38 sericea iso
    2. launch foot
    3. type: toolbox enter
    4. observe last line of output is: Error: terminfo entry not found for foot

Expected behaviour

    toolbox enter creates the default toolbox and exits quietly without error

Actual behaviour

    Error: terminfo entry not found for foot

Output of toolbox --version (v0.0.90+)

    toolbox version 0.0.99.3

    toolbox-0.0.99.3-10.fc38.x86_64

    Client:       Podman Engine
    Version:      4.4.1
    API Version:  4.4.1
    Go Version:   go1.20.1
    Built:        Fri Feb 17 05:26:16 2023
    OS/Arch:      linux/amd64

    podman-4.4.1-3.fc38.x86_64

    Linux fedora 6.2.0-63.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Feb 20 15:07:34 UTC 2023 x86_64 GNU/Linux
davidthewatson commented 1 year ago

I wasn't sure where to submit this and whether it's a bug or feature request given the pre-release nature of the ISO for testing. Please let me know where to report it, if this is not the right place. This is the third time I've submitted the issue in two days. Just trying to help. Thanks!

davidthewatson commented 1 year ago

I'm happy to submit a PR but I wasn't sure where to go or how to proceed. The resolution is clear from this log:

    [watson@fedora ~]$ toolbox enter
    Error: terminfo entry not found for foot
    ⬢[watson@toolbox watson]$ dnf search foot-terminfo
    Last metadata expiration check: 0:01:41 ago on Wed 22 Feb 2023 02:43:22 PM EST.
    ============================================================================= Name Exactly Matched: foot-terminfo =============================================================================
    foot-terminfo.x86_64 : Terminfo files for foot terminal
    ⬢[watson@toolbox watson]$ sudo dnf install foot-terminfo
    Last metadata expiration check: 0:03:37 ago on Wed 22 Feb 2023 02:41:42 PM EST.
    Dependencies resolved.
    ===============================================================================================================================================================================================
     Package                                          Architecture                              Version                                            Repository                                 Size
    ===============================================================================================================================================================================================
    Installing:
     foot-terminfo                                    x86_64                                    1.13.1-2.fc38                                      fedora                                     12 k

    Transaction Summary
    ===============================================================================================================================================================================================
    Install  1 Package

    Total download size: 12 k
    Installed size: 8.1 k
    Is this ok [y/N]: y
    Downloading Packages:
    foot-terminfo-1.13.1-2.fc38.x86_64.rpm                                                                                                                          33 kB/s |  12 kB     00:00    
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                           17 kB/s |  12 kB     00:00     
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                                                                                                       1/1 
      Installing       : foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                    1/1 
      Verifying        : foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                    1/1 

    Installed:
      foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                                           

    Complete!
    ⬢[watson@toolbox watson]$ exit
    logout
    [watson@fedora ~]$ toolbox enter
    ⬢[watson@toolbox watson]$ 
debarshiray commented 1 year ago

Since you seem to have the terminfo(5) entry for foot on your Fedora 38 host, but not in the fedora-toolbox-38 container, my first line of inquiry would be to find out who installed the foot-terminfo RPM on the host? Was it installed by default?

debarshiray commented 1 year ago

This is the third time I've submitted the issue in two days.

I am curious about where else you tried to pursue this. Did you find out anything useful? :)

debarshiray commented 1 year ago

I suppose you are using Sway because I see the Sway Window Manager package group was added for Fedora 38 and foot is part of it.

Would it be possible to get the terminfo(5) entry for foot added to ncurses? That's where the majority of the entries reside. There's ncurses-base for the most common ones and ncurses-term for the rest.

The rough goal with the fedora-toolbox images is to offer a similar command line user experience to that on Fedora Silverblue and Workstation. Of course, Sway isn't GNOME, which makes this a bit awkward.

sbor23 commented 1 year ago

Hi, I'm trying the new fedora 38 beta for sericea, which is the new sway SIG as you already guessed. I'm facing the same issue.

my first line of inquiry would be to find out who installed the foot-terminfo RPM on the host? Was it installed by default?

Yes it seems to be installed by default on the host.

I am curious about where else you tried to pursue this. Did you find out anything useful? :)

I found this issue in the fedora issue tracker. https://gitlab.com/fedora/sigs/sway/SIG/-/issues/19

No idea about ncurses, that seems to be a topic that fedora devs would need to look at. But yeah there are quite a few SIGs now with rpm-ostree and they obviously will have different packages installed by default?! Like Kionite for example https://kinoite.fedoraproject.org/de/

davidthewatson commented 1 year ago

Since you seem to have the terminfo(5) entry for foot on your Fedora 38 host, but not in the fedora-toolbox-38 container, my first line of inquiry would be to find out who installed the foot-terminfo RPM on the host? Was it installed by default?

Good question. I believe foot-terminfo was there by default if it was there at all. I don't install things without a cascade of thought regarding potential side effects; thus, my interest in silverblue.

It's worth noting that the entire filesystem in the host and the toolbox appears to have changed though I'm not certain of the cause outside progress.

In this iteration, my uname -a reports:

Linux acer-swift-purple.watsonian.org 6.2.9-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:32:58 UTC 2023 x86_64 GNU/Linux

The iso I have is marked 4-12-2023 but I cannot find a reference to it in the seemingly random google result list for sericea iso which is all over the place to say the least. It would be easier to locate if there was a canonical fedora result, but these are all mirrors.

At any rate, this version has no foot-terminfo anywhere on the entire system. I'll try installing it from the toolbox now as I did before.

davidthewatson commented 1 year ago

This is the third time I've submitted the issue in two days.

I am curious about where else you tried to pursue this. Did you find out anything useful? :)

I literally reported the bug 3 separate times in 3 different repos/issue trackers/forums, maybe more. I've used fedora since I shipped cobind linux based on fedora core 1 or 2. Surely, there must be a better way for new potentials to engage with emergent projects and be not immediately productive, but find what they need quickly?

OT, but for feedback, I'd recommend taking a page from the Daniele Procida playbook at canonical:

https://canonical.com/blog/engineering-transformation-through-documentation

I'm not a fan of ubuntu, but what the doc team are doing there is potentially game changing. But I digress.

I maybe under-thinking this, but it doesn't seem like getting foot-terminfo fixed in either the immutable host infra or the mutable guest base image shoul be difficult. I'd be happy to try if I just had a few pointers into the new contributor cycle.

I'd rather fix it than complain. It's clearly broken since we've left n-of-1 and arrived at n=2.

davidthewatson commented 1 year ago

I suppose you are using Sway because I see the Sway Window Manager package group was added for Fedora 38 and foot is part of it.

Would it be possible to get the terminfo(5) entry for foot added to ncurses? That's where the majority of the entries reside. There's ncurses-base for the most common ones and ncurses-term for the rest.

The rough goal with the fedora-toolbox images is to offer a similar command line user experience to that on Fedora Silverblue and Workstation. Of course, Sway isn't GNOME, which makes this a bit awkward.

I've used toolbox for a while as it and podman have evolved.

I'd ask why the similar CLI experience should be a GUI and not the CLI itself in raw form?

If there is anything linux doesn't need more of, it's mixing GUI and CLI experiences in a way that ignores inconsistent dependencies whether GTK, Qt, wayland, etc. I get it from a product design standpoint, but there are problems here that shouldn't happen or should be easily resolvable. Clearly, the bug is easily resolvable from my experience fixing it. I didn't expect to be fixing it yet again two months later. I thought the evidence was clear from the missing f dir for foot-terminfo in the guest's share dir. I didn't put in on the host, so this is all from the iso build process or its upstream.

And yes: sway FTW! I may be opinionated but nothing has transformed my experience and satisfaction on linux desktop over two decades more than sway. I'm sure I'm not alone in that opinion. I mean, I've deprecated all manner of tools from tmux to other CLI affordances that I just don't need with sway.

sericea is great work, but the community just needs to engage with the collaborators it has access to.

Happy to help. Just need a pointer in the right direction.

davidthewatson commented 1 year ago

The work-around I reported here still works with the updated rawhide build iso from early april. I just did the same steps I reported above and the error disappears. The question is how to get the guest's base image to include the foot-terminfo package? It's only 12k:

    ===============================================================================================================================================================================================
     Package                                          Architecture                              Version                                            Repository                                 Size
    ===============================================================================================================================================================================================
    Installing:
     foot-terminfo                                    x86_64                                    1.13.1-2.fc38                                      fedora                                     12 k

    Transaction Summary
    ===============================================================================================================================================================================================
    Install  1 Package

    Total download size: 12 k
    Installed size: 8.1 k
    Is this ok [y/N]: y
    Downloading Packages:
    foot-terminfo-1.13.1-2.fc38.x86_64.rpm                                                                                                                          43 kB/s |  12 kB     00:00    
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                           20 kB/s |  12 kB     00:00     
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                                                                                                       1/1 
      Installing       : foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                    1/1 
      Verifying        : foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                    1/1 

    Installed:
      foot-terminfo-1.13.1-2.fc38.x86_64                                                                                                                                                           

    Complete!
pierreprinetti commented 1 year ago

For the posterity: as mentioned above, the solution is to install the relevant terminfo package in the Toolbox container:

⬢[you@toolbox]~% sudo dnf install foot-terminfo

As an alternative, set Foot to use a well-known terminfo, by adding this line to your foot.ini:

term=xterm-256color
debarshiray commented 1 year ago

I am curious about where else you tried to pursue this. Did you find out anything useful? :)

I found this issue in the fedora issue tracker. https://gitlab.com/fedora/sigs/sway/SIG/-/issues/19

Thanks for that reference. As mentioned on Foot's website, the terminfo(5) entries are already part of ncurses: https://codeberg.org/dnkl/foot/wiki#user-content-foot-s-terminfo-vs-ncurses-terminfo

Given the fact that Fedora now has a Sway spin, I think that we should move the entries from ncurses-term to ncurses-base in Fedora. I filed a bug and a pull request to do that: https://bugzilla.redhat.com/show_bug.cgi?id=2217982 https://src.fedoraproject.org/rpms/ncurses/pull-request/6

As for the fact that Foot has multiple variants of its terminfo(5) entries, I think it's reasonable for things to default to the upstream variant that's part of ncurses. Those who want the extra bells and whistles will have to configure Foot and install foot-terminfo separately.

Note that foot-terminfo currently conflicts with ncurses-term: https://bugzilla.redhat.com/show_bug.cgi?id=2217996

debarshiray commented 1 year ago

I literally reported the bug 3 separate times in 3 different repos/issue trackers/forums, maybe more. I've used fedora since I shipped cobind linux based on fedora core 1 or 2. Surely, there must be a better way for new potentials to engage with emergent projects and be not immediately productive, but find what they need quickly?

Yes, the Fedora infrastructure has fractured a bit in recent times. It's a fallout from various ongoing transitions; and new emergent groups experimenting with different approaches, not just with the code, but also the workflows around it. I get lost very often too. :/

debarshiray commented 1 year ago

I suppose you are using Sway because I see the Sway Window Manager package group was added for Fedora 38 and foot is part of it. Would it be possible to get the terminfo(5) entry for foot added to ncurses? That's where the majority of the entries reside. There's ncurses-base for the most common ones and ncurses-term for the rest. The rough goal with the fedora-toolbox images is to offer a similar command line user experience to that on Fedora Silverblue and Workstation. Of course, Sway isn't GNOME, which makes this a bit awkward.

I've used toolbox for a while as it and podman have evolved.

I'd ask why the similar CLI experience should be a GUI and not the CLI itself in raw form?

The CLI runs inside a GUI, and as this issue has shown, they interact with each other. Notice how this issue only affects the Sway Spin or Foot, but not the others like Workstation or KDE or GNOME Terminal or Konsole.

If there is anything linux doesn't need more of, it's mixing GUI and CLI experiences in a way that ignores inconsistent dependencies whether GTK, Qt, wayland, etc. I get it from a product design standpoint, but there are problems here that shouldn't happen or should be easily resolvable.

We need to draw the line somewhere for the fedora-toolbox images. We define that somewhere to be the command line user experience on Fedora Silverblue and Workstation.

This makes sense because Fedora Workstation is a Fedora Edition today and Silverblue is the next iteration of it. Editions are the primary Fedora outputs, and, when it comes down to it, might get prioritized over a Spin.

Clearly, the bug is easily resolvable from my experience fixing it. I didn't expect to be fixing it yet again two months later. I thought the evidence was clear from the missing f dir for foot-terminfo in the guest's share dir. I didn't put in on the host, so this is all from the iso build process or its upstream.

And yes: sway FTW! I may be opinionated but nothing has transformed my experience and satisfaction on linux desktop over two decades more than sway. I'm sure I'm not alone in that opinion. I mean, I've deprecated all manner of tools from tmux to other CLI affordances that I just don't need with sway.

sericea is great work, but the community just needs to engage with the collaborators it has access to.

I would say that it's a bug in the development of the Sway Spin. It's a matter of ensuring that the terminfo(5) entries are moved from ncurses-term to ncurses-base like every other popular terminal emulator out there.

The Spin is new. Over time these things will get ironed out. :)

debarshiray commented 1 year ago

I am going to close this one in favour of: https://bugzilla.redhat.com/show_bug.cgi?id=2217982 https://src.fedoraproject.org/rpms/ncurses/pull-request/6

Foot has multiple variants of their terminfo(5) entries. So, it's up to Fedora's Sway SIG and the Foot packagers to decide which one they want to default to, and ensure that the variant is part of Fedora's ncurses-base RPM and have Foot use that.

Also, the file conflicts need to be resolved: https://bugzilla.redhat.com/show_bug.cgi?id=2217996

debarshiray commented 1 year ago

Thanks for chasing this down @davidthewatson !

debarshiray commented 1 year ago

Just to be clear, the current file conflicts in foot-terminfo make it a bad idea to include it in the fedora-toolbox images. They will prevent ncurses-term from being installed, causing an even bigger problem.

debarshiray commented 1 year ago

Once they are resolved, it's a question of whether Foot prefers to work well with OCI containers or with tmux. I use neither Foot nor tmux, so I can't really answer this, because it's a matter of balancing what it means to work well or not.

Moving things forward in the world of terminal emulators is quite hard. I can empathize with that as someone who spent a few years pushing Fedora's terminal emulation stack forward. However, that doesn't mean that the problem gets pushed on other people, like those building OCI images. It's something that the terminal emulation community has to solve.

Note that this problem can't really be solved by the fedora-toolbox image installing foot-terminfo. One can use Foot and Toolbx on Fedora to run a RHEL container, which is almost certain to not have foot-terminfo. Toolbx offers built-in support for Arch Linux and Ubuntu containers, so all those images would have to be updated.