Unable to run sudo in Guix on WSL

Hi. I installed Guix on WSL2 following this guide: Installing GuixSD on WSL2 - System Crafters.
However, after launching guix using the command

wsl -d guix --exec /bin/busybox sh -c "/root/boot.sh"

I am unable to run sudo or any command from /run/setuid-programs. It errors out as:

sh> sudo -s
sudo: effective uid is not 0, is /run/setuid-programs/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

Looks like WSL mounts /run with nosuid

sh> mount|grep run
none on /run type tmpfs (rw,nosuid,nodev,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)

Seeking help to fix this because I am unable to figure out a solution

Hello,
can anyone provide any pointers to a solution?

This might be helpful.

Personally, I’ve never installed guix on wsl. Maybe I’ll try it in the near future.

For completeness: @mrok’s answer works, or rather, NotTheDr01ds’ does. TL;DR:
Add

mount -o remount,suid,exec /run

to the guix-init.sh, preferably at the start, but definitely before any files are getting changed, e.g.

 #!/bin/busybox sh

+mount -o remount,suid,exec /run
+
 export GUIX_NEW_SYSTEM=$(/bin/busybox readlink -f /var/guix/profiles/system)
1 Like