ExtraHD bug - can't remove mount point

I’ll double check

First check shows,

  • mount / unmount is done by extrahd.pl
  • the internal files aren’t fully updated by umount operation
  • ‘mount’ establishes the link to the mounted device, but ‘umount’ doesn’t delete
  • mounting of the new hd is done by mount -a; if the filesystem isn’t supported the mount fails, but the fail isn’t handled by extrahd.pl

Succeeded to mount my NTFS stick by hand ( mount UUID=xxx /mnt/harddisk -t ntfs-3g ).
Unmount with the WebGui was not successful. :wink:

New try:
mounting with the right ( :wink: ) file system. Device is mounted without problems.
Unmounting fails. ( /var/ipfire/extrahd/fstab doesn’t reflect the state of /etc/fstab after mount )

After getting “Error messages - Can’t umount /mnt/ssd. Maybe the device is in use?”

The external drive I am trying to mount/umount is /dev/sdb1:

[root@ipfire ~] # blkid -o list
device            fs_type  label     mount point           UUID
------------------------------------------------------------------
/dev/sdb1         ext4     ipfireBU  (not mounted)         x-80f
/dev/sda4         ext4               /                     x-106
/dev/sda3         swap               [SWAP]                x-15f
/dev/sda1         ext4               /boot                 x-2a5
[root@ipfire ~] # 

Nothing found with lsof:

[root@ipfire ~] # lsof | grep sdb
[root@ipfire ~] # 

So I am fairly sure there is no process holding it in place.

1 Like

Some trials later.

There is a problem in the ‘unmount’ functionality in extrahd.pl and extrahd.cgi.
The successful unmount ( in the system ) isn’t handled the right way. The state in /var/ipfire/extrahd isn’t updated.
Maybe I’ll find out more tomorrow.

2 Likes

Success!!

In extrahd.cgi, delete section, extrahdctrl umount <path> is called.
extrahd.pl behaves like a normal program, success return 0. But extrahd.cgi interprets this error.
Changing the line

     if ( General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {

to

     if ( !General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {

does resolve the problem.

One little problem remains in the mount section. If the mounting doesn’t succeed, the status files in /var/ipfire/extrahd aren’t not consistent. Found by trying to mount a NTFS partition with ‘auto’.
The partition is marked red ( not mounted ), what is right. Didn’t check yet, whether it can be deleted with the modifications above.
`

3 Likes

The change to using the new perl system functions was made in CU159 so that command has been there since that time.

Prior to that the command was

if ( /usr/local/bin/extrahdctrl umount $extrahdsettings{'PATH'} ) {

I don’t know enough about the commands to know if that change could have caused the effect but it has been present for quite a long time.

The prior change to extrahd.cgi was in CU114 so hopefully it was the change to the new perl system functions.

extrahdctrl was last changed in CU154 where a new run() command was added to all of the misc-progs in IPFire.

2 Likes

Maybe the problem was there for a longer time, yet.
To be honest, I didn’t use ExtraHD for some time. Don’t know when my last nano stick went defective ;).

So I take the chance to review this sources.

2 Likes

Nicely done!

:+1:

Thx, never mind.


For what it is worth - I believe you are on the right track!

To me the problem seems to be in the /usr/local/bin/extrahdctrl C program. It doesn’t seem to be returning any error codes.

I did this to prove my theory:

[root@ipfireAPU ~] # cat /var/ipfire/extrahd/bin/extrahd.pl
#!/usr/bin/perl

exit(5);

[root@ipfireAPU ~] # /var/ipfire/extrahd/bin/extrahd.pl
[root@ipfireAPU ~] # echo $?
5

[root@ipfireAPU ~] # /usr/local/bin/extrahdctrl umount /mnt/harddisk
[root@ipfireAPU ~] # echo $?
0

[root@ipfireAPU ~] # 

So no matter what extrahdctrl always returns a “zero”.

The BIG problem is I don’t know C. It’s been 30 years since I tried anything C like…

So maybe instead of:

return run("/var/ipfire/extrahd/bin/extrahd.pl", argv + 1);

this should be:

return system("/var/ipfire/extrahd/bin/extrahd.pl", argv + 1);
#   -or-
return safe_system("/var/ipfire/extrahd/bin/extrahd.pl", argv + 1);

just a wild guess!

Maybe an assist from Michael @ms ??

Bernhard @bbitsch - Do you want to release a patch for this?

See: https://bugzilla.ipfire.org/show_bug.cgi?id=12863#c28

Jon

Test release for ExtraHD. Please test and let us know!

ExtraHD

This feature that allows mounting any extra storage into IPFire has been entirely rewritten. The code was hard to extend and some smaller issues became hard to fix which resulted in us making the decision for a rewrite. It should now be a lot more robust and easy to use.

See:

2 Likes

Hi @jon

I have already found some problems which I have reported to the dev mailing list and added to the bug comments.

Done some more testing, the results of which I am going to add to the bug report shortly.

3 Likes

A post was split to a new topic: ExtraHD - Can’t mount drive