Why Symlink Doesn't Save after a Reboot Save Session? (solved)

Moderator: Forum moderators

Post Reply
JusGellin
Posts: 669
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 82 times
Been thanked: 79 times

Why Symlink Doesn't Save after a Reboot Save Session? (solved)

Post by JusGellin »

Why doesn't this symlink save when I save a session?
I made a test folder at:
/run/TEST

I made this symlink:
ln -s /run/TEST /var/run/TEST
The symlink shows up at /var/run/TEST

I clicked the save icon on the desktop.
I rebooted and saved again when asked.

But when it came back up there wasn't any symlink at /var/run/TEST.
What am I doing wrong?
Is there a correct way to do this?

Thanks

Last edited by bigpup on Wed Oct 09, 2024 10:17 pm, edited 1 time in total.
Reason: added solved to topic subject
JusGellin
Posts: 669
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 82 times
Been thanked: 79 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by JusGellin »

I did some testing with symlinks to see where I could make them and they would survive a reboot.
I could put a symlink in the main linux hierarch folders. They survived a reboot.
But again if I put a symlink at /var/run it wouldn't.
I could but one at /var/opt and it would survive.

The reason why I'm looking to /var/run for a symlink is because an install of virt-manager looks for there for an installed libvirt folder.
But when qemu is installed, it installs libvirt at /run instead.
So I thought I could just do a symilink from /run/libvirt to /var/run.
This works until I reboot with a save session and lose the symlink.

Why does this happen?
Is there another way to link the installed folder of /run/libvirt to /var/run?

Thanks

User avatar
mikewalsh
Moderator
Posts: 6207
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 805 times
Been thanked: 1998 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by mikewalsh »

@JusGellin :-

That's an easy one. /run is implemented as a temporary directory; processes only store their related run-time data there while they ARE running. At shut-down, or in the course of a re-boot, /run - and any sub-directories created within - disappear into cyberspace. *Poof!*

https://unix.stackexchange.com/question ... nd-var-run

What you need to do is to put a script together that makes sure the drive is definitely mounted at boot-time, along with then creating that directory. In the normal course of things, it wouldn't get created until any app that is written to use it actually calls for it.....and only then will it appear.

'Course, I could be talking out of my backside here. I've never really understood the functioning of, or reason behind the /var directory....

See? I'm not afraid to admit it; I don't "know it all"! :D

Mike. ;)

JusGellin
Posts: 669
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 82 times
Been thanked: 79 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by JusGellin »

I looked at a couple of other mainline linux systems.
They show /var has as a run symlink from /run

That is, it shows:

Code: Select all

ls -l /var/run
lrwxrwxrwx   1 root root     4 Sep 28  2023 run-> /run

But Puppy Linux shows this as its own folder.

Code: Select all

# ls -ld /var/run
drwxr-xr-x 1 root root 120 Oct  5 16:10 /var/run
JusGellin
Posts: 669
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 82 times
Been thanked: 79 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by JusGellin »

@mikewalsh
Didn't notice your response.
I'll look at that later.

User avatar
fredx181
Posts: 3132
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 380 times
Been thanked: 1333 times
Contact:

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by fredx181 »

JusGellin wrote: Wed Oct 09, 2024 3:58 pm

I did some testing with symlinks to see where I could make them and they would survive a reboot.
I could put a symlink in the main linux hierarch folders. They survived a reboot.
But again if I put a symlink at /var/run it wouldn't.
I could but one at /var/opt and it would survive.

The reason why I'm looking to /var/run for a symlink is because an install of virt-manager looks for there for an installed libvirt folder.
But when qemu is installed, it installs libvirt at /run instead.
So I thought I could just do a symilink from /run/libvirt to /var/run.
This works until I reboot with a save session and lose the symlink.

Why does this happen?
Is there another way to link the installed folder of /run/libvirt to /var/run?

Thanks

/var/run is a symlink to /run and edit: checked now on BookwormPup, it's a regular directory, anyway it's is created fresh (with required content) everytime you boot, it's not supposed to be saved in a savefile or savefolder.

Is there another way to link the installed folder of /run/libvirt to /var/run?

Didn't test but probably you can make an executable script in /root/Startup that creates the symlink in /var/run every time you boot.
edit: posted at around the same time as the other responses.
edit2: as williams2 suggested to put a line in /etc/rc.d/rc.local may be better.

williams2
Posts: 1065
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 306 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by williams2 »

In my BionicPup64, /run/ is a symlink to /tmp/
and /tmp/ is a symlink to a dir in the ram tmpfs.

Code: Select all

# 
# ll /run
lrwxrwxrwx 1 3 Feb 25  2019 /run -> tmp
# ll /tmp
lrwxrwxrwx 1 21 Oct  2 14:42 /tmp -> /initrd/mnt/tmpfs/tmp
#

In my Pup, /run/ and /tmp/ do not have persistence.
Everything in /run/ and /tmp/ disappear when Puppy shuts down.

Most Linux distros will delete everything in /run/ and /tmp/ and /var/run/
because programs use those spaces for lock files and socket files,
which need to be deleted before the system starts up.
Otherwise, the system and programs won't know whether they are running or not, or their pids, and other necessary info.

Is there another way to link the installed folder of /run/libvirt to /var/run?

Create the symlink everytime Puppy starts.
For example, put the line
ln -s /run/TEST /var/run/TEST
in /etc/rc.d/rc.local
to create the symlink each time Puppy starts.

JusGellin
Posts: 669
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 82 times
Been thanked: 79 times

Re: Why Symlink Doesn't Save after a Reboot Save Session?

Post by JusGellin »

williams2 wrote: Wed Oct 09, 2024 4:33 pm

Create the symlink everytime Puppy starts.
For example, put the line
ln -s /run/TEST /var/run/TEST
in /etc/rc.d/rc.local
to create the symlink each time Puppy starts.

That works great!! :thumbup:
This is another one for my toolkit.
There just is so much to learn about Linux so I can understand Puppy Linux better.

Thanks

Post Reply

Return to “BookwormPup”