Skip to content

Instantly share code, notes, and snippets.

@come-maiz
Last active September 4, 2019 12:28
Show Gist options
  • Save come-maiz/ac8ec1df0d0964d7c5c36fd74d591239 to your computer and use it in GitHub Desktop.
Save come-maiz/ac8ec1df0d0964d7c5c36fd74d591239 to your computer and use it in GitHub Desktop.
Snappy images testing

Create the model:

$ cat dragonboard-model.json
{
    "type": "model",
    "authority-id": "$account_id",
    "brand-id": "$account_id",
    "series": "16",
    "model": "dragonboard",
    "architecture": "arm64",
    "gadget": "dragonboard",
    "kernel": "dragonboard-kernel",
    "timestamp": "$date"
}

Sign the model:

$ cat dragonboard-model.json | snap sign -k $key_name > dragonboard.model 2>&1

Create the image:

$ sudo /snap/bin/ubuntu-image --image-size 3G -c edge -o ubuntu-core-16-dragonboard-edge.img dragonboard.model                                                                                     
Fetching core
Fetching dragonboard-kernel
Fetching dragonboard

Insert the sdcard into the host PC.

Umount the sdcard partitions.

Flash the image:

$ sudo dd if=ubuntu-core-16-dragonboard-edge.img of=/dev/sdX bs=32M
$ sync

Insert the sdcard into the board.

On the back of the board, set the switch S6-2 to ON, the rest to OFF.

Connect the serial cable to the host PC.

Open the serial console:

http://elopio.net/blog/connecting-to-snappy-through-the-serial-console/#serial-console

Connect the board to the power source.

On the serial console, wait for the boot to finish:

Press enter to configure.

Configure the board:

1. Press enter.
2. Press enter in `Start`.
3. Select `wlan0`.
4. Select `Configure WIFI Settings`.
5. Enter the `Network name`.
6. Enter the network `Password`.
7. Press enter in `Done`.
8. Select `Use DHCPv4 on this interface`.
9. Press enter in `Done`.
10. Press enter in `Done`.
4. Enter the $email_address used to sign the model.
5. Press enter.
   * Check the successful registration message.
6. Press enter.

On a terminal in the host, access the board through ssh:

$ ssh $ip_address
$ snap list
Name                Version       Rev  Developer  Notes
core                16.04.1       386  canonical  -
dragonboard         16.04-0.18    24   canonical  -
dragonboard-kernel  4.4.0-1032-3  16   canonical  -
$ snap version
snap    2.17
snapd   2.17
series  16

From a different terminal in the host, run the tests:

$ sudo snap install spread --devmode
$ export SPREAD_EXTERNAL_ADDRESS=$ip_address:22
$ ~/workspace/go/src/github.com/snapcore/snapd$ ./tests/lib/external/prepare-ssh.sh $ip_address 22 $USER
$ ~/workspace/go/src/github.com/snapcore/snapd$ /snap/bin/spread -v -reuse external:ubuntu-core-16-arm-64

Result:

2016/11/02 00:45:58 Successful tasks: 84
2016/11/02 00:45:58 Aborted tasks: 0

Full execution log: https://paste.ubuntu.com/23415017/

Create the model:

$ cat pc-model.json
{
    "type": "model",
    "authority-id": "$account_id",
    "brand-id": "$account_id",
    "series": "16",
    "model": "pc",
    "architecture": "amd64",
    "gadget": "pc",
    "kernel": "pc-kernel",
    "timestamp": "$date"
}

Sign the model:

$ cat pc-model.json | snap sign -k $key_name > pc.model 2>&1

Create the image:

$ sudo /snap/bin/ubuntu-image --image-size 3G -c edge -o ubuntu-core-16-pc-edge.img pc.model                                                                                       
Fetching core
Fetching pc-kernel
Fetching pc

Start the image in qemu:

$ kvm -snapshot -m 512 -redir :8090::80 -redir :8022::22 ubuntu-core-16-pc-edge.img

Wait for the boot to finish:

Press enter to configure.

Configure the board:

1. Press enter.
2. Press enter in `Start`.
   * Check that eth0 has an $ip_address assigned.
3. Press enter in `Done`.
4. Enter the $email_address used to sign the model.
5. Press enter.
   * Check the successful registration message.
6. Press enter.

On a terminal in the host, access the virtual machine through ssh:

$ ssh localhost -p 8022
$ snap list
Name       Version     Rev  Developer  Notes
core       16.04.1     383  canonical  -
pc         16.04-0.8   9    canonical  -
pc-kernel  4.4.0-45-4  37   canonical  -
$ snap version
snap    2.17
snapd   2.17
series  16

From a different terminal in the host, run the tests:

$ sudo snap install spread --devmode
$ export SPREAD_EXTERNAL_ADDRESS=localhost:8022
$ ~/workspace/go/src/github.com/snapcore/snapd$ ./tests/lib/external/prepare-ssh.sh localhost 8022 $USER
$ ~/workspace/go/src/github.com/snapcore/snapd$ /snap/bin/spread -v external:ubuntu-core-16-64

Result:

2016/11/02 01:23:53 Successful tasks: 83
2016/11/02 01:23:53 Aborted tasks: 0
2016/11/02 01:23:53 Failed tasks: 1
    - external:ubuntu-core-16-64:tests/main/prepare-image-uboot

Full execution log: https://paste.ubuntu.com/23415125/

Create the model:

$ cat pi2-model.json
{
    "type": "model",
    "authority-id": "$account_id",
    "brand-id": "$account_id",
    "series": "16",
    "model": "pi2",
    "architecture": "armhf",
    "gadget": "pi2",
    "kernel": "pi2-kernel",
    "timestamp": "$date"
}

Sign the model:

$ cat pi2-model.json | snap sign -k $key_name > pi2.model 2>&1

Create the image:

$ sudo /snap/bin/ubuntu-image --image-size 3G -c edge -o ubuntu-core-16-pi2-edge.img pi2.model                                                                                     
Fetching core
Fetching pi2-kernel
Fetching pi2

Insert the sdcard into the host PC.

Umount the sdcard partitions.

Flash the image:

$ sudo dd if=ubuntu-core-16-pi2-edge.img of=/dev/sdX bs=32M
$ sync

Insert the sdcard into the board.

Share the wi-fi connection from the host PC to the board:

http://elopio.net/blog/sharing-network/

Connect the serial cable to the host PC:

http://elopio.net/blog/connecting-to-snappy-through-the-serial-console/#raspberry-pi

Open the serial console:

http://elopio.net/blog/connecting-to-snappy-through-the-serial-console/#serial-console

Connect the board to the power source.

On the serial console, wait for the boot to finish:

Press enter to configure.

Configure the board:

1. Press enter.
2. Press enter in `Start`.
   * Check that eth0 has an $ip_address assigned.
3. Press enter in `Done`.
4. Enter the $email_address used to sign the model.
5. Press enter.
   * Check the successful registration message.
6. Press enter.

On a terminal in the host, access the board through ssh:

$ ssh $ip_address
$ snap list
Name        Version       Rev  Developer  Notes
core        16.04.1       385  canonical  -
pi2         16.04-0.17    29   canonical  -
pi2-kernel  4.4.0-1030-3  22   canonical  -
$ snap version
snap    2.17
snapd   2.17
series  16

From a different terminal in the host, run the tests:

$ sudo snap install spread --devmode
$ export SPREAD_EXTERNAL_ADDRESS=$ip_address:22
$ ~/workspace/go/src/github.com/snapcore/snapd$ ./tests/lib/external/prepare-ssh.sh $ip_address 22 $USER
$ ~/workspace/go/src/github.com/snapcore/snapd$ /snap/bin/spread -v -reuse external:ubuntu-core-16-arm-32

Result:

2016/11/01 23:32:12 Successful tasks: 79
2016/11/01 23:32:12 Aborted tasks: 0
2016/11/01 23:32:12 Failed tasks: 1
    - external:ubuntu-core-16-arm-32:tests/main/refresh-undo

Full execution log: https://paste.ubuntu.com/23414797/

Create the model:

$ cat pi3-model.json
{
    "type": "model",
    "authority-id": "$account_id",
    "brand-id": "$account_id",
    "series": "16",
    "model": "pi3",
    "architecture": "armhf",
    "gadget": "pi3",
    "kernel": "pi2-kernel",
    "timestamp": "$date"
}

Sign the model:

$ cat pi3-model.json | snap sign -k $key_name > pi3.model 2>&1

Create the image:

$ sudo /snap/bin/ubuntu-image --image-size 3G -c edge -o ubuntu-core-16-pi3-edge.img pi3.model                                                                                     
Fetching core
Fetching pi2-kernel
Fetching pi3

Insert the sdcard into the host PC.

Umount the sdcard partitions.

Flash the image:

$ sudo dd if=ubuntu-core-16-pi3-edge.img of=/dev/sdX bs=32M
$ sync

Insert the sdcard into the board.

Share the wi-fi connection from the host PC to the board:

http://elopio.net/blog/sharing-network/

Connect the serial cable to the host PC:

http://elopio.net/blog/connecting-to-snappy-through-the-serial-console/#raspberry-pi

Open the serial console:

http://elopio.net/blog/connecting-to-snappy-through-the-serial-console/#serial-console

Connect the board to the power source.

On the serial console, wait for the boot to finish:

Press enter to configure.

Configure the board:

1. Press enter.
2. Press enter in `Start`.
   * Check that eth0 has an $ip_address assigned.
3. Press enter in `Done`.
4. Enter the $email_address used to sign the model.
5. Press enter.
   * Check the successful registration message.
6. Press enter.

On a terminal in the host, access the board through ssh:

$ ssh $ip_address
$ snap list
Name        Version       Rev  Developer  Notes
core        16.04.1       385  canonical  -
pi2-kernel  4.4.0-1030-3  22   canonical  -
pi3         16.04-0.5     6    canonical  -
$ snap version
snap    2.17
snapd   2.17
series  16

From a different terminal in the host, run the tests:

$ sudo snap install spread --devmode
$ export SPREAD_EXTERNAL_ADDRESS=$ip_address:22
$ ~/workspace/go/src/github.com/snapcore/snapd$ ./tests/lib/external/prepare-ssh.sh $ip_address 22 $USER
$ ~/workspace/go/src/github.com/snapcore/snapd$ /snap/bin/spread -v -reuse external:ubuntu-core-16-arm-32

Result:

2016/11/02 01:06:35 Successful tasks: 78
2016/11/02 01:06:35 Aborted tasks: 0
2016/11/02 01:06:35 Failed tasks: 2
    - external:ubuntu-core-16-arm-32:tests/main/interfaces-fuse_support
    - external:ubuntu-core-16-arm-32:tests/main/refresh-undo

Full execution log: https://paste.ubuntu.com/23415096/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment