Yocto Issues | The TMPDIR: /home12/calm.xia/poky/qemuarm/tmp can't be located on nfs.

【背景】

最近工作要學習Yocto,之前沒有了解過,想跟着經典書《Embedded Linux Development using Yocto Porject 2th Edition - Alex Gonzalez.pdf》,下載原生的Yocto(Poky)體驗一把。

登錄服務器server.xxx.com,直接從網上下載原生yocto 2.4版本,然後執行如下命令進行構建體驗:

source ./oe-init-build-env qemuarm
MACHINE=qemuarm bitbake core-image-minimal

【報錯】

calm.xia@server[16:33:32]:source ./oe-init-build-env qemuarm
...
calm.xia@server[16:33:32]:~/poky/qemuarm$ MACHINE=qemuarm bitbake core-image-minimal
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    The TMPDIR: /home12/calm.xia/poky/qemuarm/tmp can't be located on nfs.


Summary: There was 1 ERROR message shown, returning a non-zero exit code.

【分析】

https://www.yoctoproject.org/docs/3.0/ref-manual/ref-manual.html#ref-images

Note
By default, the Build Directory contains TMPDIR, which is a temporary directory the build system uses for its work. TMPDIR cannot be under NFS. Thus, by default, the Build Directory cannot be under NFS. However, if you need the Build Directory to be under NFS, you can set this up by setting TMPDIR in your local.conf file to use a local drive. Doing so effectively separates TMPDIR from TOPDIR, which is the Build Directory.

看官方文檔解釋,TMPDIR 不能掛載到nfs,這說明我們服務器給開發人員分配的目錄是掛載到nfs的,實際上通過mount命令查看確實如此,TMPDIR指定的目錄必須是本機磁盤目錄,google了搜到的答案都是類似。

【解決辦法】

  • 方法一:在根目錄/創建tmp,不出意外提示沒有權限(公司級別的服務器豈容你瞎搞,公司IT這塊做的還是蠻不錯);失敗
  • 方法二:參照C文檔創建docker環境,並在docker環境下從新git clone代碼並編譯,報同樣的錯誤,原因同樣是docker環境下TMPDIR掛載的依然是nfs文件系統;失敗
You can also run generated qemu images with a command like 'runqemu qemux86'
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$ MACHINE=qemuarm bitbake core-image-minimal
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    The TMPDIR: /home/docker/docker_poky/poky/qemuarm/tmp can't be located on nfs.


Summary: There was 1 ERROR message shown, returning a non-zero exit code.
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$ mount | grep "calm.xia"
shext_9k1:/and_home5/calm.xia on /home/docker type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,acregmin=60,acdirmin=60,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.29.1.111,mountvers=3,mountport=635,mountproto=tcp,local_lock=none,addr=10.29.1.111)
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$
  • 方法三:原生Yocto項目要解決TMPDIR不能掛載到nfs文件系統這個問題根本方法還是要在本機磁盤新建目錄,作爲TMPDIR指定目錄。
    書上的操作目錄就是/opt/yocto,我就死馬當活馬醫進入/opt看看,驚喜來啦 – 意外發現服務器已經有了目錄 /opt/tmp,而且這個目錄就是777權限(熒光綠!)(後面發現還有個/tmp也是如此),也就是說可以在這裏自由新建(讀寫執行)本地目錄作爲TMPDIR的指定目錄,問題就在這麼機緣巧合下解決,還好沒放棄。
    Y:\poky\qemuarm\conf\local.conf 文件修改如下
    TMPDIR = “/opt/tmp/calm.xia/yocto/poky/qemuarm/tmp”
  • 方法四:聽大牛說還可以通過其他方式設置TMPDIR,而且不需要設置本機磁盤目錄,待研究。。。

總結思考:

  • 不拋棄不放棄,問題總歸有解決辦法
    此問題block了我兩天,網上搜索了各種方法都是要在本機磁盤創建目錄用你來制定TPMDIR的路徑,但是公司級別的開發服務器對於開發人員是沒有這種權限的。中間暫停了近一天,後面還是想解決掉它。在堅持想盡一切辦法的情況下,終於柳暗花明。
  • 辦法不止一種
    問題的解決辦法肯定不止一種,如果只有一種,那麼只可能是你能力、經驗、見識不夠,沒見過想不到其他解決辦法,努力學習積累吧,奮鬥的騷年。
  • 站在巨人的肩膀上
    常見的需求通常已經有解決方案的,要有意識記住這一點,不要認爲你是第一個遇到這個問題的人,吭哧吭哧忙活半天,其實別人早就已經有解決方案了,你只是缺乏發現的能力,要善於借用資源。
    比如服務器 /tmp和/opt/tmp 這種開放權限的目錄,公司級別的開發肯定是有不少人會遇到此類需求,既然需求這麼普遍,那麼肯定會有解決辦法,試着去找找?
    比如除了/tmp和/opt/tmp這種方法,大牛們還有其他方法,你要做的就是要知道是否有人解決過這個問題?想盡一切辦法找到這個信息,再找到那位大牛!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章