Skip to content

Commit

Permalink
User data patch 0 (#3)
Browse files Browse the repository at this point in the history
* removed ssh_import_id

* added notes and fixed
  • Loading branch information
hychan48 authored May 17, 2024
1 parent 66558cc commit 483290f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 10 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ vncviewer localhost:5907
#### ssh Connection
```bash
# ub24-server
ssh -p 3455 -o StrictHostKeyChecking=no root@localhost
ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost
ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@localhost

# ub24-desktop
ssh -p 3456 -o StrictHostKeyChecking=no root@localhost
ssh -p 3456 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost

# ub22-server
ssh -p 3457 -o StrictHostKeyChecking=no root@localhost
ssh -p 3457 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost
```

#### Output
Expand Down Expand Up @@ -132,6 +135,7 @@ assets
```

# Developer's Notes
* [readme_debug_notes.md](readme_debug_notes.md)
## Environment
* XUbuntu 24.04
*
Expand Down Expand Up @@ -163,3 +167,5 @@ QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1)
* borrow from there
* [ ] http proxy
* [ ] apt proxy


45 changes: 45 additions & 0 deletions readme_debug_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### autovars
```bash
# todo add to make file
```

## Debug
```bash
sudo apt install -y sshpass
sshpass -p ubuntu ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost
sshpass -p ubuntu ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@localhost
sshpass -p ubuntu ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu-server@localhost # ubuntu-server during install
ssh -p 3455 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost
```
```bash

# QMP
nc -U output/ub24-server/ub24-server.monitor
echo '{ "execute": "qmp_capabilities" }' | nc -U /home/jason/github/packer-qemu-ubuntu-tutorial/ubuntu/output/ub24-server/ub24-server.monitor

dd if=your_disk_image.raw | gzip > your_disk_image.dd.gz
sudo cloud-init schema --system
sudo cloud-init status --long
tree /etc/cloud -f
cat /etc/cloud/cloud.cfg
cat /etc/cloud/clean.d/99-installer
cat /etc/cloud/cloud.cfg.d/99-installer.cfg # this file is the metadata
cat /var/lib/cloud/instances/iid-datasource-none/cloud-config.txt
getent group sudo users cdrom sudo adm users
getent group users
getent group | grep users
getent group
```

```yaml
# cat /etc/cloud/cloud.cfg.d/99-installer.cfg # this file is the metadata
debug_cmd: |
cat /etc/cloud/cloud.cfg.d/99-installer.cfg
datasource:
None:
metadata:
instance-id: 1f0be9fb-4495-40c2-8db4-0930589a213a
userdata_raw: "#cloud-config\n..."
datasource_list:
- None
```
3 changes: 2 additions & 1 deletion ubuntu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ debug-build:
-on-error=ask \
.
tree -f output

debug-tree:
tree -fpsugh ${PKR_VAR_output_directory}/


# todo
Expand Down
7 changes: 4 additions & 3 deletions ubuntu/assets/meta-data
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!cloud-init
# https://cloudinit.readthedocs.io/en/latest/explanation/instancedata.html
# important:
datasource_list: none
datasource-list: none
datasource_list: [none]
# datasource-list: [none]
# doesn't seem to do much:
instance_id: ub2404-packer
instance-id: ub2404-packer
# instance-id: ub2404-packer
# local_hostname: ub2404-packer
# hostname: ub2404-packer
4 changes: 2 additions & 2 deletions ubuntu/assets/user-data_server_live
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ autoinstall:
ssh:
install-server: true
allow-pw: true
ssh_import_id:
- gh:hychan48 # replace with your github username
# ssh_import_id: doesn't exist for subiquity
# authorized-keys: []
locale: en_US.UTF-8
keyboard:
layout: us
Expand Down
6 changes: 5 additions & 1 deletion ubuntu/ub24-nocloud.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ build {

/* */
// also needs to change or not
/**
* Qemu Plugin ref - Shared Variables
* https://developer.hashicorp.com/packer/integrations/hashicorp/qemu/latest/components/builder/qemu
*/
source "qemu" "nocloud" {
// output_directory = abspath("${var.output_directory}/${source.name}")
// iso_url = "file:///var/lib/qemu/images/ubuntu-24.04-live-server-amd64.iso" # to be set
Expand Down Expand Up @@ -144,7 +148,7 @@ source "qemu" "nocloud" {
vtpm = false
qmp_enable = var.qmp_enable
cpu_model = "host"

// disk_size = "${var.disk_size}" # "40G"
# Final Image will be available in `output/packerubuntu-*/`


Expand Down

0 comments on commit 483290f

Please sign in to comment.