Sample Header Ad - 728x90

Double symlink of vim doesnt load library file ncurses.so.6 when invoked with sudo

0 votes
1 answer
119 views
I have a symlink of the vim.basic executable:
⤷ ls -l /etc/alternatives/vim
lrwxrwxrwx 1 root root 18 Apr 22 21:02 /etc/alternatives/vim -> /usr/bin/vim.basic
Another symlink to the above symlink as:
⤷ ls -l /usr/bin/vim         
lrwxrwxrwx 1 root root 21 Apr 22 21:02 /usr/bin/vim -> /etc/alternatives/vim
They are system configured as I would expect from update-alternatives and I haven't changed anything except I boot sometimes from linux kernel 5.4 or generally from 4.15 using the same root and home partition and this probably what created a problem running vim with sudo?:
⤷ sudo vim.basic                #This works fine!
⤷ sudo /etc/alternatives/vim    #This works fine!
⤷ sudo vim      
vim: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory
libncurses.so is installed in a path pointed to by LD_LIBRARY_PATH:
⤷ echo $LD_LIBRARY_PATH
/home/akd/dotapps/local/lib:

⤷ ls -l /home/akd/dotapps/local/lib/libncurses.so.6
lrwxrwxrwx 1 akd akd 17 Nov  9 21:24 /home/akd/dotapps/local/lib/libncurses.so.6 -> libncurses.so.6.2
I can't seem to understand why the double symlink cannot find the libcurses.so.6 on sudo vim operation. Normal vim binary without sudo works as expected though (doesnt compain about ncurses lib).
⤷ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 16 2021 13:33:23)
⤷ sudo --version
Sudo version 1.8.21p2
Sudoers policy plugin version 1.8.21p2
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.21p2
Any idea, why this weird behavior? Update: Adding more info as req:
⤷ ldd $(which vim)        
	linux-vdso.so.1 (0x00007ffc9a2a6000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9d5e059000)
	libncurses.so.6 => /home/akd/dotapps/local/lib/libncurses.so.6 (0x00007f9d5ddee000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d5dbea000)
	libpython3.6m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0 (0x00007f9d5d53f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9d5d320000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d5cf2f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9d5e909000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f9d5ccfd000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9d5cae0000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f9d5c8dd000)
Asked by Akash (111 rep)
Apr 22, 2021, 03:57 PM
Last activity: Apr 22, 2021, 04:25 PM