Unable to create tempDir. java.io.tmpdir is set to /tmp


磁盤掛載后,啟動報錯 Unable to create tempDir. java.io.tmpdir is set to /tmp

[2022-03-30 17:12:06.596] WARN [main] AbstractApplicationContext.java:558 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
[2022-03-30 17:12:06.615] INFO [main] ConditionEvaluationReportLoggingListener.java:136 - 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2022-03-30 17:12:06.619] ERROR [main] SpringApplication.java:837 - Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at com.vipsoft.boot.admin.VipSoftAdminApplication.main(VipSoftAdminApplication.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
        at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:196)
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.prepareContext(TomcatServletWebServerFactory.java:210)
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:190)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:176)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:158)
        ... 17 common frames omitted
Caused by: java.io.IOException: Read-only file system
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createTempFile(File.java:2061)
        at java.io.File.createTempFile(File.java:2107)
        at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:188)
        ... 21 common frames omitted

更改 /tmp目錄 的權限以授予您的用戶訪問權限

[root@iZuf66gcq71y5hlfv02w6aZ 50002_push]# chmod -R 777 /tmp
chmod: changing permissions of ‘/tmp’: Read-only file system

 [root@iZuf66gcq71y5hlfv02w6aZ ~]# mount -o remount,rw /

1系統文件

  mount -rw -o remount /

2移動硬盤或者U盤

  sudo mount -o remount,rw /dev/sdc1

此時,進入文件系統,發現文件加鎖,這是加權限即可

sudo chmod +777 *

 


 

1.mount 命令 [-t 文件系統] [-L 卷標名] [-o 特殊選項] 設備文件名 掛載點

-l 查詢系統中已經掛載的設備,-l 會顯示卷標

-a 依據配置文件/etc/fstab的內容,自動掛載

-t 系統文件,加入系統類型指定掛載類型,可以ext3,ext4, iso9660等系統文件

-L 卷標名:掛載指定分區,而不是設備文件名掛載

-o 特殊選擇:可以指定掛載額外選項

 

atime/noatime 更新訪問時間/不更新訪問時間。訪問分區時,是否更新文件的訪問時間,默認更新

async/sync 異步/同步 默認異步

auto/noauto 自動/手動 mount -a命令執行時,是否會自動安裝/etc/fstab 文件內容掛載,默認自動

defaults 定義默認值,相當於rw、suid、dev、exec、auto、nouser、async這七個選擇

exec/noexec 執行/不執行,設定師傅允許文件系統中執行可執行文件,默認是exec允許

remount 重新掛載已經掛載的文件系統,一般用於修改特殊權限

rw/ro 讀寫/只讀,文件系統掛載時,是否有讀寫的權限,默認rw

suid/nosuid 具有/不具有SUID權限,設定文件系統是否具有SUID權限,默認具有

user/nouser 允許/不允許普通用戶掛載,設定文件系統是否允許普通用戶掛載,默認不允許,只有root可以掛載分區

usrquata 寫入代表文件系統支持用戶磁盤配額,默認不支持

grpquata 寫入代表文件系統支持組磁盤配額,默認不允許

 

eg: mount -o remount,noexec /home 讓 /home目錄下不能執行可執行文件 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM