Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unmounting at shut down, confusing situation ...

67 views
Skip to first unread message

MarioCPPP

unread,
Jun 19, 2023, 10:58:58 AM6/19/23
to

recently, in the 3D od moving home, symlink and bind mount,
a remark from Mr D. Hodgins (which I cannot find alas)
stated that, in some situations (binding or symlinking, I
cannot recall) the UNMOUNT could fail during shutdown.

Now, It has been a long time since I have been affected by
this error, which went unnoticed or not the just importance
had been given to it, until reading the remark.

Now two of my mounted devices fail during shut down, being
deferred and slowing down all (there is also a misterious
JAVA-WRAPPER which keeps running and slows it even more, but
this one another time).

let start with LSBLK cmd output


sda 8:0 0 111,8G 0 disk
├─sda1 8:1 0 64,1G 0 part [SWAP]
├─sda2 8:2 0 15,7G 0 part /Vbox_Shared
└─sda3 8:3 0 32G 0 part /Dati

sdb 8:16 0 3,6T 0 disk
└─sdb1 8:17 0 3,6T 0 part /home
/My

sdd 8:48 0 931,5G 0 disk
└─sdd1 8:49 0 931,5G 0 part /VBox_3

sde 8:64 1 0B 0 disk
(maybe this is the USB modem router)

sr0 11:0 1 1024M 0 rom

nvme0n1 259:0 0 953,9G 0 disk
├─nvme0n1p1 259:1 0 318G 0 part /VBox_1
├─nvme0n1p2 259:2 0 317,9G 0 part /
└─nvme0n1p3 259:3 0 318G 0 part /VBox_2


now you can see how both /home and /My are associated to the
large HDD (sdb1), same partition, but /home is actually a
SUBFOLDER in that partition, while My is its "relative" root
(the topmost folder).


My as such is symlinked under / (absolute ROOT)

in /home/user there is a symlink that points to /My (it
points "outwards" somewhat ... I don't understand how can
this work actually, I see infinitive recursion here, but
since this circular inclusion is not "active", the symlink
is static, maybe it is not as when one uses #include
directive circularly).

the File Manager tracks the browing in a really amusing way
!!! (it does not simplify full circles).
Here I paste the address bar after some circular browsing in
CAJA

/home/userX/My/home/userX/My/home/userX/My/home/userX/My/home/userX

and the circular browsing is possibly unlimited.

I have come up with sth evil I fear (even if it works).
But the shut down fails to unmount.
It fails for /tmp (which is mounted in RAM as tmpfs, so why
does it complain ?). /tmp is not symlinked anywhere and it
does not symlink anything. Mistery ! But it complaints.


The circularly nested situation of the system drive
(nvme0n1p2) which contain a symlink to /My/home/userX

and of drive sdb1 (/My), which is also BIND MOUNTED to
/home, is more complex


Since I have some programs scheduled to automatically run at
startup, is it there (and how) the possibility to run some
script ad shut-down ?

I mean, some script that could unmount sth in the right
order as to fasten the closing of all, gracefully, and avoid
error messages ?



Another thing : after DELETING the old /home content in
nvme0n1p2, the FREE SPACE of the drive is still reported as
before. Why ?
The current /home correctly reports 2,1 TB free space (since
now it is on sdb1, which is large), but It does not simply
HIDE the old content, the old content has been totally
erased with the system offline, in a LIVE DISTRO.
ALSO I tried to BYPASS THE RECYCLE BIN (holding shift), so
the space should actually have been freed up (I cannot empty
the bin now that the system is up).
What could have happened ?
The disk is seen "CLEAN" at boot ...



--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
MarioCPPP

David W. Hodgins

unread,
Jun 19, 2023, 3:04:40 PM6/19/23
to
On Mon, 19 Jun 2023 10:57:26 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:

>
> recently, in the 3D od moving home, symlink and bind mount,
> a remark from Mr D. Hodgins (which I cannot find alas)
> stated that, in some situations (binding or symlinking, I
> cannot recall) the UNMOUNT could fail during shutdown.

That comment was about bind mounts (or any mount with the directory used as
the mount point being in /home.

With a symlink, if it points to is a file or directory on a file system that
is not mounted, it becomes a broken symlink, until that file system is mounted
again. Attempts to access it will simply fail with file not found.

With mounts (of any type), the unmounting must be done in the right order.
A file system can not be unmounted while a directory in that file system
is in use as the mountpoint for another filesystem. That other file system
must be unmounted first.

In general, symlinks are simpler to deal with, but recursion must be avoided,
which is the problem you have described.

To debug the problem as it is currently, please install the package "tree"
if it isn't already installed. Then post the output of the following three
commands run as root ...
grep -e /dev/s -e /dev/n /proc/mounts
tree -ifal /home/|grep '>'
df

That should present the information needed in a format easier to debug.

Regards, Dave Hodgins

MarioCPPP

unread,
Jun 20, 2023, 4:12:02 AM6/20/23
to
On 19/06/23 21:04, David W. Hodgins wrote:
> On Mon, 19 Jun 2023 10:57:26 -0400, MarioCPPP
> <NoliMihiFran...@libero.it> wrote:
>
>>
>> recently, in the 3D od moving home, symlink and bind mount,
>> a remark from Mr D. Hodgins (which I cannot find alas)
>> stated that, in some situations (binding or symlinking, I
>> cannot recall) the UNMOUNT could fail during shutdown.
>
> That comment was about bind mounts (or any mount with the
> directory used as
> the mount point being in /home.
>
> With a symlink, if it points to is a file or directory on a
> file system that
> is not mounted, it becomes a broken symlink, until that file
> system is mounted
> again. Attempts to access it will simply fail with file not
> found.

strange .... for the problem is there (almost unnoticed)
from a long time ...

>
> With mounts (of any type), the unmounting must be done in
> the right order.
> A file system can not be unmounted while a directory in that
> file system
> is in use as the mountpoint for another filesystem. That
> other file system
> must be unmounted first.
>
> In general, symlinks are simpler to deal with, but recursion
> must be avoided,
> which is the problem you have described.
>
> To debug the problem as it is currently, please install the
> package "tree"
> if it isn't already installed. Then post the output of the
> following three
> commands run as root ...
> grep -e /dev/s -e /dev/n /proc/mounts

root@UserX:~# grep -e /dev/s -e /dev/n /proc/mounts
=========================================================
/dev/nvme0n1p2 / ext4
rw,noatime,nodiratime,errors=remount-ro 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,inode64 0 0

/dev/sdb3 /Dati ext4 rw,noatime,nodiratime 0 0

/dev/sdb2 /Vbox_Shared ext4 rw,noatime,nodiratime 0 0

/dev/nvme0n1p3 /VBox_2 ext4 rw,noatime,nodiratime 0 0

/dev/nvme0n1p1 /VBox_1 ext4 rw,noatime,nodiratime 0 0

/dev/sdc1 /VBox_3 ext4 rw,noatime,nodiratime 0 0

/dev/sda1 /My ext4 rw,relatime 0 0

/dev/sda1 /home ext4 rw,relatime 0 0

/dev/sde1 /media/UserX/MoviesFilms fuseblk
rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096
0 0
=========================================================




> tree -ifal /home/|grep '>'

this one gives some many tens of full screen
from time to time appears the advice RECURSIVE, NOT
FOLLOWED, like in this row

/home/UserX/.local/share/flatpak/runtime/org.gnome.Sdk/x86_64/3.38/bad32130d22256ab6bcf1bb572f084be423d49a0c356ecac3cee5db8c6ba1a4d/files/share/zoneinfo
-> zoneinfo [recursive, not followed]

but the output is huge

trying to use one single command
root@UserX:~# tree -ifal /home/|grep '>' df
says
grep: df: File or directory non existing
while df alone simply shows an empty line, as it is
expecting some input (i broke it with CTRL+C)


> df
>
> That should present the information needed in a format
> easier to debug.

dunno ... I maybe made a mistake splitting or merging the
commands :(

I tried to "MAN" df command, discovering the
--human-readable flag, then doing df -h said

File system Dim. Usati Dispon. Uso% Montato su
udev 32G 0 32G 0% /dev
tmpfs 6,3G 2,0M 6,3G 1% /run
/dev/nvme0n1p2 312G 210G 71G 75% /
tmpfs 32G 632K 32G 1% /dev/shm
tmpfs 5,0M 8,0K 5,0M 1% /run/lock
/dev/sdb3 32G 373M 30G 2% /Dati
/dev/sdb2 16G 24K 15G 1% /Vbox_Shared
tmpfs 9,5G 324K 9,5G 1% /tmp
/dev/nvme0n1p3 312G 237G 60G 80% /VBox_2
/dev/nvme0n1p1 312G 220G 77G 75% /VBox_1
/dev/sdc1 916G 862G 7,7G 100% /VBox_3
/dev/sda1 3,6T 1,6T 1,9T 45% /My
tmpfs 6,3G 176K 6,3G 1% /run/user/1000
/dev/loop0 96M 22K 91M 1% /var/spool/havp
/dev/sde1 3,7T 3,2T 466G 88% /media/UserX/MoviesFilms

As I have said before, I suspect there is a problem with the
FREE SPACE with partition of ROOR (/dev/nvme0n1p2) which
still reports 210G used even if I have deleted the former
/home in it (a large 105-110 GB) and now home is attached to
/dev/sda1 (a subfolder of /My ... strangely (or maybe not),
the BIND MOUNT of /home does not appear here

in FSTAB I added the row
/My/home /home none bind 0 0
AFTER /My is just mount point for device /dev/sda1

>
> Regards, Dave Hodgins

Tnx for all the help!
ciao

MarioCPPP

unread,
Jul 16, 2023, 7:36:55 AM7/16/23
to
On 19/06/23 16:57, MarioCPPP wrote:

Incidentally (serendipity) I have discovered the culprit of
the long delay at shut down (and possibly also the origin of
errors in unmounting /tmp and /Data partitions.

It is the FREENET service I used to load at startup (seeding
a node of such net).
Now I have disabled it (yet, it loads all the same, and I
still have to understand why).

Anyway, the process cannot be shut down by
xfce4-taskmanager, not in plain user mode and not even,
surprisingly, in ROOT MODE !
Trying to stop / kill this FREENET daemon nothing happens.
Luckily, the installer also placed a shutdown app in the
menu, that works : using it the service vanishes from the
task manager.
I did not know some process could be survive ROOT "orders".
Maybe it operates at a lowest runlevel ?

Dunno.
The fact is : once manually shut down, the system no longer
fails to unmount partitions nor delays the restart or power off.

Now I should understand how to get the closeup program
called on system shutdown, at very early stage.

Cron/Anacron might have some utilities in this or they are
simply TIME-based and never EVENT-based ?

Carlos E.R.

unread,
Jul 16, 2023, 8:12:29 AM7/16/23
to
On 2023-07-16 13:35, MarioCPPP wrote:
> On 19/06/23 16:57, MarioCPPP wrote:
>
> Incidentally (serendipity) I have discovered the culprit of the long
> delay at shut down (and possibly also the origin of errors in unmounting
> /tmp and /Data partitions.
>
> It is the FREENET service I used to load at startup (seeding a node of
> such net).
> Now I have disabled it (yet, it loads all the same, and I still have to
> understand why).
>
> Anyway, the process cannot be shut down by
> xfce4-taskmanager, not in plain user mode and not even, surprisingly, in
> ROOT MODE !
> Trying to stop / kill this FREENET daemon nothing happens.
> Luckily, the installer also placed a shutdown app in the menu, that
> works : using it the service vanishes from the task manager.
> I did not know some process could be survive ROOT "orders". Maybe it
> operates at a lowest runlevel ?

No, but if it is waiting on I/O, it can not be killed. Well, it can, but
it doesn't disappear.


> Dunno.
> The fact is : once manually shut down, the system no longer fails to
> unmount partitions nor delays the restart or power off.
>
> Now I should understand how to get the closeup program called on system
> shutdown, at very early stage.
>
> Cron/Anacron might have some utilities in this or they are simply
> TIME-based and never EVENT-based ?

Event based means using systemd.

On halt, the system you calls the clause for shutdown of the daemon.
Killing it is a last resource.

Example:
/etc/systemd/system/network.service:

ExecStart=/usr/sbin/wicked --systemd ifup all
ExecStop=/usr/sbin/wicked --systemd ifdown all
ExecReload=/usr/sbin/wicked --systemd ifreload all


With initd scripts, there is of course an equivalent method. Example:


/etc/init.d/nscd.rpmsave:

case "$1" in
start)
echo -n "Starting Name Service Cache Daemon"
/sbin/startproc -p $NSCD_PID $NSCD_BIN
rc_status -v
;;
stop)
echo -n "Shutting down Name Service Cache Daemon"
/sbin/killproc -p $NSCD_PID -TERM $NSCD_BIN
# if nscd does not run as root, it cannot remove this files:
rm -f /var/run/nscd/socket $NSCD_PID
rc_status -v
;;
try-restart|condrestart)
;;
...
restart)
;;
...

esac






--
Cheers, Carlos.

Chris Elvidge

unread,
Jul 16, 2023, 8:21:04 AM7/16/23
to
On 16/07/2023 12:35, MarioCPPP wrote:
> On 19/06/23 16:57, MarioCPPP wrote:
>
> Incidentally (serendipity) I have discovered the culprit of the long
> delay at shut down (and possibly also the origin of errors in unmounting
> /tmp and /Data partitions.
>
> It is the FREENET service I used to load at startup (seeding a node of
> such net).
> Now I have disabled it (yet, it loads all the same, and I still have to
> understand why).
>
> Anyway, the process cannot be shut down by
> xfce4-taskmanager, not in plain user mode and not even, surprisingly, in
> ROOT MODE !
> Trying to stop / kill this FREENET daemon nothing happens.
> Luckily, the installer also placed a shutdown app in the menu, that
> works : using it the service vanishes from the task manager.
> I did not know some process could be survive ROOT "orders". Maybe it
> operates at a lowest runlevel ?

A suggestion: Find out what the "shutdown app" actually runs and put
that in /etc/rc.local_shutdown (or /etc/rc.d/rc.local_shutdown,
depending on where rc.local actually is). Make sure rc.local_shutdown is
executable.


--

Chris Elvidge, England
NEXT TIME IT COULD BE ME ON THE SCAFFOLDING

David W. Hodgins

unread,
Jul 16, 2023, 1:06:35 PM7/16/23
to
On Sun, 16 Jul 2023 07:35:31 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:

> On 19/06/23 16:57, MarioCPPP wrote:
>
> Incidentally (serendipity) I have discovered the culprit of
> the long delay at shut down (and possibly also the origin of
> errors in unmounting /tmp and /Data partitions.
>
> It is the FREENET service I used to load at startup (seeding
> a node of such net).
> Now I have disabled it (yet, it loads all the same, and I
> still have to understand why).
>
> Anyway, the process cannot be shut down by
> xfce4-taskmanager, not in plain user mode and not even,
> surprisingly, in ROOT MODE !
> Trying to stop / kill this FREENET daemon nothing happens.
> Luckily, the installer also placed a shutdown app in the
> menu, that works : using it the service vanishes from the
> task manager.
> I did not know some process could be survive ROOT "orders".
> Maybe it operates at a lowest runlevel ?

When you kill a process, normally it sends signal 15, aka SIGTERM to the
process telling it to terminate. The process then closes files and exits,
or can just ignore the signal.

To force a process to exit, you can use signal 9, aka SIGKILL which tells
the kernel to end the process. The process does not get a chance to flush
it's buffers or do any other cleanup so files may end up corrupted.

If a process is stuck in a device wait, that means the process has called
the kernel to read/write something. As it's a call to the kernel that's stuck,
the only way to force it to end is to kill the kernel. I.E. Reboot or shutdown.

Looking at the code for freenet, it runs under docker. Part of the code is ...
pub fn as_router() -> (Self, Router) {
let contract_web_path = std::env::temp_dir().join("locutus").join("webs");
std::fs::create_dir_all(contract_web_path).unwrap();

As it has open files in the temporary directory (usually /tmp), the mount point
containing the temporary directory can not be unmounted until docker exits.

It's docker itself that you would have to terminate or kill.

Regards, Dave Hodgins

MarioCPPP

unread,
Jul 16, 2023, 3:13:00 PM7/16/23
to
On 16/07/23 14:11, Carlos E.R. wrote:
> On 2023-07-16 13:35, MarioCPPP wrote:
>> On 19/06/23 16:57, MarioCPPP wrote:
>>
>> Incidentally (serendipity) I have discovered the culprit
>> of the long delay at shut down (and possibly also the
>> origin of errors in unmounting /tmp and /Data partitions.
>>
>> It is the FREENET service I used to load at startup
>> (seeding a node of such net).
>> Now I have disabled it (yet, it loads all the same, and I
>> still have to understand why).
>>
>> Anyway, the process cannot be shut down by
>> xfce4-taskmanager, not in plain user mode and not even,
>> surprisingly, in ROOT MODE !
>> Trying to stop / kill this FREENET daemon nothing happens.
>> Luckily, the installer also placed a shutdown app in the
>> menu, that works : using it the service vanishes from the
>> task manager.
>> I did not know some process could be survive ROOT
>> "orders". Maybe it operates at a lowest runlevel ?
>
> No, but if it is waiting on I/O, it can not be killed. Well,
> it can, but it doesn't disappear.
>

ah, intresting, but strange indeed. I mean, it's not a file
system operation, it is some network async operation that is
not blocking (in fact, when I loss connection, and it
happens annoyingly often, nothing happens. If I was
downloading a file, in a browser, the system shuts down
without an hexitation, and lets the download broken).
The strante is this daemon escalates so high privileges to
make its operations so prioritized

>
>> Dunno.
>> The fact is : once manually shut down, the system no
>> longer fails to unmount partitions nor delays the restart
>> or power off.
>>
>> Now I should understand how to get the closeup program
>> called on system shutdown, at very early stage.
>>
>> Cron/Anacron might have some utilities in this or they are
>> simply TIME-based and never EVENT-based ?
>
> Event based means using systemd.

ah, intresting ! One point for SystemD so

>
> On halt, the system you calls the clause for shutdown of the
> daemon. Killing it is a last resource.
>
> Example:
> /etc/systemd/system/network.service:
>
> ExecStart=/usr/sbin/wicked --systemd ifup all
> ExecStop=/usr/sbin/wicked --systemd ifdown all
> ExecReload=/usr/sbin/wicked --systemd ifreload all
>

do you think that such commands would work equally well for
a network protocol completely different and maybe
transparent (this FREENET does not use any popular protocol,
but like TOR and i2p its own. Maybe the system does not know
how to manage it ?

Just for talking, I don't know network management ...

>
> With initd scripts, there is of course an equivalent method.
> Example:
>
>
> /etc/init.d/nscd.rpmsave:
>
> case "$1" in
>     start)
>         echo -n "Starting Name Service Cache Daemon"
>         /sbin/startproc -p $NSCD_PID $NSCD_BIN
>         rc_status -v
>         ;;
>     stop)
>         echo -n "Shutting down Name Service Cache Daemon"
>         /sbin/killproc -p $NSCD_PID -TERM $NSCD_BIN
>         # if nscd does not run as root, it cannot remove
> this files:
>         rm -f /var/run/nscd/socket $NSCD_PID
>         rc_status -v
>         ;;
>     try-restart|condrestart)
>     ;;
> ...
>     restart)
>     ;;
> ...
>
> esac
>
>
>
>
>
>

--

Carlos E.R.

unread,
Jul 16, 2023, 4:08:28 PM7/16/23
to
On 2023-07-16 21:11, MarioCPPP wrote:
> On 16/07/23 14:11, Carlos E.R. wrote:
>> On 2023-07-16 13:35, MarioCPPP wrote:
>>> On 19/06/23 16:57, MarioCPPP wrote:
>>>
>>> Incidentally (serendipity) I have discovered the culprit of the long
>>> delay at shut down (and possibly also the origin of errors in
>>> unmounting /tmp and /Data partitions.
>>>
>>> It is the FREENET service I used to load at startup (seeding a node
>>> of such net).
>>> Now I have disabled it (yet, it loads all the same, and I still have
>>> to understand why).


...

>>> Cron/Anacron might have some utilities in this or they are simply
>>> TIME-based and never EVENT-based ?
>>
>> Event based means using systemd.
>
> ah, intresting ! One point for SystemD so
>
>>
>> On halt, the system you calls the clause for shutdown of the daemon.
>> Killing it is a last resource.
>>
>> Example:
>> /etc/systemd/system/network.service:
>>
>> ExecStart=/usr/sbin/wicked --systemd ifup all
>> ExecStop=/usr/sbin/wicked --systemd ifdown all
>> ExecReload=/usr/sbin/wicked --systemd ifreload all
>>
>
> do you think that such commands would work equally well for a network
> protocol completely different and maybe transparent (this FREENET does
> not use any popular protocol, but like TOR and i2p its own. Maybe the
> system does not know how to manage it ?

Those config entries are normal systemd syntax. If you start and stop
your tool via a systemd service file (either global or for your user),
then you just need to have:

ExecStart=... whatever
ExecStop=...whatever

with the appropriate commands for starting and stopping your daemon.

You will also have to add entries to "start/stop before" whatever. Just
pick an existing service file that seems similar and use it as an example.

>
> Just for talking, I don't know network management ...

It is not about network management, it is about systemd. I just picked
the "wicked" service file as an example.



--
Cheers, Carlos.

MarioCPPP

unread,
Jul 16, 2023, 6:53:07 PM7/16/23
to
I have not tried from cmdline, but from taskmanager I tried
to send all signals available there (
FERMA, TERMINA, INTERROMPI in italian translation, which I
tentatively translate as STOP, TERMINATE, PAUSE). Maybe none
of this is SigKill.
Also the CANC key sends "sth" (dunno what), maybe Terminate.

But the clean way is to invoke its own shutdown routine.

It seems to rely on JAVA. Now I don't know Docker ... is it
based on Java runtime ?

>
> If a process is stuck in a device wait, that means the
> process has called
> the kernel to read/write something. As it's a call to the
> kernel that's stuck,
> the only way to force it to end is to kill the kernel. I.E.
> Reboot or shutdown.
>
> Looking at the code for freenet, it runs under docker. Part
> of the code is ...
>     pub fn as_router() -> (Self, Router) {
>         let contract_web_path =
> std::env::temp_dir().join("locutus").join("webs");
>         std::fs::create_dir_all(contract_web_path).unwrap();
>

don't know this language, particularly the notation fn
name() -> .... that recalls me of arrow functions in JS, is
it Java ?

> As it has open files in the temporary directory (usually
> /tmp), the mount point
> containing the temporary directory can not be unmounted
> until docker exits.

yes, in fact /tmp gave error. Also the data drive gave
error, cause I was "seeding", that is reserving some
persistent storage (my /tmp is not persistent, it's part of
ram actually).

>
> It's docker itself that you would have to terminate or kill.

I did not notice this name. I noticed Linux-Wrapper-X (maybe
it's a Docker app, or it is a Java app : one of the delaying
processed was mentioned as sth-java, but always belonging to
FREENET, since shutting down it, everything disappeared and
shut down returned really fast).

TNX for all informations

>
> Regards, Dave Hodgins

MarioCPPP

unread,
Jul 16, 2023, 6:53:32 PM7/16/23
to
On 16/07/23 14:20, Chris Elvidge wrote:
> On 16/07/2023 12:35, MarioCPPP wrote:
>> On 19/06/23 16:57, MarioCPPP wrote:
>>
>> Incidentally (serendipity) I have discovered the culprit
>> of the long delay at shut down (and possibly also the
>> origin of errors in unmounting /tmp and /Data partitions.
>>
>> It is the FREENET service I used to load at startup
>> (seeding a node of such net).
>> Now I have disabled it (yet, it loads all the same, and I
>> still have to understand why).
>>
>> Anyway, the process cannot be shut down by
>> xfce4-taskmanager, not in plain user mode and not even,
>> surprisingly, in ROOT MODE !
>> Trying to stop / kill this FREENET daemon nothing happens.
>> Luckily, the installer also placed a shutdown app in the
>> menu, that works : using it the service vanishes from the
>> task manager.
>> I did not know some process could be survive ROOT
>> "orders". Maybe it operates at a lowest runlevel ?
>
> A suggestion: Find out what the "shutdown app" actually runs

I don't even know what shutdown app really is, neither where
it is called nor when.

> and put that in /etc/rc.local_shutdown (or
> /etc/rc.d/rc.local_shutdown, depending on where rc.local
> actually is). Make sure rc.local_shutdown is executable.

I must be lacking a lot of prerequisites, as I did not
understand most of the above. Sorry :/ :/

Carlos E.R.

unread,
Jul 16, 2023, 8:49:05 PM7/16/23
to
On 2023-07-17 00:53, MarioCPPP wrote:
> On 16/07/23 14:20, Chris Elvidge wrote:
>> On 16/07/2023 12:35, MarioCPPP wrote:
>>> On 19/06/23 16:57, MarioCPPP wrote:
>>>
>>> Incidentally (serendipity) I have discovered the culprit of the long
>>> delay at shut down (and possibly also the origin of errors in
>>> unmounting /tmp and /Data partitions.
>>>
>>> It is the FREENET service I used to load at startup (seeding a node
>>> of such net).
>>> Now I have disabled it (yet, it loads all the same, and I still have
>>> to understand why).
>>>
>>> Anyway, the process cannot be shut down by
>>> xfce4-taskmanager, not in plain user mode and not even, surprisingly,
>>> in ROOT MODE !
>>> Trying to stop / kill this FREENET daemon nothing happens.
>>> Luckily, the installer also placed a shutdown app in the menu, that
>>> works : using it the service vanishes from the task manager.
>>> I did not know some process could be survive ROOT "orders". Maybe it
>>> operates at a lowest runlevel ?
>>
>> A suggestion: Find out what the "shutdown app" actually runs
>
> I don't even know what shutdown app really is, neither where it is
> called nor when.

Yes, you do. You said:

«Luckily, the installer also placed a shutdown app in the menu, that
works : using it the service vanishes from the task manager.»

That's the one.

>
>> and put that in /etc/rc.local_shutdown (or
>> /etc/rc.d/rc.local_shutdown, depending on where rc.local actually is).
>> Make sure rc.local_shutdown is executable.
>
> I must be lacking a lot of prerequisites, as I did not understand most
> of the above. Sorry :/ :/

A menu entry or an icon runs something. Just find out what. They are
text files. Right click on the entry, choose properties.

--
Cheers, Carlos.

David W. Hodgins

unread,
Jul 16, 2023, 10:39:15 PM7/16/23
to
On Sun, 16 Jul 2023 18:51:35 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:
> It seems to rely on JAVA. Now I don't know Docker ... is it
> based on Java runtime ?

No. See https://en.wikipedia.org/wiki/Docker_(software)

For freenet, I assume it's https://freenet.org/about which uses a docker
container with the application written the language called rust.

https://www.rust-lang.org/

> yes, in fact /tmp gave error. Also the data drive gave
> error, cause I was "seeding", that is reserving some
> persistent storage (my /tmp is not persistent, it's part of
> ram actually).

/tmp can be an on disk file system or tmpfs file system in ram. Either way,
it's still a file system that gets mounted.

Regards, Dave Hodgins

MarioCPPP

unread,
Jul 17, 2023, 7:00:08 AM7/17/23
to
but that's a launcher to be used MANUALLY


the launcher points to :
/home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop

where do I have to add this command to have it executed
early during shutdown process ?

How to pass it to SystemD ?

>
>>
>>> and put that in /etc/rc.local_shutdown (or
>>> /etc/rc.d/rc.local_shutdown, depending on where rc.local
>>> actually is). Make sure rc.local_shutdown is executable.
I have no such folder, just
rc0.d ... rc6.d and one rcS.d folders, under /etc/

Searching local.shutdown

scanning all /etc/ with RegEx I cant find anything
resembling rc.local_shutdown alas :(


>>
>> I must be lacking a lot of prerequisites, as I did not
>> understand most of the above. Sorry :/ :/
>
> A menu entry or an icon runs something. Just find out what.
> They are text files. Right click on the entry, choose
> properties.

yes, but menu entries aren't "event-driven", but manual. I
dunno how to turn a manually run stuff into an executed upon
event one

MarioCPPP

unread,
Jul 17, 2023, 7:35:20 AM7/17/23
to
On 17/07/23 04:39, David W. Hodgins wrote:
> On Sun, 16 Jul 2023 18:51:35 -0400, MarioCPPP
> <NoliMihiFran...@libero.it> wrote:
>> It seems to rely on JAVA. Now I don't know Docker ... is it
>> based on Java runtime ?
>
> No. See https://en.wikipedia.org/wiki/Docker_(software)
>
> For freenet, I assume it's https://freenet.org/about which
> uses a docker
> container with the application written the language called
> rust.
>
> https://www.rust-lang.org/

I scanned the disk to discover the seeding cache and the
executables

I paste the result of TREE cmd at the folder found

.
├── bcprov-jdk15on-1.59.jar
├── bin
│   ├── bindtest.jar
│   ├── browser.jar
│   ├── browse.sh
│   ├── remove_cronjob.sh
│   ├── sha1test.jar
│   ├── uncompress.jar
│   ├── wrapper-linux-armel-32
│   ├── wrapper-linux-armhf-32
│   ├── wrapper-linux-ia64-64
│   ├── wrapper-linux-ppc-32
│   ├── wrapper-linux-ppc-64
│   ├── wrapper-linux-x86-32
│   ├── wrapper-linux-x86-64
│   └── wrapper.log
├── bookmarks.dat
├── bootID
├── Browse-Freenet-1655918507533.desktop
├── client.dat.bak.crypt
├── client.dat.crypt
├── client-throttle.dat
├── completed.list.downloads
├── completed.list.uploads
├── datastore
│   ├── CHK-cache.config
│   ├── CHK-cache.hd
│   ├── CHK-cache.metadata
│   ├── CHK-cache.slotfilter
│   ├── CHK-clientcache.config
│   ├── CHK-clientcache.hd
│   ├── CHK-clientcache.metadata
│   ├── CHK-clientcache.slotfilter
│   ├── CHK-store.config
│   ├── CHK-store.hd
│   ├── CHK-store.metadata
│   ├── CHK-store.slotfilter
│   ├── PUBKEY-cache.config
│   ├── PUBKEY-cache.hd
│   ├── PUBKEY-cache.metadata
│   ├── PUBKEY-cache.slotfilter
│   ├── PUBKEY-clientcache.config
│   ├── PUBKEY-clientcache.hd
│   ├── PUBKEY-clientcache.metadata
│   ├── PUBKEY-clientcache.slotfilter
│   ├── PUBKEY-store.config
│   ├── PUBKEY-store.hd
│   ├── PUBKEY-store.metadata
│   ├── PUBKEY-store.slotfilter
│   ├── SSK-cache.config
│   ├── SSK-cache.hd
│   ├── SSK-cache.metadata
│   ├── SSK-cache.slotfilter
│   ├── SSK-clientcache.config
│   ├── SSK-clientcache.hd
│   ├── SSK-clientcache.metadata
│   ├── SSK-clientcache.slotfilter
│   ├── SSK-store.config
│   ├── SSK-store.hd
│   ├── SSK-store.metadata
│   └── SSK-store.slotfilter
├── downloads
│   └──
flip-linux-amd64-bin-0.3.1.tar.gz5055593561891797652.freenet-tmp
├── extra-peer-data-14677
├── freenet-ext.jar
├── freenet.ico
├── freenet.ini
├── freenet.jar
├── freenet.jar.new
├── freenet-latest-installer-nonwindows.jar
├── freenet-latest-installer-windows.exe
├── freenet-stable-latest.jar
├── IpToCountry.dat
├── IzPackLocaleEnabledXdgDesktopIconScript.sh
├── jna-4.5.2.jar
├── jna-4.5.2.jar4209881716369391134.updater.tmp
├── jna-platform-4.5.2.jar
├── jna-platform-4.5.2.jar9778121626343741346.updater.tmp
├── lib
│   ├── libwrapper-linux-armel-32.so
│   ├── libwrapper-linux-armhf-32.so
│   ├── libwrapper-linux-ia64-64.so
│   ├── libwrapper-linux-ppc-32.so
│   ├── libwrapper-linux-ppc-64.so
│   ├── libwrapper-linux-x86-32.so
│   └── libwrapper-linux-x86-64.so
├── LICENSE.Freenet
├── LICENSE.Mantissa
├── logs
│   ├── freenet-1497-2023-07-14-20.log.gz
│   ├── freenet-1497-2023-07-14-21.log.gz
│   ├── freenet-1497-2023-07-14-22.log.gz
│   ├── freenet-1497-2023-07-14-23.log.gz
│   ├── freenet-1497-2023-07-15-00.log.gz
│   ├── freenet-1497-2023-07-15-01.log.gz
│   ├── freenet-1497-2023-07-15-02.log.gz
│   ├── freenet-1497-2023-07-15-03.log.gz
│   ├── freenet-1497-2023-07-15-04.log.gz
│   ├── freenet-1497-2023-07-15-05.log.gz
│   ├── freenet-1497-2023-07-15-06.log.gz
│   ├── freenet-1497-2023-07-15-07.log.gz
│   ├── freenet-1497-2023-07-15-08.log.gz
│   ├── freenet-1497-2023-07-15-09.log.gz
│   ├── freenet-1497-2023-07-15-10.log.gz
│   ├── freenet-1497-2023-07-15-11.log.gz
│   ├── freenet-1497-2023-07-15-12.log.gz
│   ├── freenet-1497-2023-07-15-13.log.gz
│   ├── freenet-1497-2023-07-15-14.log.gz
│   ├── freenet-1497-2023-07-15-15.log.gz
│   ├── freenet-1497-2023-07-15-16.log.gz
│   ├── freenet-1497-2023-07-15-17.log.gz
│   ├── freenet-1497-2023-07-15-22.log.gz
│   ├── freenet-latest.log
│   └── freenet-previous.log
├── master.keys
├── memory.autolimit
├── node-14677
├── node-throttle.dat
├── offline
├── opennet-59431
├── openpeers-59431
├── openpeers-59431.bak
├── openpeers-old-59431
├── openpeers-old-59431.bak
├── packets-14677.dat
├── packets-59431.dat
├── pebble-3.1.5.jar
├── pebble-3.1.5.jar18278901836451014976.updater.tmp
├── peers-14677
├── persistent-temp
│   ├── legacy-freenet-jar-1481.fblob
│   ├──
legacy-freenet-jar-1481.fblob102242510824075000.updater.fblob.tmp15127590578761804748.freenet-tmp
│   ├──
main-jar-1493-7408725299069490750.fblob.tmp11873849515888056812.freenet-tmp
│   ├── main-jar-1493.fblob
│   ├── main-jar-1494.fblob
│   ├── main-jar-1495.fblob
│   ├── main-jar-1496.fblob
│   └── main-jar-1497.fblob
├── plugin-data
│   ├── plugins.Library.Main.data.bak.crypt
│   └── plugins.Library.Main.data.crypt
├── plugins
│   ├── JSTUN.jar
│   ├── KeyUtils.jar
│   ├── Library.jar
│   ├── Sharesite.jar
│   ├── ThawIndexBrowser.jar
│   └── UPnP.jar
├── prng.seed
├── README
├── run.sh
├── seednodes.fref
├── sha1test.jar
├── slf4j-api-1.7.25.jar
├── slf4j-api-1.7.25.jar9692460383893678503.updater.tmp
├── startssl.pem
├── temp
│   └── temp-b49601a002472cd5
├── The-Freenet-Project-Website-1655918507538.desktop
├── tmp
│   └── jna--403337722
├── unbescape-1.1.6.RELEASE.jar
├── unbescape-1.1.6.RELEASE.jar3558948160463069835.updater.tmp
├── Uninstaller
│   ├── install.log
│   ├── show_uninstall_survey.sh
│   └── uninstaller.jar
├── update.sh
├── uptime.dat
├── uptime.old.dat
├── wrapper.conf
├── wrapper.conf.old
├── wrapper_Darwin.zip
├── wrapper_Darwin.zip.sha1
├── wrapper.jar
├── wrapper_Linux.zip
├── wrapper_Linux.zip.sha1
├── wrapper.log
├── wrapper.log.1
├── wrapper.log.2
└── wrapper.log.3


14 directories, 168 files

maybe it's rust, but perhaps for this particular install, it
actually seems sth JAVA (it's full of JAR packages).
Also appears that "wrapper-linux" that was reported blocking
the shut down

>
>> yes, in fact /tmp gave error. Also the data drive gave
>> error, cause I was "seeding", that is reserving some
>> persistent storage (my /tmp is not persistent, it's part of
>> ram actually).
>
> /tmp can be an on disk file system or tmpfs file system in
> ram. Either way,
> it's still a file system that gets mounted.

yes. Anyway there are also 10 GB of permanent storage on the
other partition that gave problem to be unmounted (it was
almost exactly the amount I had set up for seeding).
Anyway this story is curious because it was not only the
annoying delay of shut down that kept me inquiring, but the
fact that the (MECHANICAL) disk was forever active and
muttering and since it is a disk full of invaluable data,
that continuous activity started to make me nervous.
I have 64 GB of physical RAM and 64 GB of swap partition,
I'd have expected some better caching than that.
So actually I started to chase the culprit, stopping
processes to see which used the disk so much.
In the TASK MANAGER (at least xfce4 version) there are a lot
of columns, but none dedicated to DISK I/O, and the CPU
usage was not so high, so I strieved to locate this freenet
as the responsible of disk heavy use. Also some 3 K log
files were there (I deleted all but the past day manually,
to keep this extract human-readable).

Tnx
Ciao

J.O. Aho

unread,
Jul 17, 2023, 7:44:32 AM7/17/23
to
On 7/17/23 12:58, MarioCPPP wrote:

> the launcher points to :
> /home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop
>
> where do I have to add this command to have it executed early during
> shutdown process ?

I would suggest a custom systemd unit to handle starting and stopping
the service
a starting point would be reading:
http://tuxgraphics.org/npa/systemd-scripts/

I would suggest you let systemd to handle the starting and stopping the
service, just see to that it depends on network, then it's started after
the network is up and stopped before the network is down, this would
allow you to use network based file systems too (if it would be needed
for some strange reason in the future).

> How to pass it to SystemD ?

No one knows, as there ain't a such thing.
https://freedesktop.org/wiki/Software/systemd/

--
//Aho

Carlos E.R.

unread,
Jul 17, 2023, 9:10:40 AM7/17/23
to
Fine :-)

>
>
> the launcher points to :
> /home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop
>
> where do I have to add this command to have it executed early during
> shutdown process ?
>
> How to pass it to SystemD ?


You have to write up a service file, probably named "FreeNet.service"
that among many other things, contains:

ExecStop=/home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop



It is possible that such a file already exists in the FreeNet package
somewhere.


--
Cheers, Carlos.

David W. Hodgins

unread,
Jul 17, 2023, 3:06:34 PM7/17/23
to
On Mon, 17 Jul 2023 07:33:54 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:
> I paste the result of TREE cmd at the folder found

Snip. That is a java implementation of freenet, which appears to be from
https://sourceforge.net/projects/freenet/

I was looking at https://freenet.org/ which is a rust implementation of
the same thing that runs under docker.

Regards, Dave Hodgins

David W. Hodgins

unread,
Jul 18, 2023, 1:43:53 AM7/18/23
to
On Mon, 17 Jul 2023 06:58:47 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:
> but that's a launcher to be used MANUALLY
> the launcher points to :
> /home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop
> where do I have to add this command to have it executed
> early during shutdown process ?
> How to pass it to SystemD ?

Finally got around to figuring out how to do this. :-)

As root, create a service that will run at shutdown or reboot, just before
the network stops.

# cat /etc/systemd/system/reboot-or-shutdown.service
[Unit]
Description=My service to do things at reboot or shutdown time
After=network.target
Before=systemd-reboot.service shutdown.target

[Service]
Type=oneshot
ExecStart=/usr/bin/true
ExecStop=/root/somescript
RemainAfterExit=yes

[Install]
WantedBy=sysinit.target

Create the script. I used /root/somescript as the file name. After creating
the script file don't forget to "chmod a+x /root/somescript". To test this I
used ...
# cat /root/somescript
#!/bin/bash
/usr/bin/printf "$0 executed yyyyyyyyyyyyyyyyyyy"

Note that the script runs as root and the output goes to the journal.
I added the part of the string with the letter y repeated to make it easy
to find when checking the journal output to confirm it ran just before
stopping the network.

Instead of the above, in your script put
#!/bin/bash
su -l UtenteXXX -c '/home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop'

Also, instead of using /root/somescript, it would be better to use something
like /usr/local/sbin/stopFreeNet as the file name for the script and in the
ExecStop line of the service.

Once you've created it run
# systemctl daemon-reload
# systemctl enable reboot-or-shutdown.service

Regards, Dave Hodgins

MarioCPPP

unread,
Jul 18, 2023, 8:27:55 AM7/18/23
to
On 18/07/23 07:43, David W. Hodgins wrote:
> On Mon, 17 Jul 2023 06:58:47 -0400, MarioCPPP
> <NoliMihiFran...@libero.it> wrote:
>> but that's a launcher to be used MANUALLY
>> the launcher points to :
>> /home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop
>> where do I have to add this command to have it executed
>> early during shutdown process ?
>> How to pass it to SystemD ?
>
> Finally got around to figuring out how to do this. :-)
>
> As root, create a service that will run at shutdown or
> reboot, just before
> the network stops.
>
> # cat /etc/systemd/system/reboot-or-shutdown.service


file or directory does not exist :(
OK, i'll look for sth similar under the path

Carlos E.R.

unread,
Jul 18, 2023, 8:43:39 AM7/18/23
to
On 2023-07-18 14:27, MarioCPPP wrote:
> On 18/07/23 07:43, David W. Hodgins wrote:
>> On Mon, 17 Jul 2023 06:58:47 -0400, MarioCPPP

>> Finally got around to figuring out how to do this. :-)
>>
>> As root, create a service that will run at shutdown or reboot, just
............*******

>> before
>> the network stops.
>>
>> # cat /etc/systemd/system/reboot-or-shutdown.service
>
>
> file or directory does not exist :(
> OK, i'll look for sth similar under the path

Which is the same I told you. *You* create the service file with several
lines, and one is:

ExecStop=/home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop

--
Cheers, Carlos.

Bit Twister

unread,
Jul 18, 2023, 11:58:30 AM7/18/23
to
On Tue, 18 Jul 2023 14:27:52 +0200, MarioCPPP wrote:
> On 18/07/23 07:43, David W. Hodgins wrote:
> As root, create a service that will run at shutdown or
>> reboot, just before
>> the network stops.
>>
>> # cat /etc/systemd/system/reboot-or-shutdown.service
>
>
> file or directory does not exist :(
> OK, i'll look for sth similar under the path

I would recommend using the "locate" command or "find" command.

Might not hurt to use the "man" command once in a while. For example:
man -k systemd

For systemd unit files I suggest something like
man systemd.unit
where the SEE ALSO" section might suggest "systemd.service"

It would not hurt for you to always provide distribution, release, and
Desktop Environment and kernel being used. I suggest in a .signature file
so you automagically show it in all posts.

For example:
Running Mageia release 7 (Official) for x86_64 using
Kernel 5.5.15-desktop-3.mga7 on x86_64 DM=lightdm DE=xfce

That kind of information can help any subject matter expert to provide
you with more exacting/informative response.

Personally I suggest running a script during login to build the file
so it is current as to kernel and whatnot.


David W. Hodgins

unread,
Jul 18, 2023, 1:47:01 PM7/18/23
to
I haven't checked to confirm it's needed, but I expect it most likely should
be run by the same user that started it, which is why I suggested using su -l.

Regards, Dave Hodgins

David W. Hodgins

unread,
Jul 18, 2023, 1:47:03 PM7/18/23
to
On Tue, 18 Jul 2023 08:27:52 -0400, MarioCPPP <NoliMihiFran...@libero.it> wrote:

> On 18/07/23 07:43, David W. Hodgins wrote:
>> On Mon, 17 Jul 2023 06:58:47 -0400, MarioCPPP
>> <NoliMihiFran...@libero.it> wrote:
>>> but that's a launcher to be used MANUALLY
>>> the launcher points to :
>>> /home/UtenteXXX/My/My/Scaricati/FreeNet/run.sh stop
>>> where do I have to add this command to have it executed
>>> early during shutdown process ?
>>> How to pass it to SystemD ?
>>
>> Finally got around to figuring out how to do this. :-)
>>
>> As root, create a service that will run at shutdown or
>> reboot, just before
>> the network stops.
>>
>> # cat /etc/systemd/system/reboot-or-shutdown.service
>
>
> file or directory does not exist :(
> OK, i'll look for sth similar under the path

That's the file I created for testing to ensure it works.
Create the file on your system.

Carlos E.R.

unread,
Jul 18, 2023, 3:04:29 PM7/18/23
to
systemd has its own method to use users.


[Service]
User=deepak
Group=admin
ExecStart=/opt/golinuxcloud/startup_script.sh


https://www.golinuxcloud.com/run-systemd-service-specific-user-group-linux/


--
Cheers, Carlos.

0 new messages