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

Incorrect path for smbd on NixOS #722

Closed
ghost opened this issue Jun 20, 2023 · 8 comments · Fixed by #754
Closed

Incorrect path for smbd on NixOS #722

ghost opened this issue Jun 20, 2023 · 8 comments · Fixed by #754

Comments

@ghost
Copy link

ghost commented Jun 20, 2023

Expected behaviour

With the samba package installed on NixOS, QuickEMU should detect smbd and enable access to the guest VM

Actual behaviour

Even with samba package installed, the smbd service is not detected and therefore the mount is unavailable in the guest VM.

Steps to reproduce the behaviour

  1. Install "samba" package on NixOS
  2. Install "Windows 10" virtual machine through quickget
  3. Start Windows 10 VM and notice that smbd is not detected

Temporary solution

I was able to get the samba mount working by symlinking the path for smbd on NixOS to /usr/sbin/smbd

sudo ln -sf /nix/store/05g445bpar2qvzkipgpf9ba56pfqy2d0-samba-4.17.7/bin/smbd /usr/sbin/smbd

So perhaps there is another way QuickEMU should try to detect for smbd as opposed to how it is currently done. (reference)

if [[ -e "/usr/sbin/smbd" && -n ${PUBLIC} ]]; then
    NET="${NET},smb=${PUBLIC}"
    echo " - smbd:     On guest: smb://10.0.2.4/qemu"
fi

Quickemu output

Quickemu 4.7 using /nix/store/qf3cjxhw6iswisrk00km22zzzlmbacca-qemu-8.0.0/bin/qemu-system-x86_64 v8.0.0
 - Host:     "NixOS 23.11 (Tapir)" running Linux 6.1 (omer-laptop)
 - CPU:      Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
 - CPU VM:   1 Socket(s), 2 Core(s), 2 Thread(s), 8G RAM
 - MSR:      WARNING! Ignoring unhandled Model-Specific Registers is disabled.

             echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

             If you are unable to run macOS or Windows VMs then run the above 👆
             This will enable ignoring of unhandled MSRs until you reboot the host.
             You can make this change permenant by running: 'quickemu --ignore-msrs-always'
 - BOOT:     EFI (Windows), OVMF (/nix/store/x30jh78pnzv177sgj16f4gg7hqk5675y-OVMF-202302-fd/FV/OVMF_CODE.fd), SecureBoot (off).
 - Disk:     windows-10/disk.qcow2 (64G)
 - CD-ROM:   windows-10/virtio-win.iso
 - Display:  SPICE, qxl-vga, GL (on), VirGL (off)
 - ssh:      On host:  ssh user@localhost -p 22221
 - SPICE:    On host:  spicy --title "windows-10" --port 5931 --spice-shared-dir /home/omer
 - WebDAV:   On guest: dav://localhost:9843/
 - Network:  User (virtio-net)
 - Monitor:  On host:  nc -U "windows-10/windows-10-monitor.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:windows-10/windows-10-monitor.socket
 - Serial:   On host:  nc -U "windows-10/windows-10-serial.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:windows-10/windows-10-serial.socket
qemu-system-x86_64: -no-hpet: warning: -no-hpet is deprecated, use '-machine hpet=off' instead
 - Process:  Starting windows-10.conf as windows-10 (36307)
 - Viewer:   spicy --title "windows-10" --port "5931" --spice-shared-dir "/home/omer" "" >/dev/null 2>&1 &

Linux Distribution & Kernel

Run the following and paste the output.

No LSB modules are available.
Distributor ID:	NixOS
Description:	NixOS 23.11 (Tapir)
Release:	23.11
Codename:	tapir
Linux omer-laptop 6.1.31 #1-NixOS SMP PREEMPT_DYNAMIC Tue May 30 13:03:33 UTC 2023 x86_64 GNU/Linux
@github-actions
Copy link
Contributor

Hello there 👋
Thanks for submitting your first issue to the Quickemu project 🐛 We'll try and take a look at your issue soon ⏲

In the meantime you might want to join the Wimpys World Discord 🗣 where we have a large community of Linux 🐧 enthusiasts and passionate open source developers 🧑‍💻

You might also be interested in following Wimpys World Twitch 📡 channel where Wimpy streams let's code video, including this project, several times a week. A back catalog of past live stream and other Linux related content is available on Wimpys World YouTube 📺 channel.

@ghost
Copy link
Author

ghost commented Jun 20, 2023

Tested by updating the smbd check to use command -v smbd, but it turns out that QEMU also requires this path (/usr/sbin/smbd) to be filled. So this isn't an issue on QuickEMU's end.

For those also on NixOS, you will need to add an overlay for the QEMU package to enable smbdSupport on top of having samba installed.

qemu = prev.qemu.override { smbdSupport = true; };

@ghost ghost closed this as completed Jun 20, 2023
@ghost
Copy link
Author

ghost commented Jun 27, 2023

Re-opening this issue as it seems like updating the smbd filepath check is in fact required for NixOS alongside enabling smbdSupport for QEMU.

I have a fork that is working for me on NixOS. There is only a single line-change involved; however, I have not tested this on other devices.

--- a/quickemu
+++ b/quickemu
@@ -886,7 +886,7 @@ function vm_boot() {
   fi
 
   # If smbd is available and ~/Public is present export it to the guest via samba
-  if [[ -e "/usr/sbin/smbd" && -n ${PUBLIC} ]]; then
+  if [[ -x "$(command -v smbd)" && -n ${PUBLIC} ]]; then
       NET="${NET},smb=${PUBLIC}"
       echo " - smbd:     On guest: smb://10.0.2.4/qemu"
   fi

@Avi-D-coder
Copy link

Avi-D-coder commented Dec 17, 2023

As best as I can tell this is not fixed.
I have set smbdSupport = true overriding my nix qemu package and conf, but the only way I can use quickemu is by remove samba from my nixos config.
This error appears to come from qemu perhaps smbdSupport is not working anymore.
Is there any way of disabling samba manually in the quickemu conf ( I don't see one)?
If I delete smb=/home/USER/Public, from ./ubuntu-23.04/ubuntu-23.04.sh the VM starts fine.

❯ quickemu -vm ubuntu-23.04.conf   
Quickemu 4.9.1 using /nix/store/hkcnadnp482ps6whjsr2v2j78hpvcgr4-qemu-8.1.3/bin/qemu-system-x86_64 v8.1.3
 - Host:     "NixOS 24.05 (Uakari)" running Linux 6.6 (desktop)
 - CPU:       12th Gen Intel(R) Core(TM) i7-12700K
 - CPU VM:   1 Socket(s), 8 Core(s), 2 Thread(s), 32G RAM
 - BOOT:     EFI (Linux), OVMF (/nix/store/dii0icxmvymcn7mxc3xxz5jjmf835p6a-OVMF-202311-fd/FV/OVMF_CODE.fd), SecureBoot (off).
 - Disk:     ubuntu-23.04/disk.qcow2 (50G)
             Looks unused, booting from ubuntu-23.04/ubuntu-23.04-desktop-amd64.iso
 - Boot ISO: ubuntu-23.04/ubuntu-23.04-desktop-amd64.iso
 - Display:  SDL, virtio-vga-gl, GL (on), VirGL (on)
 - Sound:    intel-hda
 - ssh:      On host:  ssh user@localhost -p 22220
 - WebDAV:   On guest: dav://localhost:9843/
 - 9P:       On guest: sudo mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 Public-avi ~/Public
 - smbd:     On guest: smb://10.0.2.4/qemu
 - Network:  User (virtio-net)
 - Monitor:  On host:  nc -U "ubuntu-23.04/ubuntu-23.04-monitor.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:ubuntu-23.04/ubuntu-23.04-monitor.socket
 - Serial:   On host:  nc -U "ubuntu-23.04/ubuntu-23.04-serial.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:ubuntu-23.04/ubuntu-23.04-serial.socket
qemu-system-x86_64: -netdev user,hostname=ubuntu-23.04,hostfwd=tcp::22220-:22,smb=/home/USER/Public,id=nic: Could not find '/usr/sbin/smbd', please install it
cat: ubuntu-23.04/ubuntu-23.04.pid: No such file or directory
 - Process:  Starting ubuntu-23.04.conf as ubuntu-23.04 ()

@montchr
Copy link

montchr commented Dec 28, 2023

Confirming that this is still an issue for me as well. Something is still not quite right here. Could this be re-opened? Edit: Still not sure if it's a NixOS-specific issue -- disabling the system service worked for me too.

zeorin added a commit to zeorin/dotfiles that referenced this issue Apr 6, 2024
zeorin added a commit to zeorin/dotfiles that referenced this issue Apr 15, 2024
@nodupe
Copy link

nodupe commented Apr 17, 2024

I've just had the same issue. It only works when disabling Samba on my config.

@zeorin
Copy link

zeorin commented Apr 23, 2024

-quickemu
+(quickemu.override { qemu = qemu_full; })

Works for me.

zeorin added a commit to zeorin/dotfiles that referenced this issue Apr 23, 2024
zeorin added a commit to zeorin/dotfiles that referenced this issue Aug 10, 2024
zeorin added a commit to zeorin/dotfiles that referenced this issue Aug 10, 2024
@zeorin
Copy link

zeorin commented Nov 10, 2024

For anyone that isn't aware, in NixOS 24.05 this should be fixed, as quickemu in nixpkgs now uses qemu_full by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants