Off-store program installation - image - qemu

Hello, well, I need execute somes program off-store in snap (phoronix and lmbench for exemple) in ubuntu core 20 with qemu-kvm. These programs have .deb for install but I can not pass to img.
I thought so use snap classic to make download and install these programs, so in my .json i add snaps core and classic to, so ok, but when i init this system and use sudo classic, dont work "sudo apt install " results in “sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the ‘nosuid’ option set or an NFS file system without root privileges?”… I can’t progress on these issues

So, some questions to thank for a support:
1 - is there any other way install these programs, configure in .json or use gadget, because I still haven’t got a right direction;
2 - if not, with the use of classic, how would it be to pass permission? I use qemu format=raw, I thought it would be one of the problems, but in some other scenarios I still seem to be able to install , so I don’t know if be this.

my .json:

{
"type": "model",
"series": "16",
"authority-id": "<id>",
"brand-id": "<id>",
"model": "ubuntu-core-20-amd64",
"architecture": "amd64",
"timestamp": "2021-12-02T14:09:21+00:00",
"base": "core20",
"grade": "dangerous",
"snaps": [
    {
        "name": "pc",
        "type": "gadget",
        "default-channel": "20/stable",
        "id": "UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH"
    },
    {
        "name": "pc-kernel",
        "type": "kernel",
        "default-channel": "20/stable",
        "id": "pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza"
    },
    {
        "name": "core20",
        "type": "base",
        "default-channel": "latest/stable",
        "id": "DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q"
    },
{
        "name": "core",
        "type": "core",
        "default-channel": "latest/stable",
        "id": "99T7MUlRhtI3U0QFgl5mXXESAiSwt776"
    },
{
        "name": "snapd",
        "type": "snapd",
        "default-channel": "latest/stable",
        "id": "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4"
    },
{
    "name": "classic",
    "type": "app",
    "default-channel": "latest/edge",
    "id": "QbSFwGGAgvG8zHl9nWLY7vEee8lhgFsp"
}
]
}

use to build the img:

ubuntu-image snap ../my-model.model --snap pc-amd64-gadget/pc_20-0.4_amd64.snap -i 10G

And, so qemu:

qemu-system-x86_64 -smp 2 -m 2048 -net nic,model=virtio -net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -vga qxl -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=pc.img,cache=none,format=raw,id=disk1,if=none -device virtio-blk-pci,drive=disk1,bootindex=1 -machine accel=kvm

Gadget is default pc-amd64-gadget with cmdline change only.

There is no way to run classic snaps on Ubuntu Core … you should seed the lxd snap in your image via the model assertion …

…then you can use another snap that utilizes the lxd interface and uses pylxd to set up the containers as needed for you

1 Like