WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: TinyCore on Windows Subsystem for Linux (WSL)  (Read 1136 times)

Offline alphons

  • Newbie
  • *
  • Posts: 23
TinyCore on Windows Subsystem for Linux (WSL)
« on: November 29, 2021, 12:22:56 AM »
Here are some preliminary results of my attempt to get TinyCore running on Windows Subsystem for Linux (WSL)

This can be an alternative to the other Virtual-Machine options.

For more information on this technique https://docs.microsoft.com/en-us/windows/wsl/

What I did, was making a tar file from a running (live) TinyCore system, including installed tce extensions by running this command:

Code: [Select]
$ sudo su
# cd /
# tar -cvpf tinycore.tar --exclude=tinycore.tar --exclude=proc --exclude=dev --exclude=sys /

This file is needed to 'install' it on the WSL system.

First have the Windows WSL system up and running, this is a trickey part because there are so many Windows distributions out there, after some experiments this was my summary of actions:

Search for PowerShell, richt click and run as Administrator and execute these 2 commands:

Code: [Select]
> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
> Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

After this, you have to reboot your windows system.

In the process of importing the tar file (later on) i got an error 'FATAL: kernel to old'
I did some of these things (not sure which solved it) and the error went away:

Download the 'kernel' update package from
https://docs.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

Execute on windows:

Code: [Select]
wsl_update_x64.msi
In PowerShell execute:

Code: [Select]
> wsl --set-default-version 2

If all goes well, it is time to 'import' our tar file into the WSL system.
Choose your destination directory, for me it was c:\temp\TinyCore
Execute this command in PowerShell:

Code: [Select]
> wsl --import TinyCore c:\temp\TinyCore .\tinycore.tar
Make sure to use the new WSL kernel on our TinyCore distribution.
Execute this command in PowerShell:

Code: [Select]
> wsl --set-version TinyCore 2
(takes some minutes....)

Time to 'boot' your TinyCore system, execute in PowerShell:

Code: [Select]
> wsl -d TinyCore
For the result see the attachement. All works, including tce-load etc.
The backup / restore features of TinyCore are a bit crippled,
and my 'sda1' user disk is turned into a directory.
So keep in mind it has some caveats.









« Last Edit: November 29, 2021, 12:26:31 AM by alphons »

Offline mocore

  • Sr. Member
  • ****
  • Posts: 326
  • ~.~
Re: TinyCore on Windows Subsystem for Linux (WSL)
« Reply #1 on: February 02, 2022, 02:38:06 AM »
For more information on this technique https://docs.microsoft.com/en-us/windows/wsl/

iv not read this link ...but was reminded of this topic while reading https://github.com/giuliano108/guix-packages/blob/master/notes/Guix-on-WSL2.md this overview of the "Subsystem for Linux "
ftr via
https://gist.github.com/giuliano108/49ec5bd0a9339db98535bc793ceb5ab4

Quote from: gh/giuliano108/guix-packages/.../notes/Guix-on-WSL2.md
WSL2 distros are, in fact, more like OS containers:

    A single instance of the Microsoft-shipped Linux Kernel is running at any given time (under Hyper-V).
    Running, from a command prompt, wsl -d distroname instructs the Kernel to create one such container, the root filesystem coming an ext4.vhdx disk image.
    The Kernel executes an /init binary which, again, is supplied by Microsoft and cannot be changed/customized. Together with the Kernel itself, init can be found in %systemroot%\System32\lxss\tools.
    /init executes a shell or the command supplied to wsl.exe
    /init also takes care of mounting all the file systems, setting up /dev, ...
    A very useful side-effect of the "single Kernel for all distros" thing is that if, say, you've got a working Ubuntu WSL distro, and a Guix WSL distro that doesn't boot, you can run dmesg under Ubuntu and see what's wrong with Guix. The Kernel is shared, the Kernel ring buffer is also shared.

  :-\