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

Failed when link to binary in storage.files field. #1041

Open
OrwillT opened this issue Jul 22, 2020 · 5 comments
Open

Failed when link to binary in storage.files field. #1041

OrwillT opened this issue Jul 22, 2020 · 5 comments

Comments

@OrwillT
Copy link

@OrwillT OrwillT commented Jul 22, 2020

Bug

Operating System Version

32.20200629.3.0

Ignition Version

3.0.0

Environment

KVM

Expected Behavior

Should success.

Actual Behavior

Failed.

Reproduction Steps

  1. create a ignition file like this:
variant: fcos
version: 1.0.0
storage:
  files:
  - path: /usr/local/bin/xxx
    contents:
      source: https://xxx.xxx/xxx
    mode: 0755
  links:
  - path: /usr/local/bin/link
    target: /usr/local/bin/xxx
  1. boot a FCOS with this file.

Other Information

See discussion

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Jul 22, 2020

That should work. What error are you getting from Ignition on the console?

@OrwillT
Copy link
Author

@OrwillT OrwillT commented Jul 23, 2020

Because of the VNC display size limitation, I cannot see the related error log. What I know is boot succeed after I delete links filed,.

@bgilbert
Copy link
Member

@bgilbert bgilbert commented Jul 23, 2020

Could you post the (anonymized) contents of the Ignition config that you passed to the machine?

You should also be able to get logs from the VM's serial console.

@OrwillT
Copy link
Author

@OrwillT OrwillT commented Jul 23, 2020

storage.files.path is /usr/local/bin/k3s

storage.files.source is https://assets.anislet.dev/binary/k3s/v1.18.6/k3s

storage.links.path is /usr/local/bin/kubectl

I can't cause this is a VPS.

@dustymabe
Copy link
Member

@dustymabe dustymabe commented Jul 23, 2020

I can reproduce with:

variant: fcos
version: 1.0.0
systemd:
  units:
  - name: serial-getty@ttyS0.service
    dropins:
    - name: autologin-core.conf
      contents: |
        [Service]
        # Override Execstart in main unit
        ExecStart=
        # Add new Execstart with `-` prefix to ignore failure
        ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
        TTYVTDisallocate=no
storage:
  files:
  - path: /usr/local/bin/k3s
    contents:
      source: https://github.com/rancher/k3s/releases/download/v1.18.6%2Bk3s1/k3s
    mode: 0755
  links:
  - path: /usr/local/bin/link
    target: /usr/local/bin/k3s

The error:

CRITICAL : Ignition failed: failed to handle relabeling: exit status 255: Cmd: "setfiles" "-vF0" "-r" "/sysroot" "/sysroot/etc/selinux/targeted/contexts/files/file_contexts" "-f" "-" Stdout: "
Relabeled /sysroot/etc/passwd from unlabeled to system_u:object_r:passwd_file_t:s0
Relabeled /sysroot/etc/passwd- from unlabeled to system_u:object_r:passwd_file_t:s0
Relabeled /sysroot/etc/group from unlabeled to system_u:object_r:passwd_file_t:s0
Relabeled /sysroot/etc/group- from unlabeled to system_u:object_r:passwd_file_t:s0
Relabeled /sysroot/etc/shadow from unlabeled to system_u:object_r:shadow_t:s0
Relabeled /sysroot/etc/shadow- from unlabeled to system_u:object_r:shadow_t:s0
Relabeled /sysroot/etc/ gshadow from unlabeled to system_u:object_r:shadow_t:s0
Relabeled /sysroot/etc/gshadow- from unlabeled to system_u:object_r:shadow_t:s0
Relabeled /sysroot/etc/subuid from unlabeled to system_u:object_r:etc_t:s0
Relabeled /sysroot/etc/ subuid- from unlabeled to system_u:object_r:etc_t:s0
Relabeled /sysroot/etc/subgid from unlabeled to system_u:object_r:etc_t:s0
Relabeled /sysroot/etc/subgid- from unlabeled to system_u:object_r:etc_t:s0
Relabeled /sysroot/etc/.pwd.lock from unlabeled to system_u:object_r:passwd_file_t:s0
Relabeled /sysroot/var/home/core from unlabeled to unconfined_u:object_r:user_home_dir_t:s0
Relabeled /sysroot/var/home/core/.bash_logout from unlabeled to unconfined_u:object_r:user_home_t:s0
Relabeled /sysroot/var/home/core/.bash_profile from unlabeled to unconfined_u:object_r:user_home_t:s0
Relabeled /sysroot/var/home/core/.bashrc from unlabeled to unconfined_u:object_r:user_home_t:s0
Relabeled /sysroot/var /usrlocal/bin/k3s from unlabeled to system_u:object_r:bin_t:s0
Relabeled /sysroot/etc/systemd/system/serial-getty@ttyS0.service.d from unlabeled to system_u:object_r:systemd_unit_file_t:s0
Relabeled /sysroot/etc/systemd/system/serial-getty@ttyS0.service.d/autologin-core.conf from unlabeled to system_u:object_r:getty_unit_file_t:s0
" Stderr: "setfiles: statfs(/sysroot/var/usrlocal/bin/link) failed: No such file or directory
"

This looks like an instance of coreos/fedora-coreos-tracker#512

You can workaround by making it an relative symlink:

variant: fcos
version: 1.0.0
systemd:
  units:
  - name: serial-getty@ttyS0.service
    dropins:
    - name: autologin-core.conf
      contents: |
        [Service]
        # Override Execstart in main unit
        ExecStart=
        # Add new Execstart with `-` prefix to ignore failure
        ExecStart=-/usr/sbin/agetty --autologin core --noclear %I $TERM
        TTYVTDisallocate=no
storage:
  files:
  - path: /usr/local/bin/k3s
    contents:
      source: https://github.com/rancher/k3s/releases/download/v1.18.6%2Bk3s1/k3s
    mode: 0755
  links:
  - path: /usr/local/bin/link
    target: ./k3s

After the system is up:

[core@localhost ~]$ ls -l /usr/local/bin/
total 52188
-rwxr-xr-x. 1 root root 53440512 Jul 23 14:18 k3s
lrwxrwxrwx. 1 root root        5 Jul 23 14:18 link -> ./k3s
[core@localhost ~]$ /usr/local/bin/k3s --version
k3s version v1.18.6+k3s1 (6f56fa1d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants