-
Notifications
You must be signed in to change notification settings - Fork 845
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
/etc/fstab not automounted when WSL2 used from Windows Task Scheduler #6006
Comments
I didn't find something interesting in the logs, but I guess:
|
It is unclear to be what your 1-3 comments are.
If you have questions of me, please do ask them and I'll endeavor to get answers. |
I can also confirm that /etc/fstab is ignored with the following configuration: cat /etc/wsl.conf [automount] |
Is there any update on this? |
Last time I tried, still doesn't work as expected. So on my computer, I have to always be interactively logged in, therefore I use a short screen lock and Windowskey-L now by habit. |
Try add to /etc/wsl.conf
or in boot script on windows:
|
This has no effect. Automount on boot still does not happen. |
see #6073 |
Any update on this problem. Windows 11 still has the problem. It looks like the system ignores the file. Even if I change it for e.g swappiness or swapon... It cannot make it permanent. I made the change in the file, but everytime i reboot It does not read that change. Those files does not make sense in wsl booting. |
It seems like /etc/fstab works fine with the following configuration: WSL version: 1.2.5.0 /etc/wsl.conf:
/etc/fstab:
|
wsl.conf is ignored when wsl2 is booted by task scheduler in condition "Run whether user is logged on or not". Is there any solution now? 😭 |
If you have systemd enabled with WSL 2 on Windows 10, there's no need to enable automount, as systemd will parse /etc/fstab and generate the corresponding mount units. Here follows my current settings. /etc/wsl.conf
/etc/fstab
|
/etc/fstab
is not automounted when a WSL2 Ubuntu distro is used from Windows Task Scheduler viawsl.exe
.This issue does not reproduce in WSL1 Ubuntu. I discovered it during my WSL1->2 migration.
It reminds me of the old WSL1 issue #1602
Perhaps related to #4226
Environment
Steps to reproduce
dale
username in below steps with your own username.
apt update
andapt upgrade
/etc/wsl.conf
to have content ofC: /mnt/c drvfs rw,noatime,uid=1000,gid=1000,fmask=0027,dmask=0027,metadata 0 0
was mounted on the above line) to your Linux home directory. Remember to change usernames!
I chose to do with with my
.ssh
directory. Therefore, I firstmkdir /home/dale/.ssh
and then addedthe line
/mnt/c/Users/Dale/.ssh /home/dale/.ssh none bind 0 0
//home-nas/dale /mnt/n drvfs rw,noatime,uid=1000,gid=1000,fmask=0027,dmask=0027,_netdev,nofail 0 0
wsl --shutdown
/etc/fstab
are successful; C drive, your bind mount, and your network share.test.sh
in your Linux home directory, e.g./home/dale/test.sh
, with the below content.Remember to change username and use the directory you bind mounted in step 5.ii above.
chmod 755 test.sh
wsltest1
Run whether user is logged on or not
Windows 10
Actions
New...
Start a program
at the topC:\Windows\System32\wsl.exe
bash -lc "/home/dale/test.sh"
Settings
Allow task to be run on demand
Run
/home/dale/testout.log
Actual Behavior
mounts from
/etc/fstab
did not successfully occur. Thetestout.log
output will show in sequence/home/dale/.ssh
is not correctedlisted. Instead, you only see the
/home/dale/.ssh
directory that you created. This is easily seen by lookingat the datetime and in the following...
.ssh
directory shows only the.
and..
entries. It does not list the files that should be from/mnt/c/Users/Dale/.ssh
due to your bind mountExpected Behavior
All mounts from
/etc/fstab
to successfully occur. Thetestout.log
should show the correctcontents of your bind mount, and all three mounts should appear in the list of mounts.
WSL logs
Available at https://aka.ms/AA9ubkh
The text was updated successfully, but these errors were encountered: