microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.21k stars 809 forks source link

Unable to automount homedir from /etc/fstab when starting WSL distro #8070

Open laggarcia opened 2 years ago

laggarcia commented 2 years ago

Version

Microsoft Windows [Version 10.0.22000.527]

WSL Version

Kernel Version

5.10.60.1

Distro Version

Ubuntu 20.04

Other Software

N/A

Repro Steps

I would like to mount my homedir inside WSL from a separate virtual disk. Hence, I performed the following steps:

  1. I used Hyper-V manager to create a new vhdx file at C:\Users\<username>\home.vdhx.

  2. In an Administrator PowerShell which started with the working directory in my user profile directory (i.e. C:\Users\<username>), I mounted the new vhdx file as a drive:

Mount-VHD -Path .\home.vhdx

After doing that, the vhdx file will appear as a physical driver:

PS C:\Users\lagga> wmic diskdrive list brief
Caption                 DeviceID            Model                   Partitions  Size
XPG GAMMIX S70 BLADE    \\.\PHYSICALDRIVE0  XPG GAMMIX S70 BLADE    3           2048407280640
Microsoft Virtual Disk  \\.\PHYSICALDRIVE1  Microsoft Virtual Disk  0           1099506078720
  1. Mount the new physical drive in WSL:

wsl --mount \\.\PHYSICALDRIVE1 --bare

  1. Start my WSL distribution.

  2. In Linux, a new device will appear:

# lsblk
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda    8:0    0   256G  0 disk
sdb    8:16   0 339.8M  1 disk
sdc    8:32   0     1T  0 disk
sdd    8:48   0   256G  0 disk /

The vhdx file is mapped to sdc.

  1. Created a btrfs file system in /dev/sdc:

mkfs.btrfs -L home /dev/sdc

I verified that I can properly mount /dev/sdc. I also created a btrfs subvolume for my homedir called laggarcia.

  1. Used blkid to find /dev/sdc UUID.

  2. Added a line to mount the UUID on my homedir in Linux in /etc/fstab:

# cat /etc/fstab
LABEL=cloudimg-rootfs   /        ext4   defaults        0 0

UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX       /home/laggarcia btrfs   subvol=laggarcia        0 0
  1. Verified that mount -a properly mount my homedir.

  2. Shutdown WSL with wsl --shutdown.

  3. Mounted the vhdx physical drive in WSL again (repeat step 3).

  4. Start WSL instance.

  5. When the prompt appears, I am not seeing the files inside my vhdx file. I have no errors in dmesg. As a matter of fact, it states that it correctly identified /dev/sdc.

However, if I run mount -a just after starting the WSL instance, my homedir will become the one inside the vhdx file.

Expected Behavior

I would expect that the homedir from the vhdx file should be correctly automount during WSL instance boot.

Actual Behavior

Homedir is not correctly automounted.

Diagnostic Logs

# dmesg
[    0.000000] Linux version 5.10.60.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Aug 25 23:20:18 UTC 2021
[    0.000000] Command line: initrd=\initrd.img panic=-1 nr_cpus=8 swiotlb=force pty.legacy_count=0
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x080: 'AVX-512 ZMM_Hi256'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: xstate_offset[5]:  832, xstate_sizes[5]:   64
[    0.000000] x86/fpu: xstate_offset[6]:  896, xstate_sizes[6]:  512
[    0.000000] x86/fpu: xstate_offset[7]: 1408, xstate_sizes[7]: 1024
[    0.000000] x86/fpu: Enabled xstate features 0xe7, context size is 2432 bytes, using 'compacted' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000e0fff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000001fffff] ACPI data
[    0.000000] BIOS-e820: [mem 0x0000000000200000-0x00000000f7ffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000005fe9fffff] usable
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI not present or invalid.
[    0.000000] Hypervisor detected: Microsoft Hyper-V
[    0.000000] Hyper-V: privilege flags low 0xae7f, high 0x3b8030, hints 0xa4e24, misc 0xe0bed7b2
[    0.000000] Hyper-V Host Build:22000-10.0-0-0.527
[    0.000000] Hyper-V: LAPIC Timer Frequency: 0x1e8480
[    0.000000] Hyper-V: Using hypercall for remote TLB flush
[    0.000000] clocksource: hyperv_clocksource_tsc_page: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.000001] tsc: Detected 2611.209 MHz processor
[    0.000046] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000048] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000050] last_pfn = 0x5fea00 max_arch_pfn = 0x400000000
[    0.000065] MTRR default type: uncachable
[    0.000069] MTRR fixed ranges enabled:
[    0.000069]   00000-3FFFF write-back
[    0.000070]   40000-7FFFF uncachable
[    0.000070]   80000-8FFFF write-back
[    0.000071]   90000-FFFFF uncachable
[    0.000071] MTRR variable ranges enabled:
[    0.000072]   0 base 0000000000 mask 7F00000000 write-back
[    0.000073]   1 base 0100000000 mask 7000000000 write-back
[    0.000073]   2 disabled
[    0.000073]   3 disabled
[    0.000074]   4 disabled
[    0.000074]   5 disabled
[    0.000074]   6 disabled
[    0.000074]   7 disabled
[    0.000079] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT
[    0.000088] last_pfn = 0xf8000 max_arch_pfn = 0x400000000
[    0.000097] Using GB pages for direct mapping
[    0.000407] RAMDISK: [mem 0x03235000-0x03243fff]
[    0.000408] ACPI: Early table checksum verification disabled
[    0.000418] ACPI: RSDP 0x00000000000E0000 000024 (v02 VRTUAL)
[    0.000420] ACPI: XSDT 0x0000000000100000 000044 (v01 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.000424] ACPI: FACP 0x0000000000101000 000114 (v06 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.000427] ACPI: DSDT 0x00000000001011B8 01E184 (v02 MSFTVM DSDT01   00000001 MSFT 05000000)
[    0.000429] ACPI: FACS 0x0000000000101114 000040
[    0.000431] ACPI: OEM0 0x0000000000101154 000064 (v01 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.000433] ACPI: SRAT 0x000000000011F33C 000330 (v02 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.000435] ACPI: APIC 0x000000000011F66C 000088 (v04 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.000437] ACPI: Reserving FACP table memory at [mem 0x101000-0x101113]
[    0.000437] ACPI: Reserving DSDT table memory at [mem 0x1011b8-0x11f33b]
[    0.000438] ACPI: Reserving FACS table memory at [mem 0x101114-0x101153]
[    0.000438] ACPI: Reserving OEM0 table memory at [mem 0x101154-0x1011b7]
[    0.000439] ACPI: Reserving SRAT table memory at [mem 0x11f33c-0x11f66b]
[    0.000439] ACPI: Reserving APIC table memory at [mem 0x11f66c-0x11f6f3]
[    0.000444] ACPI: Local APIC address 0xfee00000
[    0.000615] Zone ranges:
[    0.000617]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000618]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000620]   Normal   [mem 0x0000000100000000-0x00000005fe9fffff]
[    0.000621]   Device   empty
[    0.000621] Movable zone start for each node
[    0.000622] Early memory node ranges
[    0.000622]   node   0: [mem 0x0000000000001000-0x000000000009ffff]
[    0.000624]   node   0: [mem 0x0000000000200000-0x00000000f7ffffff]
[    0.000625]   node   0: [mem 0x0000000100000000-0x00000005fe9fffff]
[    0.000626] Initmem setup node 0 [mem 0x0000000000001000-0x00000005fe9fffff]
[    0.000627] On node 0 totalpages: 6252703
[    0.000628]   DMA zone: 59 pages used for memmap
[    0.000628]   DMA zone: 22 pages reserved
[    0.000629]   DMA zone: 3743 pages, LIFO batch:0
[    0.000630]   DMA32 zone: 16320 pages used for memmap
[    0.000630]   DMA32 zone: 1011712 pages, LIFO batch:63
[    0.000630]   Normal zone: 81832 pages used for memmap
[    0.000631]   Normal zone: 5237248 pages, LIFO batch:63
[    0.000770] On node 0, zone DMA: 1 pages in unavailable ranges
[    0.000833] On node 0, zone DMA: 352 pages in unavailable ranges
[    0.016325] On node 0, zone Normal: 5632 pages in unavailable ranges
[    0.016360] ACPI: Local APIC address 0xfee00000
[    0.016366] ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
[    0.016587] IOAPIC[0]: apic_id 8, version 17, address 0xfec00000, GSI 0-23
[    0.016589] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.016591] ACPI: IRQ9 used by override.
[    0.016592] Using ACPI (MADT) for SMP configuration information
[    0.016593] TSC deadline timer available
[    0.016594] smpboot: Allowing 8 CPUs, 0 hotplug CPUs
[    0.016602] [mem 0xf8000000-0xffffffff] available for PCI devices
[    0.016603] Booting paravirtualized kernel on Hyper-V
[    0.016604] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.020430] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:8 nr_node_ids:1
[    0.020677] percpu: Embedded 52 pages/cpu s173464 r8192 d31336 u262144
[    0.020681] pcpu-alloc: s173464 r8192 d31336 u262144 alloc=1*2097152
[    0.020683] pcpu-alloc: [0] 0 1 2 3 4 5 6 7
[    0.020692] Hyper-V: PV spinlocks enabled
[    0.020694] PV qspinlock hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.020696] Built 1 zonelists, mobility grouping on.  Total pages: 6154470
[    0.020697] Kernel command line: initrd=\initrd.img panic=-1 nr_cpus=8 swiotlb=force pty.legacy_count=0
[    0.023668] Dentry cache hash table entries: 4194304 (order: 13, 33554432 bytes, linear)
[    0.025205] Inode-cache hash table entries: 2097152 (order: 12, 16777216 bytes, linear)
[    0.025277] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.039078] Memory: 4092080K/25010812K available (16404K kernel code, 2538K rwdata, 3648K rodata, 1564K init, 2828K bss, 542980K reserved, 0K cma-reserved)
[    0.039102] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.039107] ftrace: allocating 51335 entries in 201 pages
[    0.051119] ftrace: allocated 201 pages with 4 groups
[    0.051337] rcu: Hierarchical RCU implementation.
[    0.051338] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=8.
[    0.051338]  Rude variant of Tasks RCU enabled.
[    0.051339]  Tracing variant of Tasks RCU enabled.
[    0.051340] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.051340] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.053485] Using NULL legacy PIC
[    0.053486] NR_IRQS: 16640, nr_irqs: 488, preallocated irqs: 0
[    0.053789] random: crng done (trusting CPU's manufacturer)
[    0.053804] Console: colour dummy device 80x25
[    0.053810] printk: console [tty0] enabled
[    0.053814] ACPI: Core revision 20200925
[    0.053872] Failed to register legacy timer interrupt
[    0.053872] APIC: Switch to symmetric I/O mode setup
[    0.054935] x2apic: IRQ remapping doesn't support X2APIC mode
[    0.056293] Hyper-V: Using IPI hypercalls
[    0.056324] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x25a398c6aab, max_idle_ns: 440795252127 ns
[    0.056327] Calibrating delay loop (skipped), value calculated using timer frequency.. 5222.41 BogoMIPS (lpj=26112090)
[    0.056329] pid_max: default: 32768 minimum: 301
[    0.056337] LSM: Security Framework initializing
[    0.056376] Mount-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.056411] Mountpoint-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.056564] x86/cpu: User Mode Instruction Prevention (UMIP) activated
[    0.056576] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.056576] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.056579] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.056580] Spectre V2 : Mitigation: Enhanced IBRS
[    0.056581] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.056582] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier
[    0.056582] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
[    0.056700] Freeing SMP alternatives memory: 52K
[    0.057630] smpboot: CPU0: 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz (family: 0x6, model: 0x8c, stepping: 0x1)
[    0.057685] Performance Events: unsupported p6 CPU model 140 no PMU driver, software events only.
[    0.057700] rcu: Hierarchical SRCU implementation.
[    0.057982] smp: Bringing up secondary CPUs ...
[    0.058022] x86: Booting SMP configuration:
[    0.058022] .... node  #0, CPUs:      #1 #2 #3 #4 #5 #6 #7
[    0.058342] smp: Brought up 1 node, 8 CPUs
[    0.058342] smpboot: Max logical packages: 1
[    0.058342] smpboot: Total of 8 processors activated (41779.34 BogoMIPS)
[    0.086351] node 0 deferred pages initialised in 30ms
[    0.088201] devtmpfs: initialized
[    0.088201] x86/mm: Memory block size: 128MB
[    0.088201] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.088201] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
[    0.088201] NET: Registered protocol family 16
[    0.088201] thermal_sys: Registered thermal governor 'step_wise'
[    0.088201] cpuidle: using governor menu
[    0.088201] ACPI: bus type PCI registered
[    0.088201] PCI: Fatal: No config space access function found
[    0.088201] Kprobes globally optimized
[    0.088201] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.088201] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.106347] raid6: skip pq benchmark and using algorithm avx512x4
[    0.106348] raid6: using avx512x2 recovery algorithm
[    0.106356] ACPI: Added _OSI(Module Device)
[    0.106357] ACPI: Added _OSI(Processor Device)
[    0.106357] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.106358] ACPI: Added _OSI(Processor Aggregator Device)
[    0.106359] ACPI: Added _OSI(Linux-Dell-Video)
[    0.106359] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.106360] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.107436] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.108136] ACPI: Interpreter enabled
[    0.108139] ACPI: (supports S0 S5)
[    0.108140] ACPI: Using IOAPIC for interrupt routing
[    0.108146] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.108242] ACPI: Enabled 2 GPEs in block 00 to 0F
[    0.109035] iommu: Default domain type: Translated
[    0.109083] SCSI subsystem initialized
[    0.109085] ACPI: bus type USB registered
[    0.109091] usbcore: registered new interface driver usbfs
[    0.109104] usbcore: registered new interface driver hub
[    0.109107] usbcore: registered new device driver usb
[    0.109129] hv_vmbus: Vmbus version:5.2
[    0.109129] PCI: Using ACPI for IRQ routing
[    0.109129] PCI: System does not support PCI
[    0.109129] clocksource: Switched to clocksource tsc-early
[    0.109129] hv_vmbus: Unknown GUID: c376c1c3-d276-48d2-90a9-c04748072c60
[    0.109129] hv_vmbus: Unknown GUID: 6e382d18-3336-4f4b-acc4-2b7703d4df4a
[    0.109129] hv_vmbus: Unknown GUID: dde9cbc0-5060-4436-9448-ea1254a5d177
[    0.191638] VFS: Disk quotas dquot_6.6.0
[    0.191647] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.191662] FS-Cache: Loaded
[    0.191684] pnp: PnP ACPI init
[    0.191825] pnp 00:00: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.191844] pnp: PnP ACPI: found 1 devices
[    0.196584] NET: Registered protocol family 2
[    0.196959] IP idents hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.198183] tcp_listen_portaddr_hash hash table entries: 16384 (order: 6, 262144 bytes, linear)
[    0.198209] TCP established hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.198524] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.198743] TCP: Hash tables configured (established 262144 bind 65536)
[    0.198775] UDP hash table entries: 16384 (order: 7, 524288 bytes, linear)
[    0.198823] UDP-Lite hash table entries: 16384 (order: 7, 524288 bytes, linear)
[    0.198892] NET: Registered protocol family 1
[    0.199667] RPC: Registered named UNIX socket transport module.
[    0.199668] RPC: Registered udp transport module.
[    0.199668] RPC: Registered tcp transport module.
[    0.199668] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.199671] PCI: CLS 0 bytes, default 64
[    0.199718] Trying to unpack rootfs image as initramfs...
[    0.199883] Freeing initrd memory: 60K
[    0.199885] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.199886] software IO TLB: mapped [mem 0x00000000f4000000-0x00000000f8000000] (64MB)
[    0.199929] KVM: vmx: using Hyper-V Enlightened VMCS
[    0.202968] kvm: already loaded the other module
[    0.207571] Initialise system trusted keyrings
[    0.207766] workingset: timestamp_bits=46 max_order=23 bucket_order=0
[    0.208634] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.208841] NFS: Registering the id_resolver key type
[    0.208847] Key type id_resolver registered
[    0.208847] Key type id_legacy registered
[    0.208849] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.208850] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.208851] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.209531] Key type cifs.idmap registered
[    0.209637] fuse: init (API version 7.32)
[    0.209865] SGI XFS with ACLs, security attributes, realtime, scrub, repair, quota, no debug enabled
[    0.210277] 9p: Installing v9fs 9p2000 file system support
[    0.210283] FS-Cache: Netfs '9p' registered for caching
[    0.210317] FS-Cache: Netfs 'ceph' registered for caching
[    0.210320] ceph: loaded (mds proto 32)
[    0.218257] NET: Registered protocol family 38
[    0.218259] xor: automatically using best checksumming function   avx
[    0.218261] Key type asymmetric registered
[    0.218262] Asymmetric key parser 'x509' registered
[    0.218270] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.219362] hv_vmbus: registering driver hv_pci
[    0.220082] hv_pci 7900bf21-37eb-492a-bb67-5711aa00e873: PCI VMBus probing: Using version 0x10003
[    0.221306] hv_pci 7900bf21-37eb-492a-bb67-5711aa00e873: PCI host bridge to bus 37eb:00
[    0.221493] pci 37eb:00:00.0: [1414:008e] type 00 class 0x030200
[    0.223799] ACPI: AC Adapter [AC1] (off-line)
[    0.224588] battery: ACPI: Battery Slot [BAT1] (battery present)
[    0.224741] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.225132] Non-volatile memory driver v1.3
[    0.228708] brd: module loaded
[    0.229622] loop: module loaded
[    0.229657] hv_vmbus: registering driver hv_storvsc
[    0.230410] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[    0.230410] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[    0.230421] tun: Universal TUN/TAP device driver, 1.6
[    0.230502] PPP generic driver version 2.4.2
[    0.230583] PPP BSD Compression module registered
[    0.230584] PPP Deflate Compression module registered
[    0.230588] PPP MPPE Compression module registered
[    0.230589] NET: Registered protocol family 24
[    0.230599] hv_vmbus: registering driver hv_netvsc
[    0.230708] VFIO - User Level meta-driver version: 0.3
[    0.230924] usbcore: registered new interface driver cdc_acm
[    0.230925] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    0.230933] usbcore: registered new interface driver ftdi_sio
[    0.230935] usbserial: USB Serial support registered for FTDI USB Serial Device
[    0.231176] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller
[    0.231178] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 1
[    0.231183] vhci_hcd: created sysfs vhci_hcd.0
[    0.231204] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[    0.231205] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.231206] usb usb1: Product: USB/IP Virtual Host Controller
[    0.231207] usb usb1: Manufacturer: Linux 5.10.60.1-microsoft-standard-WSL2 vhci_hcd
[    0.231207] usb usb1: SerialNumber: vhci_hcd.0
[    0.231442] hub 1-0:1.0: USB hub found
[    0.231445] hub 1-0:1.0: 8 ports detected
[    0.231501] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller
[    0.231502] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 2
[    0.231581] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.231597] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.10
[    0.231598] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.231599] usb usb2: Product: USB/IP Virtual Host Controller
[    0.231600] usb usb2: Manufacturer: Linux 5.10.60.1-microsoft-standard-WSL2 vhci_hcd
[    0.231601] usb usb2: SerialNumber: vhci_hcd.0
[    0.231804] hub 2-0:1.0: USB hub found
[    0.231808] hub 2-0:1.0: 8 ports detected
[    0.231916] hv_vmbus: registering driver hyperv_keyboard
[    0.231953] scsi host0: storvsc_host_t
[    0.232078] rtc_cmos 00:00: RTC can wake from S4
[    0.233465] rtc_cmos 00:00: registered as rtc0
[    0.233827] rtc_cmos 00:00: setting system clock to 2022-02-20T03:39:27 UTC (1645328367)
[    0.233837] rtc_cmos 00:00: alarms up to one month, 114 bytes nvram
[    0.234194] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com
[    0.234441] device-mapper: raid: Loading target version 1.15.1
[    0.234479] usbcore: registered new interface driver usbhid
[    0.234479] usbhid: USB HID core driver
[    0.234568] hv_utils: Registering HyperV Utility Driver
[    0.234569] hv_vmbus: registering driver hv_utils
[    0.234585] hv_vmbus: registering driver hv_balloon
[    0.234591] hv_vmbus: registering driver dxgkrnl
[    0.234602] (NULL device *): dxgk: dxg_drv_init  Version: 2108
[    0.234602] hv_utils: cannot register PTP clock: 0
[    0.235222] drop_monitor: Initializing network drop monitor service
[    0.235495] hv_utils: TimeSync IC version 4.0
[    0.235534] Mirror/redirect action on
[    0.235835] hv_balloon: Using Dynamic Memory protocol version 2.0
[    0.235860] (NULL device *): dxgk: mmio allocated 9ffe00000  200000000 9ffe00000 bffdfffff
[    0.235923] IPVS: Registered protocols (TCP, UDP)
[    0.235955] IPVS: Connection hash table configured (size=4096, memory=64Kbytes)
[    0.235987] IPVS: ipvs loaded.
[    0.235988] IPVS: [rr] scheduler registered.
[    0.235989] IPVS: [wrr] scheduler registered.
[    0.235990] IPVS: [sh] scheduler registered.
[    0.236035] ipip: IPv4 and MPLS over IPv4 tunneling driver
[    0.236282] Free page reporting enabled
[    0.236283] hv_balloon: Cold memory discard hint enabled
[    0.237460] ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully
[    0.238062] Initializing XFRM netlink socket
[    0.238129] NET: Registered protocol family 10
[    0.238550] Segment Routing with IPv6
[    0.240185] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.240255] NET: Registered protocol family 17
[    0.240266] Bridge firewalling registered
[    0.240271] 8021q: 802.1Q VLAN Support v1.8
[    0.240283] sctp: Hash tables configured (bind 512/512)
[    0.240315] 9pnet: Installing 9P2000 support
[    0.240326] Key type dns_resolver registered
[    0.240330] Key type ceph registered
[    0.240523] libceph: loaded (mon/osd proto 15/24)
[    0.240597] NET: Registered protocol family 40
[    0.240598] hv_vmbus: registering driver hv_sock
[    0.240623] IPI shorthand broadcast: enabled
[    0.240630] sched_clock: Marking stable (237969939, 2617400)->(249612200, -9024861)
[    0.241016] registered taskstats version 1
[    0.241024] Loading compiled-in X.509 certificates
[    0.241224] Btrfs loaded, crc32c=crc32c-generic
[    0.245982] Freeing unused kernel image (initmem) memory: 1564K
[    0.316825] Write protecting the kernel read-only data: 22528k
[    0.318461] Freeing unused kernel image (text/rodata gap) memory: 2024K
[    0.319206] Freeing unused kernel image (rodata/data gap) memory: 448K
[    0.319214] Run /init as init process
[    0.319215]   with arguments:
[    0.319216]     /init
[    0.319217]   with environment:
[    0.319218]     HOME=/
[    0.319220]     TERM=linux
[    0.964777] scsi 0:0:0:0: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    0.965455] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    0.968106] sd 0:0:0:0: [sda] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[    0.968109] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    0.968287] sd 0:0:0:0: [sda] Write Protect is off
[    0.968289] sd 0:0:0:0: [sda] Mode Sense: 0f 00 00 00
[    0.968959] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.007799] hv_pci aebdc1e9-dbb4-4e60-a1b4-0b686ef6b241: PCI VMBus probing: Using version 0x10003
[    1.009486] hv_pci aebdc1e9-dbb4-4e60-a1b4-0b686ef6b241: PCI host bridge to bus dbb4:00
[    1.009489] pci_bus dbb4:00: root bus resource [mem 0xc00000000-0xe00001fff window]
[    1.010024] pci dbb4:00:00.0: [1af4:105a] type 00 class 0x088000
[    1.011486] pci dbb4:00:00.0: reg 0x10: [mem 0xe00000000-0xe00000fff 64bit]
[    1.012682] pci dbb4:00:00.0: reg 0x18: [mem 0xe00001000-0xe00001fff 64bit]
[    1.013906] pci dbb4:00:00.0: reg 0x20: [mem 0xc00000000-0xdffffffff 64bit]
[    1.017120] pci dbb4:00:00.0: BAR 4: assigned [mem 0xc00000000-0xdffffffff 64bit]
[    1.018955] pci dbb4:00:00.0: BAR 0: assigned [mem 0xe00000000-0xe00000fff 64bit]
[    1.020677] pci dbb4:00:00.0: BAR 2: assigned [mem 0xe00001000-0xe00001fff 64bit]
[    1.030299] virtiofs virtio0: Cache len: 0x200000000 @ 0xc00000000
[    1.090171] memmap_init_zone_device initialised 2097152 pages in 20ms
[    1.256488] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x25a398c6aab, max_idle_ns: 440795252127 ns
[    1.256512] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    1.257333] clocksource: Switched to clocksource tsc
[    1.442350] EXT4-fs (sda): mounted filesystem with ordered data mode. Opts: (null)
[    1.466905] sd 0:0:0:0: [sda] Attached SCSI disk
[    2.566707] Adding 6291456k swap on /swap/file.  Priority:-2 extents:4 across:6316032k
[    2.617418] scsi 0:0:0:1: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    2.619261] sd 0:0:0:1: Attached scsi generic sg1 type 0
[    2.622274] sd 0:0:0:1: [sdb] 695784 512-byte logical blocks: (356 MB/340 MiB)
[    2.622685] sd 0:0:0:1: [sdb] Write Protect is on
[    2.622689] sd 0:0:0:1: [sdb] Mode Sense: 0f 00 80 00
[    2.623485] sd 0:0:0:1: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    2.632846] sd 0:0:0:1: [sdb] Attached SCSI disk
[    2.635650] EXT4-fs (sdb): mounted filesystem without journal. Opts: (null)
[    2.788192] scsi 0:0:0:2: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    2.789296] sd 0:0:0:2: Attached scsi generic sg2 type 0
[    2.791591] sd 0:0:0:2: [sdc] 2147483648 512-byte logical blocks: (1.10 TB/1.00 TiB)
[    2.791594] sd 0:0:0:2: [sdc] 4096-byte physical blocks
[    2.792657] sd 0:0:0:2: [sdc] Write Protect is off
[    2.792659] sd 0:0:0:2: [sdc] Mode Sense: 0f 00 00 00
[    2.794859] sd 0:0:0:2: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.807879] sd 0:0:0:2: [sdc] Attached SCSI disk
[    6.554761] scsi 0:0:0:3: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    6.555108] sd 0:0:0:3: Attached scsi generic sg3 type 0
[    6.555680] sd 0:0:0:3: [sdd] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[    6.555681] sd 0:0:0:3: [sdd] 4096-byte physical blocks
[    6.555773] sd 0:0:0:3: [sdd] Write Protect is off
[    6.555775] sd 0:0:0:3: [sdd] Mode Sense: 0f 00 00 00
[    6.555899] sd 0:0:0:3: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.559067] sd 0:0:0:3: [sdd] Attached SCSI disk
[    6.592383] EXT4-fs (sdd): recovery complete
[    6.594888] EXT4-fs (sdd): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered
[    6.621997] hv_pci 43634281-d81f-476e-8475-ab80b5a99511: PCI VMBus probing: Using version 0x10003
[    6.668191] hv_pci 43634281-d81f-476e-8475-ab80b5a99511: PCI host bridge to bus d81f:00
[    6.668194] pci_bus d81f:00: root bus resource [mem 0xbffe00000-0xbffe02fff window]
[    6.669072] pci d81f:00:00.0: [1af4:1049] type 00 class 0x010000
[    6.669853] pci d81f:00:00.0: reg 0x10: [mem 0xbffe00000-0xbffe00fff 64bit]
[    6.670376] pci d81f:00:00.0: reg 0x18: [mem 0xbffe01000-0xbffe01fff 64bit]
[    6.670788] pci d81f:00:00.0: reg 0x20: [mem 0xbffe02000-0xbffe02fff 64bit]
[    6.672880] pci d81f:00:00.0: BAR 0: assigned [mem 0xbffe00000-0xbffe00fff 64bit]
[    6.673148] pci d81f:00:00.0: BAR 2: assigned [mem 0xbffe01000-0xbffe01fff 64bit]
[    6.673415] pci d81f:00:00.0: BAR 4: assigned [mem 0xbffe02000-0xbffe02fff 64bit]
[    6.689332] hv_pci c8088a50-bee5-4e20-9531-3d7843d0909c: PCI VMBus probing: Using version 0x10003
[    6.733214] hv_pci c8088a50-bee5-4e20-9531-3d7843d0909c: PCI host bridge to bus bee5:00
[    6.733216] pci_bus bee5:00: root bus resource [mem 0xbffe04000-0xbffe06fff window]
[    6.733756] pci bee5:00:00.0: [1af4:1049] type 00 class 0x010000
[    6.734374] pci bee5:00:00.0: reg 0x10: [mem 0xbffe04000-0xbffe04fff 64bit]
[    6.734742] pci bee5:00:00.0: reg 0x18: [mem 0xbffe05000-0xbffe05fff 64bit]
[    6.735121] pci bee5:00:00.0: reg 0x20: [mem 0xbffe06000-0xbffe06fff 64bit]
[    6.738383] pci bee5:00:00.0: BAR 0: assigned [mem 0xbffe04000-0xbffe04fff 64bit]
[    6.738794] pci bee5:00:00.0: BAR 2: assigned [mem 0xbffe05000-0xbffe05fff 64bit]
[    6.739262] pci bee5:00:00.0: BAR 4: assigned [mem 0xbffe06000-0xbffe06fff 64bit]
[    6.753583] FS-Cache: Duplicate cookie detected
[    6.753586] FS-Cache: O-cookie c=0000000089c0933f [p=00000000b82a776b fl=222 nc=0 na=1]
[    6.753586] FS-Cache: O-cookie d=00000000b5f63d35 n=00000000f9f3da82
[    6.753587] FS-Cache: O-key=[10] '34323934393337393635'
[    6.753590] FS-Cache: N-cookie c=00000000b4317881 [p=00000000b82a776b fl=2 nc=0 na=1]
[    6.753591] FS-Cache: N-cookie d=00000000b5f63d35 n=00000000edb9fc8d
[    6.753591] FS-Cache: N-key=[10] '34323934393337393635'
[    7.391356] hv_pci bbe87795-762c-489e-a0e6-81f3cc5d3871: PCI VMBus probing: Using version 0x10003
[    7.432331] hv_pci bbe87795-762c-489e-a0e6-81f3cc5d3871: PCI host bridge to bus 762c:00
[    7.432334] pci_bus 762c:00: root bus resource [mem 0xbffe08000-0xbffe0afff window]
[    7.432846] pci 762c:00:00.0: [1af4:1049] type 00 class 0x010000
[    7.433366] pci 762c:00:00.0: reg 0x10: [mem 0xbffe08000-0xbffe08fff 64bit]
[    7.433728] pci 762c:00:00.0: reg 0x18: [mem 0xbffe09000-0xbffe09fff 64bit]
[    7.434103] pci 762c:00:00.0: reg 0x20: [mem 0xbffe0a000-0xbffe0afff 64bit]
[    7.436260] pci 762c:00:00.0: BAR 0: assigned [mem 0xbffe08000-0xbffe08fff 64bit]
[    7.436691] pci 762c:00:00.0: BAR 2: assigned [mem 0xbffe09000-0xbffe09fff 64bit]
[    7.437000] pci 762c:00:00.0: BAR 4: assigned [mem 0xbffe0a000-0xbffe0afff 64bit]
[    7.459019] FS-Cache: Duplicate cookie detected
[    7.459043] FS-Cache: O-cookie c=00000000f830798a [p=00000000b82a776b fl=222 nc=0 na=1]
[    7.459044] FS-Cache: O-cookie d=00000000b5f63d35 n=00000000b4c487fb
[    7.459044] FS-Cache: O-key=[10] '34323934393338303336'
[    7.459048] FS-Cache: N-cookie c=00000000d73316f2 [p=00000000b82a776b fl=2 nc=0 na=1]
[    7.459048] FS-Cache: N-cookie d=00000000b5f63d35 n=000000006b8210ac
[    7.459048] FS-Cache: N-key=[10] '34323934393338303336'
[    9.260220] BTRFS: device label home devid 1 transid 11 /dev/sdc scanned by mount (201)
[    9.263940] BTRFS info (device sdc): disk space caching is enabled
[    9.263942] BTRFS info (device sdc): has skinny extents
[    9.302302] hv_pci e63f44bb-1b2d-406f-ae34-38dd083e1140: PCI VMBus probing: Using version 0x10003
[    9.346112] hv_pci e63f44bb-1b2d-406f-ae34-38dd083e1140: PCI host bridge to bus 1b2d:00
[    9.346114] pci_bus 1b2d:00: root bus resource [mem 0xbffe0c000-0xbffe0efff window]
[    9.346842] pci 1b2d:00:00.0: [1af4:1049] type 00 class 0x010000
[    9.347464] pci 1b2d:00:00.0: reg 0x10: [mem 0xbffe0c000-0xbffe0cfff 64bit]
[    9.347863] pci 1b2d:00:00.0: reg 0x18: [mem 0xbffe0d000-0xbffe0dfff 64bit]
[    9.348350] pci 1b2d:00:00.0: reg 0x20: [mem 0xbffe0e000-0xbffe0efff 64bit]
[    9.350743] pci 1b2d:00:00.0: BAR 0: assigned [mem 0xbffe0c000-0xbffe0cfff 64bit]
[    9.351019] pci 1b2d:00:00.0: BAR 2: assigned [mem 0xbffe0d000-0xbffe0dfff 64bit]
[    9.351266] pci 1b2d:00:00.0: BAR 4: assigned [mem 0xbffe0e000-0xbffe0efff 64bit]
[    9.365217] hv_pci 328d588d-1d7e-4e62-939d-eec5f36b57f1: PCI VMBus probing: Using version 0x10003
[    9.409429] hv_pci 328d588d-1d7e-4e62-939d-eec5f36b57f1: PCI host bridge to bus 1d7e:00
[    9.409431] pci_bus 1d7e:00: root bus resource [mem 0xbffe10000-0xbffe12fff window]
[    9.410126] pci 1d7e:00:00.0: [1af4:1049] type 00 class 0x010000
[    9.410875] pci 1d7e:00:00.0: reg 0x10: [mem 0xbffe10000-0xbffe10fff 64bit]
[    9.411371] pci 1d7e:00:00.0: reg 0x18: [mem 0xbffe11000-0xbffe11fff 64bit]
[    9.411870] pci 1d7e:00:00.0: reg 0x20: [mem 0xbffe12000-0xbffe12fff 64bit]
[    9.414043] pci 1d7e:00:00.0: BAR 0: assigned [mem 0xbffe10000-0xbffe10fff 64bit]
[    9.414317] pci 1d7e:00:00.0: BAR 2: assigned [mem 0xbffe11000-0xbffe11fff 64bit]
[    9.414593] pci 1d7e:00:00.0: BAR 4: assigned [mem 0xbffe12000-0xbffe12fff 64bit]
laggarcia commented 2 years ago

I have a much more simple test case now that hits the same issue. Just create a directory inside your user profile directory in Windows and put the following on your /etc/fstab:

# cat /etc/fstab
LABEL=cloudimg-rootfs   /        ext4   defaults        0 0

C:\     /mnt/c  drvfs   noatime,uid=1000,gid=1000,metadata      0 0
/mnt/c/Users/lagga/linux-home-dir       /home/laggarcia none    bind    0 0

When WSL instance starts, your homedir will not be bind mounted. You will have to run mount -a to mount it properly.

hanzec commented 2 years ago

use the windows store version of WSL

Robula commented 2 years ago

Having the ability to keep your home directory as a separate VHD would be really useful for the often many times I need to trash and recreate my development environment distro. It also has the added benefit of being able to be used by multiple distros.

The main issue is that there is no support in WSL 2 for automounting a VHD on distro startup. We have wsl --mount --vhd now but that does not get around the issues described above.