PS: change "/tmp" deletion from the time of boot to the time of shutting down to prevent data loss
On Mon, 26 Jul 2021 23:19:09 +0300, Nicholas Guriev wrote: >You can pass `init=/bin/bash` as kernel boot parameter through GRUB and >then copy the temporary files to a safe place. I can't comment on GRUB. While my machine has got more than one Ubuntu install, too, I'm in favour of syslinux. However, _if_ the wanted files are still in place, access by any live Linux (Ubuntu DVD, whatsoever Linux distro USB stick ...) can be used, too. IMO the better approach is to not use /tmp/ for important log data _or_ at least to disable deletion of /tmp/ items by appropriate measures. Well, I doubt that disabling or masking services that clean tmp/ from time to time is an appropriate measure. It will keep log data in tmp/, but garbage will be collected, too. -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
Re: change "/tmp" deletion from the time of boot to the time of shutting down to prevent data loss
On Mon, 26 Jul 2021 23:19:09 +0300, Nicholas Guriev wrote: >However in general, /tmp is not intended to have important data which >is worth regretting. Let alone that tmp could be mounted as tmpfs, see https://en.wikipedia.org/wiki/Tmpfs . However, even if it's not a tmpfs, a systemd unit might clean /tmp, for Ubuntu see https://askubuntu.com/questions/20783/how-is-the-tmp-directory-cleaned-up . Disabling or masking related systemd units should work. An example from my Arch Linux install. It's not mounted by fstab, but by a systemd unit. [rocketmouse@archlinux ~]$ df -h | grep tmpfs tmpfs 3.9G 31M 3.9G 1% /dev/shm tmpfs 3.9G 1.9M 3.9G 1% /tmp tmpfs 786M 104K 785M 1% /run/user/1000 [rocketmouse@archlinux ~]$ cat /etc/fstab | grep tmp #tmpfs /tmptmpfs nodev,nosuid,size=3G 0 0 [rocketmouse@archlinux ~]$ systemctl status tmp.mount ● tmp.mount - Temporary Directory /tmp Loaded: loaded (/proc/self/mountinfo; static) Active: active (mounted) since Sat 2021-07-03 21:09:58 CEST; 3 weeks 2 days ago Where: /tmp What: tmpfs Docs: https://systemd.io/TEMPORARY_DIRECTORIES man:file-hierarchy(7) https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems Tasks: 0 (limit: 9398) Memory: 32.0K CPU: 1ms CGroup: /system.slice/tmp.mount Jul 03 21:09:58 archlinux systemd[1]: Mounting Temporary Directory (/tmp)... Jul 03 21:09:58 archlinux systemd[1]: Mounted Temporary Directory (/tmp). [rocketmouse@archlinux ~]$ systemctl status systemd-tmpfiles-clean ○ systemd-tmpfiles-clean.service - Cleanup of Temporary Directories Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static) Active: inactive (dead) since Mon 2021-07-26 21:35:55 CEST; 1h 47min ago TriggeredBy: ● systemd-tmpfiles-clean.timer Docs: man:tmpfiles.d(5) man:systemd-tmpfiles(8) Process: 1018193 ExecStart=systemd-tmpfiles --clean (code=exited, status=0/SUCCESS) Main PID: 1018193 (code=exited, status=0/SUCCESS) CPU: 65ms Jul 26 21:35:55 archlinux systemd[1]: Starting Cleanup of Temporary Directories... Jul 26 21:35:55 archlinux systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully. Jul 26 21:35:55 archlinux systemd[1]: Finished Cleanup of Temporary Directories. [rocketmouse@archlinux ~]$ systemctl status systemd-tmpfiles-clean.timer ● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static) Active: active (waiting) since Sat 2021-07-03 21:09:58 CEST; 3 weeks 2 days ago Trigger: Tue 2021-07-27 21:35:55 CEST; 22h left Triggers: ● systemd-tmpfiles-clean.service Docs: man:tmpfiles.d(5) man:systemd-tmpfiles(8) Jul 03 21:09:58 archlinux systemd[1]: Started Daily Cleanup of Temporary Directories. [rocketmouse@archlinux ~]$ man systemctl | grep " mask UNIT" -A4 mask UNIT... Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care. This honors the --runtime option to only mask temporarily until the next reboot of the system. The --now option may be used to ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit file paths -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
Re: change "/tmp" deletion from the time of boot to the time of shutting down to prevent data loss
Hello! On Пн, 2021-07-12 at 00:33 +0300, Tamooz wrote: > I have personally encountered a potentially widespread problem with the > deletion of the "/tmp" folder at boot, as I can not recover > automatically saved files found in said folder after a system crash, > which may result in losing valuable data that has been created between > the time of the last manual save and the automatic saving of said files. > > My idea is to delete "/tmp" at the time of shutting down the machine > properly, as in that case they wouldn't be needed, or after a certain > amount of crashes occur without a successful shut-down, delete all data > from generated before previous crashes You can pass `init=/bin/bash` as kernel boot parameter through GRUB and then copy the temporary files to a safe place. And that way will work even if the computer was off normally. I once used this loophole myself to save files which I had forgotten. However in general, /tmp is not intended to have important data which is worth regretting. -- I am sending this message for the second time because of wrong author's address earlier. Sorry if you receive this message twice. signature.asc Description: This is a digitally signed message part -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
change "/tmp" deletion from the time of boot to the time of shutting down to prevent data loss
Greetings, I have personally encountered a potentially widespread problem with the deletion of the "/tmp" folder at boot, as I can not recover automatically saved files found in said folder after a system crash, which may result in losing valuable data that has been created between the time of the last manual save and the automatic saving of said files. My idea is to delete "/tmp" at the time of shutting down the machine properly, as in that case they wouldn't be needed, or after a certain amount of crashes occur without a successful shut-down, delete all data from generated before previous crashes Sincerely, Tamooz -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss