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

Circular symlinks when legacy_debian_symlinks = true #335

Closed
fnoop opened this issue Nov 13, 2017 · 3 comments
Closed

Circular symlinks when legacy_debian_symlinks = true #335

fnoop opened this issue Nov 13, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@fnoop
Copy link
Contributor

fnoop commented Nov 13, 2017

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.2.0
  • Ruby: 2.3.3p222
  • Distribution: Raspbian / debian stretch and Ubuntu 16.04
  • Module version: 4.0.0

How to reproduce (e.g Puppet code you use)

    class { 'nodejs':
        repo_url_suffix => '8.x',
        legacy_debian_symlinks => true,
        nodejs_package_ensure => latest,
    }

What are you seeing

Circular symlinks and nodejs not working:

ls -l /usr/bin/node
lrwxrwxrwx 1 root root 15 Nov 13 07:32 /usr/bin/node -> /usr/bin/nodejs
ls -l /usr/bin/nodejs
lrwxrwxrwx 1 root root 24 Nov 13 07:31 /usr/bin/nodejs -> /etc/alternatives/nodejs
ls -l /etc/alternatives/nodejs
lrwxrwxrwx 1 root root 13 Nov 13 07:31 /etc/alternatives/nodejs -> /usr/bin/node

What behaviour did you expect instead

Output log

Notice: /Stage[main]/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]/Apt_key[Add key: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 from Apt::Source nodesource]/ensure: created
Notice: /Stage[main]/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Setting[list-nodesource]/File[/etc/apt/sources.list.d/nodesource.list]/ensure: defined content as '{md5}358da832fb466325b172bc8ec5dc6cf0'
Notice: /Stage[main]/Apt::Update/Exec[apt_update]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: ensure changed '4.8.2~dfsg-1' to '8.9.1-1nodesource1'
Notice: /Stage[main]/Nodejs::Install/Package[nodejs-dev]/ensure: removed
Notice: /Stage[main]/Nodejs::Install/File[/usr/bin/node]/ensure: ensure changed 'file' to 'link'
Notice: /Stage[main]/Nodejs::Install/File[/usr/share/man/man1/node.1.gz]/ensure: ensure changed 'file' to 'link'
Notice: /Stage[main]/Nodejs::Install/Package[npm]/ensure: removed
Notice: /Stage[main]/Nodejs::Install/File[root_npmrc]/ensure: defined content as '{md5}17626e1e7e2db5c71227460a36f6bbb8'

Any additional information you'd like to impart

The nodejs package installed from the repo that this module manages installs node as /usr/bin/node:

dpkg -L nodejs |grep 'usr/bin'
/usr/bin
/usr/bin/node
/usr/bin/npx
/usr/bin/npm

This module then overwrites this with a symlink. Nor is this behaviour idempotent - the first run it installs the link before the package so the package overwrites the link, then on subsequent run it overwrites the file with the link.

@fnoop
Copy link
Contributor Author

fnoop commented Nov 13, 2017

legacy_debian_symlinks => false resolves the behaviour, this parameter should be aware of which versions/packages provide node or nodejs. Once the circular symlinks are in place the nodejs package cannot be removed (fails preremove checks).

@juniorsysadmin juniorsysadmin added the bug Something isn't working label Nov 13, 2017
@juniorsysadmin juniorsysadmin changed the title circular symlinks on raspbian/debian and ubuntu Circular symlinks when legacy_debian_symlinks = true Nov 13, 2017
@juniorsysadmin
Copy link
Member

@fnoop Quality bug report. Can you confirm that you didn't have the nodejs-legacy package installed?

This module then overwrites this with a symlink.

Whoops.

Nor is this behaviour idempotent - the first run it installs the link before the package so the package overwrites the link, then on subsequent run it overwrites the file with the link.

Even better.

this parameter should be aware of which versions/packages provide node or nodejs

This could be a bit tricky. An easier solution might be to run a hackey exec to check the existence and type of file of /usr/bin/node and go from there.

Once the circular symlinks are in place the nodejs package cannot be removed (fails preremove checks).

Super.

@juniorsysadmin
Copy link
Member

The best way to fix this is probably using puppet-alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants