Cannot set cpp alternatives link

Asked by Miren Radia

I came across this problem when I was trying to debug one of my GitHub Actions workflows running on GitHub's Ubuntu 24.04 runners. Since I was able to reproduce the problem in the ubuntu:noble docker container (Image bf3dc08bfed0), I thought I would ask here.

After starting the interactive container on my host machine (running Fedora 40) using

sudo docker container run -it ubuntu:noble /bin/bash

I ran the following commands

1. apt update
2. apt install cpp
3. update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-13 13

I get the following output from the last command

update-alternatives: renaming cpp link from /lib/cpp to /usr/bin/cpp
update-alternatives: using /usr/bin/cpp-13 to provide /usr/bin/cpp (cpp) in auto mode
update-alternatives: error: cannot stat file '/etc/alternatives/cpp': Too many levels of symbolic links

The link /usr/bin/cpp also no longer exists.

The above commands work fine in the Ubuntu 22.04 docker container (well with cpp-11). The reason I want to do this is so that I can change the version of cpp that /usr/bin/cpp points to. I didn't bother changing the default version in the commands above just to make the reproducer simpler.

Is this expected behaviour? If so, is there an alternative way to do what I want to achieve?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

I suggest you report a bug. Mark as a regression bug too

Can you help with this problem?

Provide an answer of your own, or ask Miren Radia for more information if necessary.

To post a message you must log in.