rig
rig copied to clipboard
Error when sed is not in `/usr/bin/sed`
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.
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.
Oh, my. Sorry for not searching for duplicates. That's my mistake for creating an issue in a hurry.
No worries, it is useful to know that more than one person has the same issue. :D
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.
@statnmap @eliocamp @nevermana-landcare (from https://github.com/r-lib/ps/issues/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?
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).
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.
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.
Same here. I migrated from 18.04.
I use the original version of Ubuntu.
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.
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