Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while lunarvim installation unknown flag 'u' (read workaround at the top of the issue) #3612

Closed
hamzamohdzubair opened this issue Dec 15, 2022 · 83 comments
Labels
bug Something isn't working good-first-issue Good for newcomers help-wanted stale

Comments

@hamzamohdzubair
Copy link

hamzamohdzubair commented Dec 15, 2022

how to fix this issue (maintainer edit)

#3612 (comment)
Remove exec -a "$NVIM_APPNAME" from ~/.local/bin/lvim as a workaround

Problem description

I get the following error as the last line of the installation process (see screenshots)
And i get the same error when i try to run lunarvim later using lvim

error: unknown flag `u'

LunarVim version

1.2

Neovim version (>= 0.8.0)

NVIM v0.8.1

Operating system/version

CentOS Linux 7 (Core)

Steps to reproduce

  1. Install neovim

Screenshots

image
image
image

@hamzamohdzubair hamzamohdzubair added the bug Something isn't working label Dec 15, 2022
@LostNeophyte
Copy link
Member

Send the output of nvim --help

@hamzamohdzubair
Copy link
Author

hamzamohdzubair commented Dec 15, 2022

@LostNeophyte

Send the output of nvim --help
image

@LostNeophyte
Copy link
Member

interesting, -u is in the list. Create a file.lua and run nvim -u file.lua, will it work?

@hamzamohdzubair
Copy link
Author

interesting, -u is in the list. Create a file.lua and run nvim -u file.lua, will it work?

yes it worked

@LostNeophyte
Copy link
Member

does lvim -u file.lua work?

@hamzamohdzubair
Copy link
Author

hamzamohdzubair commented Dec 15, 2022

does lvim -u file.lua work?

image
image

@LostNeophyte
Copy link
Member

send the output of cat ~/.local/bin/lvim

@hamzamohdzubair
Copy link
Author

send the output of cat ~/.local/bin/lvim

image

@LostNeophyte
Copy link
Member

what about nvim --headless -u NONE

@LostNeophyte
Copy link
Member

and if you have nvim in ~/.local/bin/nvim, test it too

@hamzamohdzubair
Copy link
Author

what about nvim --headless -u NONE

just freezes
image

@hamzamohdzubair
Copy link
Author

and if you have nvim in ~/.local/bin/nvim, test it too

no nvim in ~/.local/bin/

@LostNeophyte
Copy link
Member

what about nvim --headless -u NONE

just freezes image

that's expected, idk what's wrong tbh since nvim -u works

@hamzamohdzubair
Copy link
Author

hamzamohdzubair commented Dec 15, 2022

what about nvim --headless -u NONE

just freezes image

that's expected, idk what's wrong tbh since nvim -u works

i have been using lunarvim since last 2-3 months without any problems, recently i reinstalled nvim from snap, earlier i was using appimage

@LostNeophyte
Copy link
Member

we have an experimental lunarvim appimage with bundled nvim btw https://github.com/LostNeophyte/LunarVim/releases/tag/stable

@hamzamohdzubair
Copy link
Author

hamzamohdzubair commented Dec 15, 2022

we have an experimental lunarvim appimage with bundled nvim btw https://github.com/LostNeophyte/LunarVim/releases/tag/stable

this is pretty smooth, i like it thanks. the lunarvim appimage just starts and runs perfectly.
Thanks again for this.

However, since I have not been able to solve this problem, i will keep the issue open for now. hope that's fine

@LostNeophyte
Copy link
Member

LostNeophyte commented Dec 15, 2022

does bash -c "exec nvim -u NONE" or bash -c "nvim -u NONE" trigger the same error?

@George-Spanos
Copy link

Hello!! I'm continuing this thread since I have the same exact issue up until this point of the convo. Unfortunately I get the same error even by using the .deb (I'm on Ubuntu).
bash -c "exec nvim -u NONE" just opens a nvim normally.

@LostNeophyte
Copy link
Member

LostNeophyte commented Jan 12, 2023

What if you remove exec -a lvim (exec -a "$NVIM_APPNAME" in newer versions) from ~/.local/bin/lvim and then run lvim?

@George-Spanos
Copy link

What if you remove exec -a lvim from ~/.local/bin/lvim and then run lvim?

For me, removing fixed the issue!

@Philipp0205
Copy link

For me lvim starts now, but not with the usual start screen and theme. Something seems to be broken.

@LostNeophyte
Copy link
Member

For me lvim starts now, but not with the usual start screen and theme. Something seems to be broken.

Run :PackerSync for 1.2 / :Lazy sync for master

@LostNeophyte
Copy link
Member

LostNeophyte commented Jan 12, 2023

@George-Spanos @Philipp0205 what shell are you using? what's its version and the version of bash and your OS?

I'll need to reproduce and fix this

@Philipp0205
Copy link

Philipp0205 commented Jan 12, 2023

@LostNeophyte Okay PackerSync helped. It's my first time using lvim so I was a bit confused :)

After removing exec -a lvim everything works!

➜  ~ neofetch
            .-/+oossssoo+/-.               philipp@x1 
        `:+ssssssssssssssssss+:`           ---------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.10 x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: 20UAS6FH00 ThinkPad X1 Carbon Gen 8 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.19.0-28-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 18 hours, 13 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3682 (dpkg), 43 (flatpak), 29 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: zsh 5.9 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1680x1050 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: Regolith 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: i3 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Theme: Dracula [GTK3] 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Icons: Dracula [GTK3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Terminal: gnome-terminal 
  +sssssssssdmydMMMMMMMMddddyssssssss+     CPU: Intel i7-10610U (8) @ 4.900GHz 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      GPU: Intel CometLake-U GT2 [UHD Graphics] 
    .ossssssssssssssssssdMMMNysssso.       Memory: 6240MiB / 15633MiB 

@George-Spanos
Copy link

I don't have any issues as @Philipp0205 describes. I'm using bash on Ubuntu 22.04.

@LostNeophyte
Copy link
Member

thanks, I'll try to reproduce it in an ubuntu container

@jagblad
Copy link

jagblad commented Jan 12, 2023

I've a similar problem. I think for me it may be due to having nvim installed via "snap", then it seems the lvim script tries to launch /snap/bin/nvim which is a symlink for /usr/bin/snap, so it launches snap instead of nvim. Snap doesn't have a "-u" option.

@George-Spanos
Copy link

I've a similar problem. I think for me it may be due to having nvim installed via "snap", then it seems the lvim script tries to launch /snap/bin/nvim which is a symlink for /usr/bin/snap, so it launches snap instead of nvim. Snap doesn't have a "-u" option.

Sounds reasonable, I will test if this is valid as well.

@LostNeophyte
Copy link
Member

I've a similar problem. I think for me it may be due to having nvim installed via "snap", then it seems the lvim script tries to launch /snap/bin/nvim which is a symlink for /usr/bin/snap, so it launches snap instead of nvim. Snap doesn't have a "-u" option.

so does nvim -u not work with snap installed nvim?

@AkioKiyota
Copy link

only remove -a "$NVIM_APPNAME", nothing more

it works thx :D

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 50 days with no activity.

@github-actions github-actions bot added the stale label Jul 25, 2023
@josielrocha
Copy link

only remove -a "$NVIM_APPNAME", nothing more

Same here. It works after deleting -a $NVIM_APPNAME.

lvim -v
NVIM v0.9.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/nvim/parts/nvim/build/.deps/usr/include/luajit-2.1 -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/build/src/nvim/auto -I/build/nvim/parts/nvim/build/build/include -I/build/nvim/parts/nvim/build/build/cmake.config -I/build/nvim/parts/nvim/build/src -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

@github-actions github-actions bot removed the stale label Jul 27, 2023
@MheniMerz
Copy link

this is what worked for me
i modified the first line of ~/.local/bin/lvim script to basically change the value of the NVIM_APPNAME variable

from

export NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}"

to

export NVIM_APPNAME="${NVIM_APPNAME:-"nvim"}"

@LostNeophyte
Copy link
Member

this is what worked for me i modified the first line of ~/.local/bin/lvim script to basically change the value of the NVIM_APPNAME variable

from

export NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}"

to

export NVIM_APPNAME="${NVIM_APPNAME:-"nvim"}"

don't do that, it will use different directories if you do that, use the workaround I edited in at the top of the issue

@LostNeophyte LostNeophyte changed the title Error while lunarvim installation unknown flag 'u' Error while lunarvim installation unknown flag 'u' (read workaround at the top of the issue) Aug 5, 2023
@Qwer-TeX
Copy link

Qwer-TeX commented Aug 7, 2023

@hamzamohdzubair

Did you download nvim from snap?
sudo snap install --beta nvim --classic ?

@lackovic
Copy link

lackovic commented Aug 7, 2023

I am also getting the same error, right after installation:

$ lvim
error: unknown flag `u'

I installed Neovim through snap in order to get the last version.

What if you remove exec -a lvim from ~/.local/bin/lvim and then run lvim?

The last line of my ~/.local/bin/lvim is:

exec -a "$NVIM_APPNAME" nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@"

If I remove it then nothing happens when I run lvim.

@Qwer-TeX
Copy link

Qwer-TeX commented Aug 7, 2023

@lackovic

I think that you shouldn't install Neovim through snap because the ubuntu developer strip down the binary to save space.
I suggest that you either download the binaries from their website of build it yourself.

@LostNeophyte
Copy link
Member

@lackovic did you remove only the mentioned part of that line?

@lackovic
Copy link

lackovic commented Aug 9, 2023

I suggest that you either download the binaries from their website of build it yourself.

In that case I would have to keep Neovim manually up to date while with snap I get all my applications updated to their latest versions with sudo snap refresh.

did you remove only the mentioned part of that line?

The mentioned part exec -a lvim is not present on the last line of my ~/.local/bin/lvim:

exec -a "$NVIM_APPNAME" nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@"

I first tried to remove just exec -a, without that a warning is printed indefinitely:

$ lvim
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1

When I removed exec -a "$NVIM_APPNAME" then the application started and successfully installed 43 plugins.

It looks like it's working the same with or without exec.

Why is exec -a "$NVIM_APPNAME" part of the last line of ~/.local/bin/lvim if with that it does not work?

@LostNeophyte
Copy link
Member

exec -a "$NVIM_APPNAME" used to be exec -a lvim

Why is exec -a "$NVIM_APPNAME" part of the last line of ~/.local/bin/lvim if with that it does not work?

for some reason exec's -a flag breaks the nvim executable (or maybe its wrapper) from snap, the same happens with bob (nvim version manager)

@Peelz
Copy link

Peelz commented Sep 18, 2023

OS: Ubuntu 22.04

I'm not sure about root cause, but for me i was install neovim from snap.
After removed nvim from snap store, and use Applmage.
It's working now.

@obayit
Copy link

obayit commented Sep 19, 2023

@hamzamohdzubair
I remove the line mentioned in the workaround, but it gets readded after running the installation script again. Can you please show a detailed steps of how to install?

@bilenkonito
Copy link

bilenkonito commented Oct 26, 2023

The error is comming from /usr/bin/snap, not nvim:

$ /usr/bin/snap -u
error: unknown flag 'u'

The reason is that snap's shims work by symlinking each binary name to /usr/bin/snap, which then grabs the binary name from the 0th argument and executes the actual binary found inside the snap image.

The exec -a command is effectively passing lvim as the 0th argument to nvim but since snapd cannot find any snap declared binary called lvim, the execution of /snap/bin/nvim instead behaves as if /usr/bin/snap was being executed directly.

Copy link
Contributor

This issue is stale because it has been open for 50 days with no activity.

Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2023
@estrac
Copy link

estrac commented Feb 3, 2024

The workaround at the top of did not resolve this issue for me -- the installation of LunarVim still failed.

As @bilenkonito explained above, this is an issue with snap. I was able to successfully install LunarVim by first removing my neovim installation with:

sudo snap remove nvim

Then I installed neovim from source (which was surprisingly easy following neovim "Install from Source" instructions) and re-ran the LunarVim installation script.

@nb5p
Copy link

nb5p commented Feb 27, 2024

I encountered the same problem with bob-nivm. Modifying the last line as follows solved it.

exec nivm -u "$LUNARVIM_BASE_DIR/init.lua" "$@"

@WayneBuckhanan
Copy link

WayneBuckhanan commented Mar 22, 2024

FYI, snap has the ability to "alias" executable names so it resolves to the correct packaged executable when using another name to call it.

sudo snap alias nvim lvim

As long as your ~/.local/bin is before the snap nvim in your path, it will run the lvim script, then when the script calls the snap managed nvim, it has no issues with the exec -a renaming it lvim.

@Aegox
Copy link

Aegox commented Apr 16, 2024

Thats great, delete exec -a and run path of lvim

@ivandez
Copy link

ivandez commented May 1, 2024

as jagblad said, I had neovim installed via snap and it did not work, so I delete neovim with snap remove and then install it again with curl from neovim official doc and now it works https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good-first-issue Good for newcomers help-wanted stale
Projects
None yet