I set the mount point for /var/log to tmpfs in /etc/fstab with a size specified of 500M and after reboot all VMs refused to start.After I deleted the tmpfs entry, the system runs fine.
I want to continue to mount /var/log as tmpfs, what should I do?
Maybe you have an error in fstab?
Try to edit the fstab in running VM and then run:
sudo mount -a
And check if it’ll work.
I’m modifying the host’s fstab.
Probably some app requires to have its own /var/log subdirectory existing for it to start and don’t try to create a new directory if it’s missing.
Check the log to see which app is failing to start and create subdirectory with needed permissions for it after mounting /var/log to tmpfs. You can mount mount /var/log to tmpfs and create all subdirectories using systemd-tmpfiles.
Untested:
Configure /var/log mount to tmpfs in /etc/fstab:
tmpfs /var/log tmpfs defaults,noatime,size=32M 0 0
You can get the directories and subdirectories with their permissions with this command:
[user@dom0 ~]$ sudo find /var/log -type d -exec stat -c 'd %n %a %U %G -' {} \;
d /var/log 755 root root -
d /var/log/journal 2755 root systemd-journal -
d /var/log/private 700 root root -
d /var/log/xen 770 root qubes -
d /var/log/xen/console 2750 root qubes -
d /var/log/chrony 750 chrony chrony -
d /var/log/usbguard 755 root root -
d /var/log/lightdm 755 lightdm lightdm -
d /var/log/libvirt 700 root root -
d /var/log/libvirt/libxl 700 root root -
d /var/log/blivet-gui 755 root root -
d /var/log/salt 755 root root -
d /var/log/qubes 2770 root qubes -
d /var/log/audit 700 root root -
d /var/log/anaconda 755 root root -
Then create config file /etc/tmpfiles.d/varlog-tmpfs.conf with this content (exclude /var/log and possible /var/log/journal subdirectories from the command output above):
d /var/log/journal 2755 root systemd-journal -
d /var/log/private 700 root root -
d /var/log/xen 770 root qubes -
d /var/log/xen/console 2750 root qubes -
d /var/log/chrony 750 chrony chrony -
d /var/log/usbguard 755 root root -
d /var/log/lightdm 755 lightdm lightdm -
d /var/log/libvirt 700 root root -
d /var/log/libvirt/libxl 700 root root -
d /var/log/blivet-gui 755 root root -
d /var/log/salt 755 root root -
d /var/log/qubes 2770 root qubes -
d /var/log/audit 700 root root -
d /var/log/anaconda 755 root root -
This config will tell systemd-tmpfiles to create these directories on every boot in empty /var/log directory.