IBM Support

AIX Base Commands: vi editor does not load

Question & Answer


Question

Non-root users cannot run vi. 

$ /usr/bin/vi file.txt
$

The user is returned to command line, without errors. How can we determine the cause, and how can we fix the problem? 

Answer

1) Examine the path to ensure the command exists, and has executable permissions.
  • Note:  If the issue is due to permissions, or path, errors are normally printed, but you should verify the file anyway.
$ ls -al `which vi`
-r-xr-xr-x    5 bin      bin          363640 Sep 15 2020  /usr/bin/vi

The file exists, with executable permissions for all.

2) You can redirect stderr to reveal any errors that were written before the screen was initialized.

$ vi file.txt >err.out 2>&1
$ more err.out 

^[[?1049h^[[24;1H"/var/tmp/Ex45784" ^[[7mThe file access permissions do not allow the specified action.^[[27m

3) Alternatively, you can collect a truss to look for general errors.

$ truss -wALL -feado truss.out vi file.txt

Examine the truss output. You can usually ignore ENOTTY, ENOENT, and even EBADF for the first review. Look for the last "kopen" errors before any error messages are written. 
  • Note: the stderr for the vi editor is written to /dev/null before the screen is initialized. 

3145932: 12058817: 0.0662:        kopen("/var/tmp/Ex45932", O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR) Err#13 EACCES
3145932: 12058817: 0.0665:        __ksetjmp(0x30412AC0, 0x0000000D, 2, 0x30412B24, 0x2FF22310, 0x32228302, 0x3000590C, 0xD0187A28) = 0
3145932: 12058817: 0.0669:        access("/usr/lib/nls/msg/en_US/libc.cat", 0) = 0
3145932: 12058817: 0.0673:        _getpid()             = 3145932
3145932: 12058817: 0.0676:        kopen("/usr/lib/nls/msg/en_US/libc.cat", O_RDONLY) = 3
3145932: 12058817: 0.0680:        kioctl(3, 22528, 0x00000000, 0x00000000) Err#25 ENOTTY
3145932: 12058817: 0.0683:        kfcntl(3, F_SETFD, 0x00000001) = 0
3145932: 12058817: 0.0686:        kioctl(3, 22528, 0x00000000, 0x00000000) Err#25 ENOTTY
3145932: 12058817: 0.0689:        kread(3, "\0\001 ▒\007\007 I S O 8".., 4096) = 4096
3145932: 12058817: 0.0693:        lseek(3, 0, 1)                = 4096
3145932: 12058817: 0.0696:        lseek(3, 0, 1)                = 4096
3145932: 12058817: 0.0699:        __libc_sbrk(0x00000000) = 0x309DA470
3145932: 12058817: 0.0702:        lseek(3, 0, 1)                = 4096
3145932: 12058817: 0.0706:        _getpid()             = 3145932
3145932: 12058817: 0.0709:        lseek(3, 0, 1)                = 4096
3145932: 12058817: 0.0712:        close(3)              = 0
3145932: 12058817: 0.0715:        kwrite(1, 0x30006558, 34) = 34
3145932:   1B [ ? 1 0 4 9 h1B [ 2 4 ; 1 H " / v a r / t m p / E x 4 5 9 3 2
3145932:    "
3145932: 12058817: 0.0722:        kwrite(2, 0x30006558, 66) = 66
3145932:   1B [ 7 m T h e   f i l e   a c c e s s   p e r m i s s i o n s
3145932:    d o   n o t   a l l o w   t h e   s p e c i f i e d   a c t i o
3145932:    n .
3145932: 12058817: 0.0727:        kwrite(2, 0x30006558, 5) = 5
3145932:   1B [ 2 7 m
3145932: 12058817: 0.0732:        _getpid()             = 3145932
3145932: 12058817: 0.0735:        kwrite(1, 0x30006558, 1) = 1
3145932:   \n
3145932: 12058817: 0.0740:        lseek(0, 0, 2)                = 0
3145932: 12058817: 0.0743:        __ksetjmp(0x30412AC0, 0x00000001, 18, 0x00000000, 0x00000000, 0x00000000, 0xF081E1A8, 0xD0187A28) = 0
3145932: 12058817: 0.0746:        kwrite(1, 0x30006558, 1) = 1
3145932:   \n
3145932: 12058817: 0.0751:        kwrite(1, 0x30006558, 8) = 8
3145932:   1B [ ? 1 0 4 9 l
3145932: 12058817: 0.0755:        kioctl(2, 21511, 0xF0561E66, 0x00000000) = 0
3145932: 12058817: 0.0759:        kwrite(1, 0x30006558, 3) = 3
3145932:   1B [ J
3145932: 12058817: 0.0763:        kwrite(1, 0x30006558, 12) = 12
3145932:   1B [ ? 1 2 l1B [ ? 2 5 h
3145932: 12058817: 0.0768:        kfcntl(1, F_GETFL, 0x00000000) = 67110914
3145932: 12058817: 0.0771:        kfcntl(2, F_GETFL, 0x2FF22FFC) = 67110914
3145932: 12058817: 0.0775:        _exit(1)

4) Check the permissions of /var/tmp.

$ ls -ld /var/tmp
drwxrwsr-t    4 bin      bin            8192 Apr 27 09:05 /var/tmp


5) Check the user attributes.

$ lsuser -a groups userA
userA groups=staff

Root Cause:
The user is not a member of the "bin" group, so cannot access the tmp directory. The default permissions for /var/tmp were modified. The permissions should be drwxrwsrwt   

Solution:

# chmod 1777 /var/tmp



SUPPORT

If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract.  

1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue.

2. Capture any logs or data relevant to the situation.

3. Contact IBM to open a case:

   -For electronic support, see the IBM Support Community:
     https://www.ibm.com/mysupport
   -If you require telephone support, see the web page:
      https://www.ibm.com/planetwide/

4. Provide a clear, concise description of the issue.

 - For more information, see: Working with IBM AIX Support: Describing the problem.

5. If the system is accessible, collect a system snap, and upload all of the details and data for your case.

 - For more information, see: Working with IBM AIX Support: Collecting snap data


[{"Type":"MASTER","Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cvzgAAA","label":"Commands"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions"}]

Document Information

More support for:
AIX

Component:
Commands

Software version:
All Versions

Operating system(s):
AIX

Document number:
6575475

Modified date:
27 April 2022

UID

ibm16575475

Manage My Notification Subscriptions