Skip to content
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

Add Kali to modern distributions #12472

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Gamb1ts
Copy link

@Gamb1ts Gamb1ts commented Jan 17, 2025

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
The following fatal errors have been found in this pull request:

  • kali/None: Found no default distribution

The following suggestions have been found in this pull request:

  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service

@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 17, 2025

@Gamb1ts please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="OffSec"

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
No fatal errors have been found.
The following suggestions have been found in this pull request:

  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 17, 2025

Thank you @Gamb1ts !

Feel free to ignore the bot's warnings on the masked systemd units, I need to go fix that !

The tar & manifest look great ! One small suggestion that I have would to use systemctl is-system-running in /usr/lib/wsl/wsl-oobe so we could get remove the sleep 25 and make the distribution start a bit faster.

Something like this should do the trick:

timeout 25 bash -c 'while ! systemctl is-system-running | grep -E "running|degraded" ; do sleep 1; done'  || echo "warning: timed out waiting for systemd to start"

@benhillis
Copy link
Member

What's the goal of sleeping to wait for systemd in the oobe script? If you want to make sure that no user processes are launched before systemd is up, that should already be guaranteed as part of WSL. Is that not the behavior you are seeing?

@Gamb1ts Gamb1ts changed the title Add Kali to modern distributions WIP: Add Kali to modern distributions Jan 17, 2025
@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 17, 2025

Early in my testing I found that the system setup was too quick which led to issues using certain commands. However, this was prior to masking the recommended systemd units. I will re-visit this and see if in its current state the wait is necessary.

Unfortunately I will have to mark this as WIP until next week, we will need to change where we host the image. Next week I will supply the new URL and checksums.

@Gamb1ts Gamb1ts changed the title WIP: Add Kali to modern distributions Add Kali to modern distributions Jan 22, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
No fatal errors have been found.
The following suggestions have been found in this pull request:

  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service

@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 22, 2025

I have disabled the wait on systemd, I was able to confirm that it is not needed. I have also updated the URL to utilize our mirror kali.download. Unless there is any other feedback, the Kali team is good with the PR at this stage.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 22, 2025

FYI when I tried it locally, I got the following output:

Please create a default Kali WSL user. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: blue
logger: socket /dev/log: No such file or directory
logging to syslog failed: command line logger --id=139 --tag=adduser --priority=user.info  -- Adding user `blue' ... returned error: 256
logger: socket /dev/log: No such file or directory
logging to syslog failed: command line logger --id=139 --tag=adduser --priority=user.info  -- Adding new group `blue' (1000) ... returned error: 256
logger: socket /dev/log: No such file or directory
logging to syslog failed: command line logger --id=139 --tag=adduser --priority=user.info  -- Adding new user `blue' (1000) with group `blue (1000)' ... returned error: 256
logger: socket /dev/log: No such file or directory
logging to syslog failed: command line logger --id=139 --tag=adduser --priority=user.info  -- Creating home directory `/home/blue' ... returned error: 256
logger: socket /dev/log: No such file or directory
logging to syslog failed: command line logger --id=139 --tag=adduser --priority=user.info  -- Copying files from `/etc/skel' ... returned error: 256

Looking through dmesg, I can see the following logline:

Legacy cgroup v1 support selected. This is no longer supported. Will proceed anyway after 30s. . This is most likely what's causing the systemd delay that you originally saw.

Let me see if this can be solved from the WSL side.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 23, 2025

Looks like we can solve this on the WSL via: SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1.

In the meantime, I'd recommend adding the logic to wait to systemd to the OOBE, so it doesn't print the above the error. I refined my earlier suggestion to make the output a bit cleaner:

echo 'Waiting for systemd to start...'
timeout 25 bash -c 'while ! systemctl is-system-running 2> /dev/null | grep -E "running|degraded > /dev/null"; do sleep 1; done' || echo "Warning: timed out waiting for systemd to start"

(that way the user won't get Failed to connect to bus: No such file or directory on stderr when waiting for systemd)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
The following fatal errors have been found in this pull request:

The following suggestions have been found in this pull request:

  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service

@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 23, 2025

Yeah that was the same issue I was seeing previously. With the latest pre-release WSL installed I was no longer having the issue FWIW.

I have re-added the systemd wait and re-built the images. The checksums have been updated but the link is the same. The site is heavily cached so may need to clear it.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
No fatal errors have been found.
The following suggestions have been found in this pull request:

  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev-early.service
  • kali/kali-linux: Found discouraged system unit: /usr/lib/systemd/system/local-fs.target.wants/tmp.mount
  • kali/kali-linux: Found discouraged system unit: /etc/systemd/system/network-online.target.wants/networking.service

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 23, 2025

Thank you @Gamb1ts. I restarted the pipeline, and the hashes match now.

Although I still see the systemd wait logic being commented /usr/lib/wsl/wsl-oobe (and I validated the distribution hash, so I don't think I got a cached file).

@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 23, 2025

I will rebuild the image and verify locally it is back in

@Gamb1ts
Copy link
Author

Gamb1ts commented Jan 24, 2025

Re-built and verified the oobe has the systemd wait

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to WSL.
No fatal errors have been found.
No suggestions have been found.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 24, 2025

Thank you @Gamb1ts. Just tried it out, the OOBE works perfectly now.

Feel free to merge whenever ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants