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

Error while downloading source: Failed to convert " 4096": strconv.Atoi: parsing " 4096": invalid syntax #618

Closed
louds1lence opened this issue Apr 14, 2022 · 2 comments

Comments

@louds1lence
Copy link

Initial command/output

louds1lence@louds1lence-ubufocalx64:~$ sudo distrobuilder build-lxc ./ubuntu-core.yaml --cleanup=false --debug
INFO[2022-04-14T20:26:31-03:00] Downloading source                           
/tmp/distrobuilder/ubuntu-20-amd64/ubuntu-core-20-amd64.img.xz: 100% (909.63kB/s)
Error: Error while downloading source: Failed to convert " 4096": strconv.Atoi: parsing " 4096": invalid syntax

I tried this on my system, both with snap distrobuilder latest/stable and latest/edge, same output.

While looking at the code, ubuntu-http.go > line 70: strconv.Atoi(lines[len(lines)-2]) attempts to parse a line of out the output of the fdisk command. I ran that command on my system, and the value 4096 is indeed preceded by a space on that line which causes strconv.Atoi to throw a fit.

I pulled the code locally and changed that line to the below, which seemed to work fine to get past the error:
strconv.Atoi(strings.TrimSpace(lines[len(lines)-2]))

I'm just not sure if this is an actual bug or if I'm doing something different/unusual in my ubuntu-core.yaml than I should be.

fdisk -l -o Start /tmp/distrobuilder/ubuntu-20-amd64/ubuntu-core-20-amd64.img

louds1lence@louds1lence-ubufocalx64:~$ fdisk -l -o Start /tmp/distrobuilder/ubuntu-20-amd64/ubuntu-core-20-amd64.img
Disk /tmp/distrobuilder/ubuntu-20-amd64/ubuntu-core-20-amd64.img: 3.63 GiB, 3879731200 bytes, 7577600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E882DDF2-6618-4EDE-9B27-E5F49BF8E3FC

Start
 2048
 4096

fdisk --version

louds1lence@louds1lence-ubufocalx64:~$ fdisk --version
fdisk from util-linux 2.34

snap list output

louds1lence@louds1lence-ubufocalx64:~$ sudo snap list
Name                 Version                         Rev    Tracking         Publisher     Notes
bare                 1.0                             5      latest/stable    canonical✓    base
chromium             100.0.4896.88                   1961   latest/stable    canonical✓    -
code-insiders        a7a7f209                        980    latest/stable    vscode✓       classic
core                 16-2.54.4                       12834  latest/stable    canonical✓    core
core18               20220309                        2344   latest/stable    canonical✓    base
core20               20220318                        1405   latest/stable    canonical✓    base
distrobuilder        git-4faf4a9                     1310   latest/edge      stgraber      classic
dotnet-runtime-60    6.0.4                           19     latest/stable    dotnetcore✓   -
dotnet-sdk           6.0.202                         162    latest/stable    dotnetcore✓   classic
firefox              99.0.1-1                        1232   latest/stable    mozilla✓      -
gnome-3-28-1804      3.28.0-19-g98f9e67.98f9e67      161    latest/stable    canonical✓    -
gnome-3-38-2004      0+git.1f9014a                   99     latest/stable/…  canonical✓    -
go                   1.18                            9415   latest/stable    mwhudson      classic
gtk-common-themes    0.1-59-g7bca6ae                 1519   latest/stable/…  canonical✓    -
lxd                  5.0.0-e478009                   22894  latest/stable    canonical✓    -
make-system-user     12                              26     latest/stable    knitzsche     classic
nmap                 7.92                            2608   latest/stable    maxiberta     -
review-tools         0.48+20220307-1852UTC-1-gac71c  2614   latest/stable    canonical✓    -
simplenote           2.10.0                          544    latest/stable    snapcrafters  -
snap-store           3.38.0-66-gbd5b8f7              558    latest/stable    canonical✓    -
snapcraft            6.1                             7201   latest/stable    canonical✓    classic
snapd                2.54.4                          15177  latest/stable    canonical✓    snapd
test-snapd-swtpm     0.1.0                           1      latest/edge      anonymouse67  -
ubuntu-cloud-image   2021.03.30+git13f7fe7           156    latest/stable    powersj       -
ubuntu-image         2.1+snap7                       286    latest/edge      canonical✓    classic
ubuntu-iso-download  2021.02.13+git3d93a1a           180    latest/stable    powersj       -

ubuntu-core.yaml

image:
  distribution: "ubuntu"
  variant: core
  release: 20

source:
  downloader: ubuntu-http
  variant: core
  release: 20
  url: https://cdimage.ubuntu.com/ubuntu-core
  keys:
  # 0xC5986B4F1257FFA86632CBA746181433FBB75451
  - |-
    -----BEGIN PGP PUBLIC KEY BLOCK-----

    mQGiBEHUUngRBAChnb3mDLFxN/2A/2m2VdF4VduvwWqdzD2AXanEBud8G5HiPYxr
    ....
    z0T+u6krWvb0KxUhptxT7+mH7g/IEZsG+QF1l4U5wFobdSWvits6xJuxMnASkmnp
    a2HMTeZY
    =G0sa
    -----END PGP PUBLIC KEY BLOCK-----

  # 0x843938DF228D22F7B3742BC0D94AA3F0EFE21092
  - |-
    -----BEGIN PGP PUBLIC KEY BLOCK-----

    mQINBE+tjmgBEAC7pKK78t89DW7mvMoSgiScLfPNF8/TSF380is0hFRL3dOmcXEf
    ....
    YZcq1JxgHZbf3g+w/AnzSKZm9aDIgTr7yJBV1gqyQCS1ZV69X0sxf3RKNE1NWosH
    psO47413KSa8kPohVNT+PetcYchUU9HOHHueTbYb37tnrT4=
    =dfp9
    -----END PGP PUBLIC KEY BLOCK-----

targets:
  lxc:
    create_message: |-
      You just created an {{ image.description }} container.

      To enable SSH, run: apt install openssh-server
      No default root or user password are set by LXC.
    config:
    - type: all
      before: 5
      content: |-
        lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.common.conf

    - type: user
      before: 5
      content: |-
        lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.userns.conf

    - type: all
      after: 4
      content: |-
        lxc.include = LXC_TEMPLATE_CONFIG/common.conf

    - type: user
      after: 4
      content: |-
        lxc.include = LXC_TEMPLATE_CONFIG/userns.conf

    - type: all
      content: |-
        lxc.arch = {{ image.architecture_personality }}

packages:
  custom_manager:
    install:
      cmd: true
    remove:
      cmd: true
    update:
      cmd: true
    clean:
      cmd: true
    refresh:
      cmd: true

files:
- name: cloud-init-meta
  path: /lxd/meta-data
  generator: template
  content: |-
    #cloud-config
    instance-id: {{ container.name }}
    local-hostname: {{ container.name }}
    {{ config_get("user.meta-data", "") }}

- name: cloud-init-network
  path: /lxd/network-config
  generator: template
  content: |-
    {% if config_get("user.network-config", "") == "" %}version: 1
    config:
      - type: physical
        name: eth0
        subnets:
          - type: {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
            control: auto{% else %}{{ config_get("user.network-config", "") }}{% endif %}

- name: cloud-init-user
  path: /lxd/user-data
  generator: template
  template:
    properties:
      default: |
        #cloud-config
        {}
  content: |-
    {{ config_get("user.user-data", properties.default) }}

- name: cloud-init-vendor
  path: /lxd/vendor-data
  generator: template
  template:
    properties:
      default: |
        #cloud-config
        {}
  content: |-
    {{ config_get("user.vendor-data", properties.default) }}

- name: hostname
  path: /lxd/hostname
  generator: template
  content: |-
    {{ container.name }}

mappings:
  architecture_map: debian

System Info

============== start: go version       ==============
go version go1.18 linux/amd64
============== /end: go version        ==============

============== start: uname -a         ==============
Linux louds1lence-ubufocalx64 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
============== /end: uname -a          ==============

============== start: lsb_release -a   ==============
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal
============== /end: lsb_release -a    ==============

============== start: lshw -short      ==============
H/W path        Device      Class      Description
                            system     VirtualBox
/0                          bus        VirtualBox
/0/0                        memory     128KiB BIOS
/0/1                        memory     8GiB System memory
/0/2                        processor  11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
/0/100                      bridge     440FX - 82441FX PMC [Natoma]
/0/100/1                    bridge     82371SB PIIX3 ISA [Natoma/Triton II]
/0/100/1.1                  storage    82371AB/EB/MB PIIX4 IDE
/0/100/2                    display    SVGA II Adapter
/0/100/3        enp0s3      network    82540EM Gigabit Ethernet Controller
/0/100/4                    generic    VirtualBox Guest Service
/0/100/6                    bus        KeyLargo/Intrepid USB
/0/100/6/1      usb2        bus        OHCI PCI host controller
/0/100/6/1/1                input      USB Tablet
/0/100/7                    bridge     82371AB/EB/MB PIIX4 ACPI
/0/100/8        enp0s8      network    82540EM Gigabit Ethernet Controller
/0/100/b                    bus        82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller
/0/100/b/1      usb1        bus        EHCI Host Controller
/0/100/b/1/1                storage    USB CD-ROM
/0/100/d                    storage    82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode]
/0/3                        input      PnP device PNP0303
/0/4                        input      PnP device PNP0f03
/0/5            scsi2       storage    
/0/5/0.0.0      /dev/sda    disk       42GB VBOX HARDDISK
/0/5/0.0.0/1    /dev/sda1   volume     512MiB Windows FAT volume
/0/5/0.0.0/2    /dev/sda2   volume     39GiB Extended partition
/0/5/0.0.0/2/5  /dev/sda5   volume     39GiB EXT4 volume
/0/6            scsi3       storage    
/0/6/0.0.0      /dev/cdrom  disk       CD-ROM
/0/7            scsi4       storage    
/0/7/0.0.0      /dev/sr1    disk       CD-ROM
/1              virbr0-nic  network    Ethernet interface
============== /end: lshw -short       ==============
@stgraber
Copy link
Member

Hmm, I think we should actually remove the ubuntu-core plugin. We gave up on those images quite a while ago as the proper operation of Ubuntu Core inside of a container is very very tricky.

@louds1lence
Copy link
Author

Got it, thank you for letting me know :)

monstermunchkin added a commit to monstermunchkin/distrobuilder that referenced this issue Apr 19, 2022
See lxc#618.

Signed-off-by: Thomas Hipp <thomas.hipp@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants