bobafetthotmail / folder2ram

mount those folders to ram without losing access to their counterpart on disk!
GNU General Public License v3.0
110 stars 21 forks source link

Problem with path containg spaces #12

Closed alewaste closed 6 years ago

alewaste commented 6 years ago

Hi, I,m trying to add some other folder in the config file, but I found a problem with path that containing spaces.

For example: /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs that have many spaces.

I tried with "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs" or '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs' but doesn't work.

I'm sure that spaces are the problem because checkin status says:

/var/lib/plexmediaserver/Library/Application is NOT mounted

Using ' or " give the same error, but before the path there's ' or ".

How can I solve?

bobafetthotmail commented 6 years ago

I've updated the script to work with path names containing spaces, please download again the script to update it.

Use two tabs (NOT spaces) to separate the type from the mount point, and two tabs to separate the mount point from the options (if you have any options at all, afaik you shouldn't have any).

This is now mentioned in the default config file it generates with folder2ram -configure.

Using "" to encase the path is not required, as now it will use the two tabs to orient itself and read the full path from its config regardless of the spaces in the names.

Please confirm that it fixes the issue, so I can close this bug report.

alewaste commented 6 years ago

I tried with new code, but I failed. I wrote the config file with tabs, no option used, but when I check status, I obtain:

/var/log is mounted /var/tmp is mounted /var/lib/openmediavault/rrd is mounted /var/spool is mounted /var/lib/rrdcached is mounted /var/lib/monit is mounted /var/lib/php is mounted /var/lib/netatalk/CNID is mounted /var/cache/samba is mounted /var/lib/mysql is mounted /var/lib/plexmediaserver/Library/Application is NOT mounted

It still trunk at the first space.

bobafetthotmail commented 6 years ago

EDIT: ignore this, see below post.

can you paste the result of mount (run as root or with sudo)? It should tell if that folder is actually mounted or not.

I think the script is working but the message it prints with -status is wrong.

bobafetthotmail commented 6 years ago

I tested with the exact same path you have issues with, found and fixed another issue, tested that it works, I updated the script on github.

Please update the script and test again.

alewaste commented 6 years ago

I run it as root. When i wrote "folder2ram -mountall", i get this:


will now start all mountpoints start /var/log /var/log already mounted start /var/tmp /var/tmp already mounted start /var/lib/openmediavault/rrd /var/lib/openmediavault/rrd already mounted start /var/spool /var/spool already mounted start /var/lib/rrdcached /var/lib/rrdcached already mounted start /var/lib/monit /var/lib/monit already mounted start /var/lib/php /var/lib/php already mounted start /var/lib/netatalk/CNID /var/lib/netatalk/CNID already mounted start /var/cache/samba /var/cache/samba already mounted start /var/lib/mysql /var/lib/mysql already mounted /sbin/folder2ram: 509: local: Support.OLD: bad variable name start stat: impossibile eseguire stat di '': File o directory non esistente umount: undefined mountpoint umount: /var/folder2ram: not mounted


instead with mount:


folder2ram on /var/log type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/tmp type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/tmp type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/openmediavault/rrd type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/openmediavault/rrd type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/spool type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/spool type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/rrdcached type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/rrdcached type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/monit type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/monit type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/php type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/php type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/netatalk/CNID type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/netatalk/CNID type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/cache/samba type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/cache/samba type tmpfs (rw,nosuid,nodev,noexec,relatime) /dev/sde3 on /var/folder2ram/var/lib/mysql type ext4 (rw,noatime,nodiratime,errors=remount-ro,data=ordered) folder2ram on /var/lib/mysql type tmpfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=369120k,mode=700)


It's not mounted.

Either -status output It's changed:


/var/log is mounted /var/tmp is mounted /var/lib/openmediavault/rrd is mounted /var/spool is mounted /var/lib/rrdcached is mounted /var/lib/monit is mounted /var/lib/php is mounted /var/lib/netatalk/CNID is mounted /var/cache/samba is mounted /var/lib/mysql is mounted /sbin/folder2ram: 509: local: Support.OLD: bad variable name is NOT mounted


Now, it's reading the part of the path after the space.

bobafetthotmail commented 6 years ago

I just updated the script (see post above), is this output with the updated script?

alewaste commented 6 years ago

I saw you update twice the script. I tried with the last one. I get this:


/var/log is mounted /var/tmp is mounted /var/lib/openmediavault/rrd is mounted /var/spool is mounted /var/lib/rrdcached is mounted /var/lib/monit is mounted /var/lib/php is mounted /var/lib/netatalk/CNID is mounted /var/cache/samba is mounted /var/lib/mysql is mounted /sbin/folder2ram: 509: local: Support.OLD: bad variable name is NOT mounted


for testing purpose, I'm now trying to mount

/var/lib/plexmediaserver/Library/Application Support.OLD

bobafetthotmail commented 6 years ago

I cannot reproduce that.

From the error type "bad variable name", I think there are some non-visible ascii characters in that line in your config file. A truncated path is not a "bad variable name". This is a shell (bash usually) error, not an error I print with my script.

Try deleting that line in the config and rewriting it by typing it (no copy-paste or you will copy the non-visible chars).

Or try using (as sudo/root) sed -i 's/.^H//g' /etc/folder2ram/folder2ram.conf to clean the config file. (taken from https://unix.stackexchange.com/questions/144988/removing-non-printable-characters-using-posix-sed )

you can also try deleting the temporary folders of folder2ram by folder2ram -umountall mount #to check that no folder is still mounted **rm -r /var/folder2ram/***

but I don't think it is related.

See the ouptut of my test VM below, with the current last version of the script. (I created the same path you had issues with)


linux-7mjq:/home/alby # folder2ram -status

/home/alby/Test Folder is NOT mounted
/home/alby/Test Folder two/another folder is NOT mounted
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs is NOT mounted
linux-7mjq:/home/alby # folder2ram -mountall

will now start all mountpoints
start /home/alby/Test Folder
start /home/alby/Test Folder two/another folder
start /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs
linux-7mjq:/home/alby # folder2ram -status

/home/alby/Test Folder is mounted
/home/alby/Test Folder two/another folder is mounted
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs is mounted
linux-7mjq:/home/alby # folder2ram -umountall

will now stop all mountpoints
stop /home/alby/Test Folder
stop /home/alby/Test Folder two/another folder
stop /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs
alewaste commented 6 years ago

I tried your suggestion, but failed again.

I tried to change the path. And I noticed that the last error (bad variable) was caused by . between "Support.OLD" But removing ".OLD", I have again a trunked path error:


will now start all mountpoints start /var/log start /var/tmp start /var/lib/openmediavault/rrd start /var/spool start /var/lib/rrdcached start /var/lib/monit start /var/lib/php start /var/lib/netatalk/CNID start /var/cache/samba start /var/lib/mysql start /var/lib/plexmediaserver/Library/Application stat: impossibile eseguire stat di '/var/lib/plexmediaserver/Library/Application': File o directory non esistente umount: /var/lib/plexmediaserver/Library/Application: mountpoint not found umount: /var/folder2ram/var/lib/plexmediaserver/Library/Application: not mounted


Initially I installed the script with OMV plugin. Could be this the problem?

Then I overwrote the script with

wget -O /sbin/folder2ram https://raw.githubusercontent.com/bobafetthotmail/folder2ram/master/debian_package/sbin/folder2ram

Thank You for your help.

bobafetthotmail commented 6 years ago

And I noticed that the last error (bad variable) was caused by . between "Support.OLD"

Where does this ".OLD" come from? Your original path was /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs right?

Initially I installed the script with OMV plugin. Could be this the problem? Then I overwrote the script with

Hmmm, so you are using Debian (OMV uses Debian as a base). I'm using OpenSUSE here so there might be differences.

....

Aaand yes there are differences. I'm reproducing your issue in a Debian 9 virtual machine, so I assume there is something in the script that Debian does not like. I'm not amused.


root@debianBuilder:/home/alby# folder2ram -mountall

will now start all mountpoints
/sbin/folder2ram: 509: local: folder/new: bad variable name
start 
stat: cannot stat '': No such file or directory
umount: undefined mountpoint
umount: /var/folder2ram: not mounted

I'll fix the script so Debian/OMV likes it too, and test in the Debian virtual machine so I can be sure that it will work.

I'll post again when I update the script. Sorry for the mess.

bobafetthotmail commented 6 years ago

Ok, I should have fixed the issue on Debian, and on my VM it works correctly now.

I updated the script on github, can you test again?

alewaste commented 6 years ago

Where does this ".OLD" come from? Your original path was /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs right?

You are right. I create another one folder for testing, because I'm using a real machine with Plex Server active.

Thank You.

alewaste commented 6 years ago

I tested again. Now, the script read correctly the path, but there's something wrong with permissions.

I tested trhee Path: /var/Prova Mia /var/lib/plexmediaserver/Library/Application Support.OLD /var/lib/plexmediaserver/Library/Application Support

The first one is ok, but there's an error with chmod and chown command:


start /var/log /var/log already mounted start /var/tmp /var/tmp already mounted start /var/lib/openmediavault/rrd /var/lib/openmediavault/rrd already mounted start /var/spool /var/spool already mounted start /var/lib/rrdcached /var/lib/rrdcached already mounted start /var/lib/monit /var/lib/monit already mounted start /var/lib/php /var/lib/php already mounted start /var/lib/netatalk/CNID /var/lib/netatalk/CNID already mounted start /var/cache/samba /var/cache/samba already mounted start /var/Prova Mia /var/Prova Mia already mounted start /var/lib/plexmediaserver/Library/Application Support.OLD chmod: operando mancante Try 'chmod --help' for more information. chown: operando mancante Try 'chown --help' for more information. umount: /var/lib/plexmediaserver/Library/Application Support.OLD: not mounted umount: /var/folder2ram/var/lib/plexmediaserver/Library/Application Support.OLD: not mounted


I saw that Plex has set plex user has owner of the path and nogroup as group. In the first one, owner is root.

I'm sorry for misunderstanding about the operating system.

bobafetthotmail commented 6 years ago

When you add a new path it always errors like that, it's when it is adding a folder in /var/folder2ram After that it works and the mounted folders have the right permissions. Try again.

I'll try to see why it does that though, might as well fix all bugs today right?

I'm sorry for misunderstanding about the operating system.

This script is supposed to work on Debian too (I wrote it originally for OMV), I should have asked that.

bobafetthotmail commented 6 years ago

Ok fixed that issue too, and updated the script on github.

you can test it by deleting the temporary folders of folder2ram by folder2ram -umountall mount #to check that no folder is still mounted **rm -r /var/folder2ram/***

and then doing a

folder2ram -mountall

again.

alewaste commented 6 years ago

You are GREAT! Now works very well! Thank you very much!

bobafetthotmail commented 6 years ago

Ok, thanks for your patience. :)

All reported bugs fixed, closing this issue.

:+1: