From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oHjkIJx19WI07gAAbAwnHQ (envelope-from ) for ; Thu, 11 Aug 2022 23:33:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UD/TH5x19WKxQQAAG6o9tA (envelope-from ) for ; Thu, 11 Aug 2022 23:33:16 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4661E319FC for ; Thu, 11 Aug 2022 23:33:16 +0200 (CEST) Received: from localhost ([::1]:46888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMFnm-0007aq-Sh for larch@yhetil.org; Thu, 11 Aug 2022 17:33:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMFna-0007Xt-LP for guix-patches@gnu.org; Thu, 11 Aug 2022 17:33:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMFna-0004Wj-AL for guix-patches@gnu.org; Thu, 11 Aug 2022 17:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMFna-0002Y1-46 for guix-patches@gnu.org; Thu, 11 Aug 2022 17:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#53912] [PATCH 0/5] WIP Add WSL support. References: <875ypndznv.fsf@ajgrf.com> In-Reply-To: <875ypndznv.fsf@ajgrf.com> Resent-From: Stefan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Aug 2022 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53912 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53912@debbugs.gnu.org Received: via spool by 53912-submit@debbugs.gnu.org id=B53912.16602535649766 (code B ref 53912); Thu, 11 Aug 2022 21:33:02 +0000 Received: (at 53912) by debbugs.gnu.org; 11 Aug 2022 21:32:44 +0000 Received: from localhost ([127.0.0.1]:55111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMFnH-0002XQ-OB for submit@debbugs.gnu.org; Thu, 11 Aug 2022 17:32:44 -0400 Received: from mr5.vodafonemail.de ([145.253.228.165]:39166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMFnE-0002XB-5v for 53912@debbugs.gnu.org; Thu, 11 Aug 2022 17:32:41 -0400 Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr5.vodafonemail.de (Postfix) with ESMTPS id 4M3g4x3TYDz1y67 for <53912@debbugs.gnu.org>; Thu, 11 Aug 2022 21:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-21dec; t=1660253553; bh=8rPqjeRMqCJBqQXTWGhkANRULaxg0Ocl1YwGE8rvUAY=; h=Content-Type:From:Date:Subject:Message-Id:To:X-Mailer:From; b=AZ7eynBq3pEYBWDAzDDyy1IChfI9GMoZRv8u295Duy5y1TrEK6xjOADwYcy1dSpBE rPFo1EdZNa9naI9r/FTWbajize+a4QIOhK9ytL/nuFC5n3wih+Slu1vJV7HVyz4NvQ LgESCu8gw0ChsbmHj9Lhe/So9nDJMzZKF4Mkwo6w= Received: from smtpclient.apple (aftr-62-216-207-4.dynamic.mnet-online.de [62.216.207.4]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4M3g4w6Sd4z9wQD for <53912@debbugs.gnu.org>; Thu, 11 Aug 2022 21:32:28 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Thu, 11 Aug 2022 23:32:27 +0200 Message-Id: <9B03DD4B-4699-40CB-95A6-C0369F1E7663@vodafonemail.de> X-Mailer: iPhone Mail (19G71) X-purgate-type: clean X-purgate: clean X-purgate-size: 2887 X-purgate-ID: 155817::1660253553-79BDF2A8-AEBA4140/0/0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Stefan X-ACL-Warn: , Stefan via Guix-patches From: Stefan via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660253596; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8rPqjeRMqCJBqQXTWGhkANRULaxg0Ocl1YwGE8rvUAY=; b=cZlonkXcftjd1EkP1DEoS62ceNSBPmQ2ewerTRA7LiMlABCmDpg4lwkrUpV85sWKV0u0+t hU+H0cFG4xIME2PXteOENDurZ81NbYqE1TC0hzH8AVRhbO+u1Zl+bfe9qDQhLBluLgsF8c 1vpukMltlNnY1Q1xz2phaLSOfnqjAqfgGfRM3W2Y805zgqIO8sbUcAnXPpq+F+lAn1rTg4 s/7IiNljwOVhegIpB6fB7iYApPyBYX6irEMtd6vHu24ZVEprDNvjbEg99hBkGMQjBU1M10 NgSmz/hDc36COX3FyJcJn4fmcLKViP8H/7u5mTw83HT3El5uuG+YoBc4PI8Jcw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660253596; a=rsa-sha256; cv=none; b=O4BfhEQ1zKrQx/iORhK3AXBzFPZidrwaS9m91Bo43f6Zw4a8mES1M2x9QSbLJTymZWnDez ok6dr5F1i2eXdTe4lgk0BWWfK3W3bfO4RYsxO2U1ANyMev/0XTIVV/nCoUsulPV6I4g/cg PDWLo+9KPUBWY34o2qQFjtPuOaAkPm33WBhoVc830jU8Jrzcf7CX5BiUqogVySJ8js6uSN gCrt3kszDqCnaIDO5kSIPEZI8tpwNKxJyH1Di9yVqZ/Rpgdg8/1osSeTtWHLzrENwEVRjH gTXxupj0kDY3vDgHauAH6gTU/kDEuervUoTaErpv7Tq7VCAPk8yEuobgF0gi1g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vodafonemail.de header.s=vfde-mb-mr2-21dec header.b=AZ7eynBq; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.68 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vodafonemail.de header.s=vfde-mb-mr2-21dec header.b=AZ7eynBq; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4661E319FC X-Spam-Score: -4.68 X-Migadu-Scanner: scn0.migadu.com X-TUID: YmLrBIsGdDZh Hi! The problems with sudo etc. in /run/setuid-programs/ stem from the nosuid an= d noexec flags, which WSL sets when mounting /run as tmpfs. I use a guile script which remounts /run with these flags removed. But there is another mount-problem. When WSL is using root as the default us= er, then the default mounts of local drives like /mnt/c/ use uid=3D0 and gid= =3D0. This is problematic, when a script is changing the user with sudo. So m= y script is unmounting all local drives and mounting them again with /sbin/m= ount.drvfs of WSL with the uid and gid of that user and the metadata flag. B= y the way, I was not able to use the type drvfs with the mount command from G= uix for this. But I didn=E2=80=99t try the type 9p for this yet, which it ac= tually seems to be. Changing the default user to prevent problems with local drives seems possib= le with an /etc/wsl.conf file. But then it will not be possible to use root=E2= =80=99s shell entry for the script anymore. Hm, I guess that even if the sudo problem is solved, then still a =E2=80=9Cs= udo -i=E2=80=9D won=E2=80=99t be possible with the patch. Is that right? Another possible problem with the patch might be the current-directory. I gu= ess that a =E2=80=9Cwsl -d guix -e ls=E2=80=9D will not list the directory f= rom which the wsl command got invoked, but the user=E2=80=99s home directory= . My setup is using a gnu.bat file, which invokes a guile script named gnu.scm= in WSL, which =E2=80=93 if needed =E2=80=93 does the re-mounts and starts s= hepherd, and calls sudo to login the user and change the directory before ex= ecuting further commands from the user. It is retaining some environment var= iables like TERM, and the content of WSLENV. So from the Windows side it is p= ossible to call =E2=80=9Cgnu.bat ls -lA=E2=80=9D etc. or just =E2=80=9Cgnu.b= at=E2=80=9D to get a shell. I=E2=80=99m experimenting with another script, which like busybox evaluates i= ts name, and put symlinks to it in /usr/local/bin/, which is in the default W= SL search path. That script invokes the mentioned gnu.scm script. With this i= t is possible to call e.g. =E2=80=9Cwsl -d guix -e ls -l=E2=80=9D for the Wi= ndows user in USERNAME. With the WSL version I=E2=80=99m using on Windows 10 its /init requires a gr= oup cache for nscd, too. With Windows 11 there is a boot option for the /etc/wsl.config, which might b= e the optimal place for a script to do re-mounts and start shepherd. All in all WSL assumes the Filesystem Hierarchie Standard and /etc/environme= nt and makes it hard to launch arbitrary commands as intended with just =E2=80= =9Cwsl -e ls=E2=80=9D in Guix. In such a case no shell is involved and no /e= tc/profile or ~/.profile is sourced, so ls won=E2=80=99t be found. This all s= eems to be far from perfect to me. Bye Stefan=