Error on attempt to create new image from container/snapshot


#1

Hey, I encounter an error when trying to create an image from a stopped container or container snapshot. The error message is:

$ lxc publish my-stopped-container --alias my-new-image
...
error: failed to create tar info header: archive/tar: sockets not supported

Should this work? Am I missing something? There's nothing suspicious/revealing in the debug output.

My lxc/lxd info is:

$ lxc info
config: {}
api_extensions:
- storage_zfs_remove_snapshots
- container_host_shutdown_timeout
- container_syscall_filtering
- auth_pki
- container_last_used_at
- etag
- patch
- usb_devices
- https_allowed_credentials
- image_compression_algorithm
- directory_manipulation
- container_cpu_time
- storage_zfs_use_refquota
- storage_lvm_mount_options
- network
- profile_usedby
- container_push
- container_exec_recording
- certificate_update
- container_exec_signal_handling
- gpu_devices
- container_image_properties
- migration_progress
- id_map
- network_firewall_filtering
- network_routes
- storage
- file_delete
- file_append
- network_dhcp_expiry
- storage_lvm_vg_rename
- storage_lvm_thinpool_rename
- network_vlan
- image_create_aliases
- container_stateless_copy
- container_only_migration
- storage_zfs_clone_copy
- unix_device_rename
- storage_lvm_use_thinpool
- storage_rsync_bwlimit
- network_vxlan_interface
- storage_btrfs_mount_options
- entity_description
- image_force_refresh
- storage_lvm_lv_resizing
- id_map_base
- file_symlinks
- container_push_target
- network_vlan_physical
- storage_images_delete
- container_edit_metadata
- container_snapshot_stateful_migration
- storage_driver_ceph
- storage_ceph_user_name
- resource_limits
- storage_volatile_initial_source
- storage_ceph_force_osd_reuse
- storage_block_filesystem_btrfs
- resources
- kernel_limits
- storage_api_volume_rename
- macaroon_authentication
- network_sriov
- console
api_status: stable
api_version: "1.0"
auth: trusted
public: false
auth_methods:
- tls
environment:
  addresses: []
  architectures:
  - x86_64
  - i686
  certificate: |
    -----BEGIN CERTIFICATE-----
    [snip]
    -----END CERTIFICATE-----
  certificate_fingerprint: 7aeaa50d06b3a77ae1b23552f482875a36e8634c092bde10f02d20128b0dfda3
  driver: lxc
  driver_version: 2.0.9
  kernel: Linux
  kernel_architecture: x86_64
  kernel_version: 4.13.0-1-amd64
  server: lxd
  server_pid: 11782
  server_version: "2.20"
  storage: zfs
  storage_version: 0.7.3-1

Thanks.


#2

Actually there's a debug message:

DBUG[12-01|06:56:23] Error tarring up /var/lib/lxd/snapshots/my-stopped-container/snap/rootfs/var/lib/lxd/unix.socket: failed to create tar info header: archive/tar: sockets not supported

So it looks like it fails because .../lxd/unix.socket is not excluded.?

I can reproduce it with:

$ lxc launch ubuntu:16.04 c1
$ lxc exec c1 -- bash -c 'touch /hello'
$ lxc stop c1
$ lxc publish c1 --alias c1-alias
error: failed to create tar info header: archive/tar: sockets not supported

(St├ęphane Graber) #3

I pushed a fix for this a few days ago, this will be in LXD 2.21.

How did you install LXD? I believe I cherry-picked this particular fix into the snap package at least.


#4

Thanks! I cherry-picked lxd/containers: Skip sockets in tarballs and publishing works again. I run 2.20 out of git.