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

How to tell llamafile to *not* use system wine on a Linux box with wine installed #22

Closed
ronjouch opened this issue Dec 1, 2023 · 1 comment
Labels

Comments

@ronjouch
Copy link

ronjouch commented Dec 1, 2023

Today I tried simonwillison's llamafile example on 2 machines:

  • On my work machine (Debian 12.2, Gnome, Kitty/Fish, no wine installed), it runs flawlessly
  • On my home machine (Arch, Gnome, Kitty/Fish, wine installed), it seems to be automatically be detected as a Windows binary, tries to run via wine, and crashes:
20:41:24 ~ ./llamafile-server-0.1-llava-v1.5-7b-q4
0088:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
003c:fixme:service:scmdatabase_autostart_services Auto-start service L"wineusb" failed to start: 1114
00b0:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
00a8:err:sync:RtlpWaitForCriticalSection section 7BD9A2C0 "../wine/dlls/ntdll/loader.c: loader_section" wait timed out in thread 00a8, blocked by 00b0, retrying (60 sec)
003c:err:service:process_send_command receiving command result timed out
003c:fixme:service:scmdatabase_autostart_services Auto-start service L"WineBus" failed to start: 1053
003c:err:service:process_send_start_message service L"PlugPlay" failed to start
003c:fixme:service:scmdatabase_autostart_services Auto-start service L"PlugPlay" failed to start: 1053
00b0:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
00b0:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
00b0:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0154:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
wine: configuration in L"/home/ronj/.wine" has been updated.
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Bad EXE format for Z:\home\ronj\llamafile-server-0.1-llava-v1.5-7b-q4.

If instead of ./llamafile-server-0.1-llava-v1.5-7b-q4 I simply sh ./llamafile-server-0.1-llava-v1.5-7b-q4, things work well.

Is this a known glitch, or a problem with my machine? Can something be done by llamafile packaging / binary build to "de-prioritize" running via wine and prefer running as native Linux? Should README usage suggestion be updated to tell users to sh ./llamafile instead of just ./llamafile ?

@jart
Copy link
Collaborator

jart commented Dec 1, 2023

This is happening because your system configures binfmt_misc to run MZ executables under WINE. You can fix it by running:

sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo chmod +x /usr/bin/ape
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"

Let me know if that doesn't fix things, and I'll reopen this issue.

@jart jart closed this as completed Dec 1, 2023
@jart jart added the question label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants