Background: I have two raspberry pi's running ubuntu Mate and I have a bash script that runs a mount command on both.

Raspberry Pi1 is working fine but when I copied over the files for pi2, I cannot connect for some reason.

my bash script looks like this...

# Mount Shared Folder on Jay's computer
jip=$(php /var/www/html/Update-Project-Files/utilities/get_jay_ip_for_pi2.php)
echo $jip
mount -t cifs -o username=username,password=pass,uid=33 '//'$jip/work_video_files /var/www/html/Update-Project-Files/Mounts/Jay_mount

This calls a php file to get the ip for the shared folder computer and then calls the mount. I have changed nothing because it works fine on my first machine but for some reason it will not work for the 2nd machine.

if I try the command from the commandline and sub in the IP I am able to mount the folder successfully but running this script from the commandline will only print the IP from the echo(as expected) and then the usage for mount is displayed.. I guess telling me my mount command is wrong?

so output looks like:

pi2@pi2:~$ sudo /bin/bash /var/www/html/Update-Project-Files/scripts/mount_shared_folder_for_pi2.sh 2>&1


Usage: mount [-lhV] mount -a [options] mount [options] [--source] | [--target] mount [options] mount []

Mount a filesystem.

Options: -a, --all mount all filesystems mentioned in fstab -c, --no-canonicalize don't canonicalize paths -f, --fake dry run; skip the mount(2) syscall -F, --fork fork off for each device (use with -a) -T, --fstab alternative file to /etc/fstab -i, --internal-only don't call the mount. helpers -l, --show-labels show also filesystem labels -n, --no-mtab don't write to /etc/mtab -o, --options comma-separated list of mount options -O, --test-opts limit the set of filesystems (use with -a) -r, --read-only mount the filesystem read-only (same as -o ro) -t, --types limit the set of filesystem types --source explicitly specifies source (path, label, uuid) --target explicitly specifies mountpoint -v, --verbose say what is being done -w, --rw, --read-write mount the filesystem read-write (default)

-h, --help display this help and exit -V, --version output version information and exit

Source: -L, --label synonym for LABEL= -U, --uuid synonym for UUID= LABEL= specifies device by filesystem label UUID= specifies device by filesystem UUID PARTLABEL= specifies device by partition label PARTUUID= specifies device by partition UUID specifies device by path mountpoint for bind mounts (see --bind/rbind) regular file for loopdev setup

Operations: -B, --bind mount a subtree somewhere else (same as -o bind) -M, --move move a subtree to some other place -R, --rbind mount a subtree and all submounts somewhere else --make-shared mark a subtree as shared --make-slave mark a subtree as slave --make-private mark a subtree as private --make-unbindable mark a subtree as unbindable --make-rshared recursively mark a whole subtree as shared --make-rslave recursively mark a whole subtree as slave --make-rprivate recursively mark a whole subtree as private --make-runbindable recursively mark a whole subtree as unbindable

Any thoughts on why or what further steps I could take to pinpoint the issue?

After further thinking... I believe this is because pi1 has an entry for the mount in fstab but pi2 does not. I will need to check tomorrow when I get to that machine. I was unaware that mounts necessarily needed an entry in fstab. I thought fstab ran scripts at startup but from reading this...


I feel I did not understand fstab before. Does this sound feasible?

Final Update.... I was never able to get this working and to boot had ethernet connection issues so I just scrapped it. I am focused elsewhere now. I am new to linux but am finding out that so many errors seem to be underlying permissions problems perhaps the mounting error above was the same.

  • I'd start by checking exactly what's returned from your php command - make sure it doesn't have trailing whitespace or non-printable characters (such as a carriage return) – steeldriver Mar 26 '17 at 16:51
  • So, based on your "final update" you are no longer interested in an answer to this question? – Organic Marble Mar 28 '17 at 14:48
  • @OrganicMarble correct! – TotoTornado Mar 28 '17 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.