-
Notifications
You must be signed in to change notification settings - Fork 0
Incus
reubenajohnston edited this page Feb 4, 2025
·
18 revisions
Important: Apparently, there is some discourse between Canonical (LXD) and Incus. Kali images are only supported now by Incus and are not available to LXD.
Instructions for starting from our Ubuntu server VM. Assumes that /dev/sdb
is an unused disk on your Unbuntu server that can be used for the Incus storage pool.
- Create a new hard disk device as described below in 'Setup virtual hard disk for Incus' (e.g., /dev/sdb)
- (host) Update Ubuntu:
sudo apt-get update
- (host) Install incus:
sudo apt-get install incus qemu-system incus-tools
- (host) Setup incus:
sudo adduser <USERNAME> incus-admin newgrp incus-admin incus admin init
- Here are example prompts for the
incus admin init
step (you will want to specify the appropriate device for the disk you created above; e.g., /dev/sdb):Would you like to use clustering? (yes/no) [default=no]: Do you want to configure a new storage pool? (yes/no) [default=yes]: Name of the new storage pool [default=default]: Name of the storage backend to use (dir, lvm, lvmcluster, btrfs) [default=btrfs]: Create a new BTRFS pool? (yes/no) [default=yes]: Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: yes Path to the existing block device: /dev/sdb Would you like to create a new local network bridge? (yes/no) [default=yes]: What should the new bridge be called? [default=incusbr0]: What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: Would you like the server to be available over the network? (yes/no) [default=no]: Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: no Would you like a YAML "init" preseed to be printed? (yes/no) [default=no]:
- Here are example prompts for the
- (host) Create a profile settings file named
x11kali.txt
with the content below:# LXD profile to enable graphics support for Kali containers # # Source: https://blog.simos.info/how-to-run-graphics-x11-applications-in-the-kali-lxd-container config: environment.DISPLAY: :0 user.user-data: | runcmd: - sed -i '$ a\DISPLAY=:0' /root/.bashrc - sed -i '$ a\DISPLAY=:0' /home/kali/.bashrc packages: - x11-apps - mesa-utils description: X11 LXD profile devices: X0: bind: container connect: unix:@/tmp/.X11-unix/X1 listen: unix:@/tmp/.X11-unix/X0 security.gid: "1000" security.uid: "1000" type: proxy name: x11kali used_by: []
- (host) Create an incus profile
x11kali
incus profile create x11kali cat x11kali.txt | incus profile edit x11kali
- (host) Launch an instance of the Kali image
incus launch images:kali/current/amd64 xkali --profile default --profile x11kali
- (host) Create a
kali
user in the instance withsudo
privileges and setup its.bashrc
for X11:incus exec xkali -- adduser kali incus exec xkali -- usermod -aG sudo kali incus exec xkali -- echo "export DISPLAY=:0" >> /home/kali/.bashrc
- (host) Todo (update with proper mcookie X11 authentication), Disable X11 authentication for localhost:
xhost +
- (host) Start a console with the instance (you can exit it with 'ctrl-a' and then 'q'):
incus console xkali
- (instance) Install test X11 application (first step might not be needed if packages specified by
x11kali.txt
were installed earlier, need to confirm) in the instance and test X11:sudo apt-get install x11-apps xeyes
- Create the device:
- VM->Settings, Add new device
- Specify Hard Disk and select next
- Specify SCSI and select next
- Specify Create a new virtual disk and select next
- Specify the size (I typically use 30GB) and keep the virtual disk as a single file, then select next
- Name the disk file -Incus and save it in the same directory as your VM (e.g., Kali 2020.3-incus) and select finish
- Reboot the VM
- https://www.kali.org/docs/containers/kalilinux-lxc-images/#gui-kali-lxd-container-on-ubuntu-host
- https://blog.simos.info/how-to-run-graphics-x11-applications-in-the-kali-lxd-container
- https://linuxcontainers.org/incus/docs/main/installing
- https://linuxcontainers.org/incus/docs/main/tutorial/first_steps
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html