Incus terminal emulator scaling problems

Hello, I know this is kind of stupid, but I have been trying to solve this slight annoyance with Incus. I have tried this with multiple terminal emulators, but still nothing. For some reason if commands are long enough there will just back loop and the command gets cut off when reaching a certain length. Then with something like nano, it doesn’t fill up the entire terminal window:


This happens with foot, gnome-terminal, alacritty, and kitty.
I know this is something I can just live with, but as someone when compiles kernels using Incus, this is annoying especially when the log gets cut off. This also happens with LXD, but not LXC oddly enough. I am using Arch with Hyprland.
Thanks in advance!

Normally attempting to resize your terminal window should send the new terminal size through the API.

You can check the values with tput cols and tput lines.

1 Like

Hello! Thank you for the response.
I see in my standard terminal emulator it interactively changes as soon as I move my window, but as soon as I get into the container, tput cols stays at a fixed 80, and tput lines stays at 24 no matter how much I change the window.
So, what should I do to correctly pass the information?

@stgraber sorry for responding again, but I wanted to ask, is there a possible way to correctly pass the information to incus from my host system? I couldn’t find anything related to it in the wiki about API.

The CLI tool gets SIGWINCH from your terminal and passes the information over the websocket API to the Incus server.

1 Like

Thanks. Well that doesn’t seem to be the case. I am not sure why. Is there any fix I can preform?
Even with other containers I use I still get the same problem.

Thanks. Well that doesn’t seem to be the case. I am not sure why. Is there any fix I can preform?
Even with other containers I use I still get the same problem.

You can try passing --debug and see if it shows you the SIGWINCH events when you resize the window.

1 Like

Ok, I will try.

You can also try running this python3 script in your terminal:

import signal
import time
from shutil import get_terminal_size

def resize_handler(signum=signal.SIGWINCH, frame=None):
    w, h = get_terminal_size()
    print('handled window resize {}x{}'.format(w, h))

signal.signal(signal.SIGWINCH, resize_handler)
time.sleep(30)

During the 30s it runs for, it will show you a line every time it detects the terminal has been resized. If resizing your terminal doesn’t print anything, then that explains why Incus also doesn’t notice anything and would then be a bug of your terminal or window manager.

1 Like

Yep it can tell.

Unfortunately, it is not passing to Incus though. It detected nothing.

Although what is really interesting, is when I --debug with incus console climbing-pigeon --debug it seems to detect the SIGWINCH events.

Hey, @stgraber sorry for responding again, but I have not received a response back in 2 days, any way to properly pass it to the Incus container? I mean it is receiving the signal, but it isn’t actually scaling at all.

Oh, and I tried it on a completely different Arch system this time with cinnamon as the desktop environment and still it stays at a fixed 80 and 24, but still gets the window resize signals.

Not having any luck replicating this issue here.

Is it a container or a VM? What’s the exact incus exec command you’re running?

1 Like

It is a container running Ubuntu 22.04. I also tried an Ubuntu VM, as well as an Arch and Mint container.

I tried using this incus exec command: incus exec ubuntu --debug -- login
As well as: incus console ubuntu --debug
Both of these clearly show that the container is receiving the signal:

 DEBUG  [2024-05-13T12:52:27-05:00] Received 'window changed signal', updating window geometry.

Although, is it really supposed to be receiving a window size signal with that small of a window size?

Is this something that is only happening on my computers or something?
Actually even when manually editing the tput lines and tput cols the window size still remains the same. It never even reaches 1920 by 1080 will terminal is full screen.

I can’t reproduce. You do not specify exact steps, so I took the liberty.

  1. Launch a images:debian/12 container. Host is Ubuntu 22.04.
  2. Get a shell into that container with incus exec mycontainer -- sudo -l debian.
  3. Install vi/nano.
  4. Start one of the editors.
    1. Resize using F11 (full screen/restore to previous size): works for me.
    2. Resize terminal window using the mouse: works for me

In these tests the text editor receives the appropriate changes and adapts immediately.

This is very interesting. Could this just be something with the Arch package, then? Maybe I will try building from the source.
Even with following the steps you proposed, I still can’t seem to resize nano.
What I did is this on other containers:

  1. Launch a images:ubuntu/22.04 container. The host is the latest Arch Linux release.
  2. Get into the root user of the container with incus exec mycontainer -- passwd and then incus console mycontainer and login into root.
  3. Update packages and install nano.
  4. Start on of the editors.

In my tests with the archlinux incus package it does not seem to inteperate the signal correctly.

@simos could you try on a arch linux virtual machine and installing incus?