Mounting USB-stick fails because of "permission denied" as root-user

My hope was, that mounting an USB-stick is as simple as in plan Debian.

As root-user I get the message “permission denied”, no matter which directory I use for mounting.
ls -lah shows, that I have all root-permissions to read/write an execute. I’m able to use chmod 777 on each single directory.

But mount leaves me which “permission denied” - all the time. Even if I make my own directory, f.e. as subdirectory of /home … the same problem occurs.

Any ideas, what’s wrong?

Thanks in advance for sharing your thoughts.

Maybe you are inside a docker container that is not allowed to use the device (/dev/whatever).
How exactly are you trying to mount it?

Hi ondras12345,

thanks for your immediate reply. I’m happy to get in contact with a specialist :slight_smile:

I’m a rookie … but I try to explain, what I did:

HASS came to me by just downloading the image, inserting it into my raspi3 and starting. I’ve no idea, what kind of installation that is. I just followed the checklist (sorry …).

My ls - lah looks like this:

total 112K
drwxr-xr-x 1 root root 4.0K Aug 25 11:34 .
drwxr-xr-x 1 root root 4.0K Aug 25 11:34 …
-rwxr-xr-x 1 root root 0 Aug 6 18:07 .dockerenv
drwxr-xr-x 2 root root 4.0K Jul 9 18:15 addons
drwxr-xr-x 2 root root 4.0K Aug 25 10:07 backup
drwxr-xr-x 1 root root 4.0K Apr 28 13:36 bin
drwxr-xr-x 11 root root 4.0K Aug 23 22:30 config
drwxr-xr-x 4 root root 4.0K Aug 6 18:07 data
drwxr-xr-x 16 root root 3.7K Aug 25 11:07 dev
drwxr-xr-x 1 root root 4.0K Aug 6 18:07 etc
drwxr-xr-x 1 root root 4.0K Aug 25 11:36 home
-rwxr-xr-x 1 root root 389 Oct 20 2020 init
drwxr-xr-x 1 root root 4.0K Apr 30 15:26 lib
drwxr-xr-x 2 root root 4.0K Apr 28 13:36 libexec
drwxrwxrwx 3 root root 4.0K Aug 17 15:12 media
drwxr-xr-x 2 root root 4.0K Apr 14 12:28 mnt
drwxr-xr-x 2 root root 4.0K Apr 14 12:28 opt
dr-xr-xr-x 300 root root 0 Aug 6 18:07 proc
drwxr-xr-x 1 root root 4.0K Aug 25 10:59 root
drwxr-xr-x 1 root root 4.0K Aug 6 18:07 run
drwxr-xr-x 2 root root 4.0K Apr 14 12:28 sbin
drwxr-xr-x 2 root root 4.0K Aug 24 10:44 share
drwxr-xr-x 2 root root 4.0K Apr 14 12:28 srv
drwxr-xr-x 2 root root 4.0K Jun 17 15:47 ssl
dr-xr-xr-x 12 root root 0 Aug 6 18:07 sys
drwxrwxrwt 1 root root 4.0K Aug 6 18:17 tmp
drwxr-xr-x 1 root root 4.0K May 26 15:23 usr
drwxr-xr-x 1 root root 4.0K Apr 30 15:15 var

I’ve no idea, if this shows anything to decide, which kind of installation I have.

ls /dev shows my usb-stick as “sda1”. If I take it out of the raspi, “sda1” disappears.

In case, that I’m in a docker container, that does not allow to use the USB-device, what would be a solution for the problem? Is there a chance to get access anyway?

What’s your recommandation?

Kind regards
Michael

So explain how you do e.g. ls. HAOS comes standard without a shell.

  • are you using a monitor and keyboard on your pi ?
  • did you install the Terminal & SSH add-on ?
  • did you install the SSH & Web Terminal add-on
  • did you activate the debug ssh access ?

I do not use monitor and keyboard, but I’m got the Terminal & SSH integration in HA.
Access to the raspi is no problem - its working fine.

Just half an hour ago, I found an blog entry “External USB drive for Hass.io snapshots” dated Jul 17.
It says, that there is a mounting process like: /dev/sda1 /usr/share/hassio/share/ThumbDrive.

The folder structure is today a little bit different. It tried to mount on:
/dev/sda1 usr/share/backupHA (backupHA was setup before)

I got again “permission denied”.

I checked fstab and found two entries:

/dev/cdrom|/media/cdrom|iso9660|noauto,ro 0 0|
/dev/usbdisk|/media/usb|vfat|noauto,ro 0 0|

In my /dev, there are many entries, but no “usbdisk” and no “cdrom”.

I simply do not understand, what’s going on an what to do - sorry :slight_smile:

Kind regards
Michael

Install the ssh and web terminal addon.

Add the mount command in init_commands: part of the command.

@francisp Where is the init_commands: located?

1 Like

Hmmmm.

This question seems to have been asked many times, and I have looked thru the related threads several times but cannot find a definitive answer.

I have tried mounting the from the command line, and that failed (as others report) and so I created an automation event that triggers 15 seconds after restart, and that also fails.

So is it possible to mount a local samba share that I can use to store data, as the storeage on the RPI card is quite limited ?

[core-ssh ~]$ mkdir -p /mnt/router/private; mount -t cifs -o 'username=xxxx,password=xxxxxdomain=WORKGROUP,vers=1.0,noserverino' //192.168.1.1/Private /mnt/router/private
mount: mounting //192.168.1.1/Private on /mnt/router/private failed: Permission denied
shell_command:
  map_nas_video_folder: mkdir -p /mnt/router/private; mount -t cifs -o vers=1.0,noserverino,username=xxx,password=xxx //192.168.1.1/Private /mnt/router/private
media_dirs:
  recordings: /mnt/router/private
- alias: Map NFS Drive to HassIO
  id: map_nfs_drive_to_hassio
  initial_state: 'on'
  trigger:
    - platform: homeassistant
      event: start
  action:
    - delay: '00:00:15'
    - service: shell_command.map_nas_video_folder
media_dirs:
  recordings: /mnt/router/private
Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/__init__.py:115
Integration: Shell Command (documentation, issues)
First occurred: 10:44:10 (1 occurrences)
Last logged: 10:44:10

Error running command: `mkdir -p /mnt/router/private; mount -t cifs -o 'vers=1.0,noserverino,username=xxx,password=xxx' //192.168.1.1/Private /mnt/router/private`, return code: 111
NoneType: None

Any Update on this? I am also trying to simply mount a SMB share to store some Data on it but I can’t manage it. Its just crazy how many hurdles one has to jump to do such a simple thing.

When trying to mount the Share, I just get the same “permission denied” message as above.

EDIT: Im running Home-Assist in a Truenas VM.

Hi;

I solved the problem by using the File Browser Addon