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

hack: Add remote lldb utilities to hack dir #596

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

ckyrouac
Copy link
Contributor

This is useful for remote debugging bootc running in a VM.

Until podman-bootc has support for forwarding arbitrary ports, this custom solution is needed.

This has been working well for me and I thought it might be useful to include in the docs for others to try if they're interested.

This is useful for remote debugging bootc running in a VM.

Until podman-bootc has support for forwarding arbitrary ports,
this custom solution is needed.

Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Nice! I have never tried using lldb...I'm usually a "printf debugging" person.

@@ -0,0 +1,21 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some overlap here with #593 a bit and of course - a lot of overlap with https://github.com/containers/podman-bootc ...I was really thinking about trying to make that a more generic tool, but it gets tricky.

There's so many virtualization wrappers on Linux...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, eventually podman-bootc should provide everything needed for this, but in the meantime I just wanted to use lldb. The primary (only?) thing preventing using podman-bootc is the networking stuff.

@@ -0,0 +1,2 @@
net.ipv6.conf.all.disable_ipv6 = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why out of curiosity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a weird issue where the lldb connection was trying to use the ipv6 address and failing, this fixed it. I have ipv6 turned off on my host.

virsh -c qemu:///system destroy bootc-lldb
virsh -c qemu:///system undefine --nvram bootc-lldb
set -e
sudo virt-install --name bootc-lldb --cpu host --vcpus 8 --memory 8192 --import --disk ~/.cache/bootc-dev/disks/lldb.raw --os-variant rhel9-unknown
Copy link
Collaborator

Choose a reason for hiding this comment

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

For this one we could use --qemu-commandline to pass the ssh key via credentials too right? This is probably something to do via a patch to virt-install.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, I was playing around with the now defunct included-ssh-pubkey example and got it working so I just continued using it. Either way works for me.

Comment on lines +8 to +9
RUN dnf -y install lldb firewalld vim && \
firewall-offline-cmd --add-port 1025-65535/tcp && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, interesting that you're adding firewalld here only to poke a lot of holes in the firewall...any reason for that?

(In the near future we may want to actually add firewalld to our base images though)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

firewalld is just really simple to use. I was surprised it's not in the base image. lldb uses the user defined port for the initial connection along with seemingly any random port in the 30000-* range.

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

We can always do fixes here as followups, so fine to me to merge as is.

@cgwalters cgwalters merged commit 5109733 into containers:main Jun 11, 2024
12 of 16 checks passed
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.

None yet

2 participants