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 when sed is not in /usr/bin/sed #119

Closed
eliocamp opened this issue Aug 23, 2022 · 11 comments
Closed

Error when sed is not in /usr/bin/sed #119

eliocamp opened this issue Aug 23, 2022 · 11 comments
Labels
feature a feature request or enhancement

Comments

@eliocamp
Copy link

I got this on a computer with Ubuntu 20.04.

[17:14, 23.8.2022] Pao: [INFO] Installing pak for R 4.2.1
[INFO] > /opt/R/4.2.1/bin/R: line 193: /usr/bin/sed: No such file or directory
[INFO] > ERROR: option '-e' requires a non-empty argument
[ERROR] Failed to to install pak for R 4.2.1: command ["/opt/R/4.2.1/bin/R", "--vanilla", "-s", "-e", "invisible()"] exited with code 1

This error prevented installing pak, but the R installation worked. However, doing anything was impossible as it was met with the same error:

[17:14, 23.8.2022] Pao: /opt/R/4.2.1/lib/R/bin/R: line 193: /usr/bin/sed: No such file or directory
ERROR: option '-e' requires a non-empty argument

which sed returned /bin/sed so the workaround was to create a symlink.

@gaborcsardi
Copy link
Member

Not really a rig issue, but rather an issue with R, I would say. It remembers where sed was when it was built, and then it looks for it there when it runs. Why it cannot just find it on the PATH is beyond me.

This is a duplicate of #82, btw. so apparently people are running into it, so I'll see if we could work around it in rig.

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Aug 23, 2022
@eliocamp
Copy link
Author

Oh, my. Sorry for not searching for duplicates. That's my mistake for creating an issue in a hurry.

@gaborcsardi
Copy link
Member

No worries, it is useful to know that more than one person has the same issue. :D

@gaborcsardi
Copy link
Member

gaborcsardi commented Aug 29, 2022

The other thing that I don't understand is how people end up without /usr/bin/sed. It must be an Ubuntu thing, yet on a minimal container it is already there:

ubuntu@foo:~$ docker run -ti --platform=linux/arm64 ubuntu:20.04 which -a sed
/usr/bin/sed
/bin/sed

It is from the sed package:

root@c7efde0c39f6:~# dpkg -S /bin/sed
sed: /bin/sed

And while it is possible to remove it, there is a stern warning for it:

root@c7efde0c39f6:~# apt-get remove sed
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  sed
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  sed
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 336 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?]

I guess the sed package is not removed, only the /bin/sed binary.

@gaborcsardi
Copy link
Member

@statnmap @eliocamp @nevermana-landcare (from r-lib/ps#110) do you have any clue how your Ubuntu did not have sed at both /bin/sed and /usr/bin/sed?

Did you originally update from an earlier version of Ubuntu? Or did you run Ubuntu 20.04 in a container? Did you use the original Ubuntu or another distro based on Ubuntu 20.04?

Are /bin and /usr/bin on the same partition for you?

@eliocamp
Copy link
Author

I actually have elementary OS, which is based on Ubuntu 20.04. I installed it from scratch with its current version. I think both locations are in the same root partition (I have a separate partition for home, but that's it).

@nevermana-landcare
Copy link

For me I suspect the reason was because I did a release upgrade from 18.04 to 20.04 rather than a fresh install of 20.04. I also encountered similar issues with other packages not being where they were expected for 20.04, so assume this was due to upgrading from 18.04. I've subsequently performed a fresh install of 20.04 and didn't encounter these issues.

@gaborcsardi
Copy link
Member

Aha, on 18.04 there is no /usr/bin/sed, so that could be an explanation for some of the issues. We'll try to work around this in rig.

@statnmap
Copy link

Same here. I migrated from 18.04.
I use the original version of Ubuntu.

@gaborcsardi gaborcsardi added this to the v0.5.2 milestone Sep 9, 2022
@gaborcsardi gaborcsardi removed this from the v0.5.2 milestone Sep 20, 2022
@gaborcsardi
Copy link
Member

gaborcsardi commented Jul 20, 2023

It is quite cumbersome to work around this in rig, because if R was compiled with SED=/usr/bin/sed, then it is embedded into a bunch of files, and we would need to patch all of them:

root@22888f11325d:/opt/R/4.3.1# rg /usr/bin/sed
bin/R
122:SED=/usr/bin/sed

lib/R/bin/R
122:SED=/usr/bin/sed

lib/R/bin/libtool
79:SED="/usr/bin/sed"

lib/R/etc/Makeconf
121:SED = /usr/bin/sed

lib/R/etc/Renviron
40:SED=${SED-'/usr/bin/sed'}

So it is better to advise the used to add the /bin/sed -> /usr/bin/sed (sym)link.

@gaborcsardi
Copy link
Member

So now you'll get this error in this situation:

[ERROR] This version of R was compiled using sed at /usr/bin/sed
        but it is missing on your system.
        Run `ln -s /bin/sed /usr/bin/sed` as the root user to fix this,
        and then run rig again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants