Damn Small Linux (DSL) Forums
Welcome, Guest. Please login or register.
December 07, 2023, 10:34:41 PM

Login with username, password and session length
News
The new DSL forums are now open.
Stats
11609 Posts in 311 Topics by 291 Members
Latest Member: mik3ca
Search:     Advanced search
* Home Help Search Login Register
Get The Official Damn Small Linux Book. Great VPS hosting provided by Tektonic

+  Damn Small Linux (DSL) Forums
|-+  Damn Small Linux
| |-+  DSL Tips and Tricks
| | |-+  Solutions to "Please mount optional dir and try again" Error
« previous next »
Pages: [1] Print
Author Topic: Solutions to "Please mount optional dir and try again" Error  (Read 9358 times)
CNK
Sr. Member
****
Posts: 269


View Profile
« on: October 22, 2017, 11:09:04 AM »

Users of HDD installs, or who leave their computers running for very long periods, may have encountered error messages requesting them to "Please mount optional dir and try again" after attempting to load a MyDSL extension, or when sutting down their PC.

A simple solution to this problem is to replace the "/tmp/mydsl.map" file, which normally lists all loaded UCI extensions, with a template one containing 63 lines of the text "free". Such a file is attached with this post and can be set to automatically replace "/tmp/mydsl.map" on every boot by including a command such as the following in the "/opt/bootlocal.sh" script:

Code:
cp /home/dsl/mydsl.map.start /tmp/mydsl.map

The problem that the above partially solves is with the MyDSL UCI package system, which relies on unloading all loaded UCI packages on shutdown. The system fails to contend with packages loaded from a directory other than /home/dsl/, and also where packages have been renamed, moved, or were loacated on a filesystem that has been unmounted.

A better solution to the problem with packages loaded from outside "/home/dsl/" is to replace line 10 of "/etc/init.d/mountci", which reads:

Code:
SOURCE="$1"

With this:

Code:
SOURCE=`readlink -f "$1"`

A copy of "/etc/init.d/mountci" from DSL V. 4.4.10 with this modification already performed is also attached.

The replacement of "/tmp/mydsl.map" on each boot should still be performed to account for the other instances where the extensions system may get confused.

The following are some notes describing observations regarding the MyDSL UCI extension system, and more detail of the problem at hand:

*"Please mount optional dir and try again" prompt comes from "/etc/init.d/mountci", which is called from
 "/usr/local/bin/exitcheck.sh", which is called by "/usr/bin/dslexit" (exit
 window program).

*The error window is displayed by a call to the script "/usr/bin/popup.lua",
 but only if the $DISPLAY shell variable is of non-zero length.

*The call to "/etc/init.d/mountci" from "/usr/local/bin/exitcheck.sh" seems
 to be due to the presence of entries in the "/tmp/mydsl.map" file added when
 uci extensions are loaded.

*Removing, or creating an empty, "/tmp/mydsl.map" does not solve the problem.
 The UCI system works by looking line-by-line through "/tmp/mydsl.map" before
 loading an extension, and noting the first line number where it finds the word
 "free". It then mounts the .uci extension at the /dev/cloop device associated
 with that line number. So if line 5 was the first to read "free", the new
 extension would be mounted at "/dev/cloop5". It also replaces the "free" text
 on line 5 with the name of the extension loaded eg. "extension.uci".

*The problem with using only the extension name is that this means that the
 extension has to be in the current directory when the command to unmount the
 extension is executed. If it is in a different directory, as may happen when
 the "/usr/local/bin/exitcheck.sh" script attempts to unload all extensions on
 shutdown, the command will fail.
 -This has been solved by changing line 10 of "/etc/init.d/mountci" from:
  SOURCE="$1"
  to
  SOURCE=`readlink -f "$1"`
  Now the full directory path is always written to the "/tmp/mydsl.map", and
  "/usr/local/bin/exitcheck.sh" therefore succeeds in unmounting all loaded
  UCI extensions and marking their lines in "/tmp/mydsl.map" as "free".

*As no UCI extensions could be loaded when the OS restarts, it would be possible
 to add a command to copy a file with 63 "free" lines to "/tmp/mydsl.map" to
 "/opt/bootlocal.sh", therefore ensuring that everything starts afresh, even
 after a crash or power failure.

*A problem was noticed with "/usr/local/bin/exitcheck.sh" failing to edit the
 "/opt/.dfmext" file, this was (sort of) solved by doing a "sudo chmod a+rw /opt/.dfmext".
« Last Edit: October 22, 2017, 11:13:49 AM by CNK » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Mercury design by Bloc