tiup playground: no such file or directory

[root@localhost ~]#  curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 3418k  100 3418k    0     0  3423k      0 --:--:-- --:--:-- --:--:-- 3429k^[[A
Detected shell: /bin/bash
Shell profile:  /root/.bash_profile
Installed path: /root/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================
[root@localhost ~]# tiup playground
The component `playground` is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/playground-v0.0.6-linux-amd64.tar.gz:
8937370 / 8937370 [-----------------------------------------------------------------------------------------------------------------------------------] 100.00% 84539119 p/s
Failed to start component `playground`
Error: fork/exec /root/.tiup/components/playground/v0.0.6/playground: no such file or directory

请执行完 source /root/.bash_profile 后,再进行以下操作,如下:

  1. tiup uninstall playground --all
  2. tiup playground

你好,我本地不能重现这个 BUG,请问:

  1. 是否在 WSL 上运行
  2. 下载过程是否有中断

执行了,不行,问题同样

环境是virtualbox,启的centos 7, curl和wget 命令都是有的 将整个 .tiup 目录清除过,重新 再curl执行,还是报相同的问题

手工 wget https://tiup-mirrors.pingcap.com/playground-v0.0.6-linux-amd64.tar.gz 是可以下载成功的

我还能从哪里看到到底哪里报错的?

我本地编译了tiup,加了几个地方 print, 又多运行了几次,这次看见个

Error: download from https://tiup-mirrors.pingcap.com/playground-v0.0.6-linux-amd64.tar.gz failed: stream error: stream ID 1; PROTOCOL_ERROR

,然后再运行后,开始下载后面几个了,但还是报错

targetDir  /root/.tiup/components/pd/v4.0.0-rc
download https://tiup-mirrors.pingcap.com/pd-v4.0.0-rc-linux-amd64.tar.gz:
33220772 / 33220772 [------------------------------------------] 100.00% 31265202 p/s
targetDir  /root/.tiup/components/tikv/v4.0.0-rc
download https://tiup-mirrors.pingcap.com/tikv-v4.0.0-rc-linux-amd64.tar.gz:
133927974 / 133927974 [----------------------------------------] 100.00% 17715076 p/s
 
targetDir  /root/.tiup/components/tidb/v4.0.0-rc
download https://tiup-mirrors.pingcap.com/tidb-v4.0.0-rc-linux-amd64.tar.gz:
34051221 / 34051221 [------------------------------------------] 100.00% 30639006 p/s
Playground Bootstrapping...
Failed to start component `pd`
Error: fork/exec /root/.tiup/components/pd/v4.0.0-rc/pd-server: no such file or directory
Failed to start component `tikv`
Error: fork/exec /root/.tiup/components/tikv/v4.0.0-rc/tikv-server: no such file or directory
Failed to start component `tidb`
Error: fork/exec /root/.tiup/components/tidb/v4.0.0-rc/tidb-server: no such file or directory
.................... 

难道确实是CDN有问题?

从输出的日志来看,确实有下载失败的情况,后续我们会加一些日志信息

我发现问题是 wget 可以正确下载

但程序里下载后是不正确的, tar xf 解压就报错了,且程序下载,不报错

看来是 https://tiup-mirrors.pingcap.com 这里有什么。。。。。特别的技巧

tiup 里用的 grab也一样

package main

import (
	"io"
	"net/http"
	"os"
)

func DownloadFile( url string,filepath string,) error {

	// Get the data
	resp, err := http.Get(url)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Create the file
	out, err := os.Create(filepath)
	if err != nil {
		return err
	}
	defer out.Close()

	// Write the body to file
	_, err = io.Copy(out, resp.Body)
	println("download!!! ",url,filepath)
	return err
}


func main() {
	fileUrl := "/root/a/playground-v0.0.6-linux-amd64.tar.gz"

	if err := DownloadFile("https://tiup-mirrors.pingcap.com/playground-v0.0.6-linux-amd64.tar.gz", fileUrl); err != nil {
		panic(err)
	}
	println("ok")
}

应该是 bug,下载后文件的大小没有问题,但实际内容可能不正确了,下载完文件后应该要做 CRC 或都 MD5 值校验

fileUrl := "/root/a/playground-v0.0.6-linux-amd64.tar.gz"

这一行改成

fileUrl := "/tmp/playground-v0.0.6-linux-amd64.tar.gz"

之后可以 work

应该和这目录名完全没关系的。。 那只是我自己建了个 a 目录, 下载到 /tmp 行为也一样的(已验)

我这上海移动带宽环境

就是 wget 直接下载,文件正常解压

就上面这段最朴素下载代码后, 文件就错误了

看前面的输出,下载过来的包大小没问题的,那么还有个可能是解压的时候出错了 能单独执行一下

tiup install pd:v4.0.0-rc
ls -l /root/.tiup/components/pd/v4.0.0-rc/

这两个命令吗?看看到底解压出了什么东西

在我这就是太奇怪了

[root@localhost ~]# tiup install pd:v4.0.0-rc
download https://tiup-mirrors.pingcap.com/pd-v4.0.0-rc-linux-amd64.tar.gz:
33220772 / 33220772 [---------------------------------------------------------------------------------------------------------------------------------] 100.00% 27145091 p/s
[root@localhost ~]# tiup install pd:v4.0.0-rc
The component `pd:v4.0.0-rc` has been installed.

但 components 里没有pd的, /tmp里也没有

额。。。应该是我自己的问题

此 CENTOS是我精简过,删过很多内核的东西

感谢反馈

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。