PowerVM

 View Only
Expand all | Collapse all

VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

  • 1.  VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Fri March 08, 2024 08:37 AM

    I recently installed some new 4.1.0.10 VIO servers. During the configuration, I'm using vtmenu from the HMC to open a console to the VIO server.  Because I don't like the small terminal window, I typically resize my PuTTY or iTerm2 or MobaXterm session and run /usr/X11R7/bin/resize to scale my terminal window to the new window size. Well, in 4.1.0.10, that command no longer exists.  Any suggestions about how I can resize my terminal to the new window size?

    Thanks in advance,

    Lance



    ------------------------------
    Lance Hawkes
    ------------------------------


  • 2.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Fri March 08, 2024 10:00 AM

    Use the 'stty' command.

    stty size  : Shows the current window size.

    stty rows X cols Y   :  Set the window size

    stty rows 25 cols 80   : works for me!

    Consider that tools like VI will recognize and use this size. The command line will not.



    ------------------------------
    ========================
    Russell Adams
    https://adamssystems.nl/
    ========================
    ------------------------------



  • 3.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Fri March 08, 2024 12:54 PM

    Thank you. I've been using resize so long, I completely forgot about stty though I'll have to play with it.



    ------------------------------
    Lance Hawkes
    ------------------------------



  • 4.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Mon March 11, 2024 01:12 AM

    Since resize does not depend on X11 I created an Idea to put in back into VIOS as a standalone binary.

    Vote for it if you like it:

    https://ibm-power-systems.ideas.ibm.com/ideas/PVMV-I-118



    ------------------------------
    FREDRIK LUNDHOLM
    ------------------------------



  • 5.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    IBM Champion
    Posted Mon March 11, 2024 05:41 AM

    Given that "ldd resize" shows a bunch of X11 libraries, I doubt you can unbundle it from X11.

    /usr/lpp/X11/bin # ldd resize
    resize needs:
             /usr/lib/libc.a(shr.o)
             /usr/lib/libXt.a(shr4.o)
             /unix
             /usr/lib/libcrypt.a(shr.o)
             /usr/lib/libX11.a(shr4.o)
             /usr/lib/libSM.a(shr.o)
             /usr/lib/libICE.a(shr.o)
             /usr/lib/libXi.a(shr.o)
             /usr/lib/libpthreads.a(shr_xpg5.o)
             /usr/lib/libpthreads.a(shr_comm.o)
             /usr/lib/libiconv.a(shr4.o)
             /usr/lib/libIM.a(shr.o)
             /usr/lib/libXext.a(shr.o)
             /usr/lib/libgaimisc.a(shr.o)
             /usr/lib/libgair4.a(shr.o)
             /usr/lib/libodm.a(shr.o)



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------



  • 6.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Mon March 11, 2024 06:09 AM
    Edited by FREDRIK LUNDHOLM Mon March 11, 2024 06:09 AM

    Good catch.

    Before posting I just did a quick check in WSL:

     ldd /usr/bin/resize
            linux-vdso.so.1 (0x00007ffe2912e000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5de939b000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f5de95a7000)

    So there might be different sources of resize floating around.



    ------------------------------
    FREDRIK LUNDHOLM
    ------------------------------



  • 7.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    IBM Champion
    Posted Wed March 13, 2024 06:20 AM

    Hi Fredrik,

    Sorry, I missed your message and created another idea. But I checked before if any similar ideas are there and your idea is not on the list.



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 8.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Tue March 12, 2024 02:38 AM
    Edited by Zaki Jääskeläinen Tue March 12, 2024 03:06 AM

    The advantage with resize is that it probes the terminal window to determine its size. 
    eval $(/usr/lpp/X11/bin/resize) will set the COLUMNS and LINES variables.

    VIOS 4.1.0.10 is based on AIX 7.3 TL2 SP1. Install the X11.apps.xterm fileset from this AIX media. No other pre-requisites needed.

    I wonder why they decided to exclude xterm/resize while still keeping other lesser used X11 tools like xbiff and xcalc.



    ------------------------------
    Zaki Jääskeläinen
    ------------------------------



  • 9.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Tue March 12, 2024 10:36 AM

    It sounds like "stty size" can also do the job of probing the terminal window to determine its size. It would be a small matter, I think, to add a function to do the same for the login shell and to set the COLUMNS and LINES environment variables also? I did a quick test of adding these lines to /usr/ios/cli/.profile:

    # Set COLUMNS and LINES for proper terminal window size
    stty size | read Lines Columns
    eval export LINES=$Lines
    eval export COLUMNS=$Columns

    After logging out and logging back in, it seems to have done the job:
    $ echo $LINES $COLUMNS
    40 189

    I suppose might want to do likewise for root's profile, as well.



    ------------------------------
    Mackey Morgan
    ------------------------------



  • 10.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    IBM Champion
    Posted Mon March 11, 2024 06:18 AM

    I do resize in the next tab on an LPAR which has resize and then copy/paste the output into HMC window. These are two environment variables to export: COLUMNS and LINES.



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 11.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Tue March 12, 2024 11:07 AM

    Indeed as part of the new Rebase of VIOS several filesets were removed that weren't really used in the first place both to reduce the overall

    mksysb image of the VIOS and because several security scanning tools could be triggered by "unsafe" filesets.

    The resize binary indeed needs several X11 related libraries but I guess the function could also just be replicated by a ksh script as well ? 

    $ cat resize.sh
    #!/bin/ksh93

    # Get the number of lines and columns
    stty size | read lines cols

    # Print the results
    echo "COLUMNS=$cols;"
    echo "LINES=$lines;"
    echo "export COLUMNS LINES;"



    ------------------------------
    GEERT OOST
    ------------------------------



  • 12.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Tue March 12, 2024 11:23 AM

    Great suggestions!  I will play around with it a bit and see what I like the best.



    ------------------------------
    Lance Hawkes
    ------------------------------



  • 13.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Wed March 13, 2024 03:04 AM
      |   view attached

    I uploaded the source code (16 kB, msotly comments)  for resize as shipped with the xterm package. 

    (See attachement)

    It used the following X11 functions (probably because xterm written before libc standardized between Unixes).

    x_basename

    x_getenv

    x_getpwuid

    x_getlogin

    x_strdup

    x_basename

    x_strindex

    As expected the majority of code is written to calculate the current window size.

    It should be utterly trivial to substitute with modern equvilents and remove and X11 dependency,

    Have a look and suggest if resize.c does anything better compared to the alias/scrips

     suggeted above.



    ------------------------------
    FREDRIK LUNDHOLM
    ------------------------------

    Attachment(s)

    c
    resize.c   15 KB 1 version


  • 14.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    IBM Champion
    Posted Wed March 13, 2024 06:10 AM

    Getting LINES/COLUMNS example in C using curses library:

    #include <stdio.h>
    #include <curses.h>
    
    int main() {
    	int max_x, max_y;
    
    	initscr();
    	getmaxyx(stdscr, max_y, max_x);
    	endwin();
    	if (max_x == -1) {
    		fprintf(stderr, "getmaxyx() failed\n");
    		return 1;
    	}
    	printf("COLUMNS=%d; LINES=%d\n", (max_x - 1), (max_y - 1));
    }
    

    Compiling:

    size_curses: size_curses.c
    	gcc -o size_curses -lcurses size_curses.c
    

    Same using Python:

    #!/usr/bin/python3
    
    import curses
    
    try:
    	stdscr = curses.initscr()
    	height, width = stdscr.getmaxyx()
    finally:
    	curses.endwin()
    
    if height == -1:
    	print("getmaxyx() failed!")
    else:
    	print("COLUMNS=%d; LINES=%d" % (width, height))
    
    

    Python is now part of VIOS 4.1. If you put the python script into /usr/ios/cli/utils, you can call it from your padmin interface:

    $ ioslevel
    4.1.0.10
    $ who am i
    padmin      pts/1       Mar 13 05:08     (10.X.X.X) 
    $ resize
    COLUMNS=141; LINES=39
    


    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 15.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    IBM Champion
    Posted Wed March 13, 2024 06:18 AM

    To be consequent I added a new idea on IBM Ideas portal to return resize command back.

     Please vote.



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 16.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Wed March 13, 2024 06:30 AM

    This topic generates a lot of interest on the forum so I believe it is a valid request.



    ------------------------------
    FREDRIK LUNDHOLM
    ------------------------------



  • 17.  RE: VIOS 4.1.0.10 /usr/X11R7/bin/resize command is gone

    Posted Mon March 18, 2024 10:01 AM

    As more requests are seen here and idea is also submitted, we will review and see how to bring back "resize" command.



    ------------------------------
    RUPESH THOTA
    ------------------------------