如何挂载 tmp 文件夹,就像它最初在 Ubuntu 18 上挂载一样

如何挂载 tmp 文件夹,就像它最初在 Ubuntu 18 上挂载一样

我正在更新操作系统并收到一条错误消息:

mount: /tmp: mount point not mounted or bad option.

因此我浏览了该网站并对挂载点进行了一些测试:

[03:02:10] root@deecee / # systemctl status tmp.mount
Unit tmp.mount could not be found.  

fstab 不包含有关在启动时挂载 /tmp 文件夹的任何信息,因此我尝试启用 tmp.mount

[03:08:32] root@deecee / # systemctl enable tmp.mount
Created symlink /etc/systemd/system/local-fs.target.wants/tmp.mount → /etc/systemd/system/tmp.mount.

[03:08:41] root@deecee / # systemctl status tmp.mount
● tmp.mount - Temporary Directory (/tmp)
   Loaded: loaded (/etc/systemd/system/tmp.mount; enabled; vendor preset: enabled)
   Active: inactive (dead)
    Where: /tmp
     What: tmpfs
     Docs: man:hier(7)
           https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems

我应该如何继续挂载 Ubuntu 18.04 中最初的 tmp 文件夹?

答案1

我关闭了机器上运行的小型服务。我强制卸载了 /tmp 文件夹,然后挂载了该文件夹。

[04:52:11] root@deecee / # umount -f -l /tmp

[04:54:49] root@deecee / # mount tmpfs /tmp -t tmpfs -o mode=1777,strictatime,nosuid,nodev

[04:55:04] root@deecee / # systemctl status tmp.mount
● tmp.mount - Temporary Directory (/tmp)
   Loaded: loaded (/etc/systemd/system/tmp.mount; enabled; vendor preset: enabled)
   Active: active (mounted) since Mon 2022-08-22 16:55:04 EDT; 4s ago
    Where: /tmp
     What: tmpfs
     Docs: man:hier(7)
           https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems

完成后,我就可以更新操作系统而不会出现任何错误。

相关内容