Permissions Reset on Restart or Log Out

Hello Everyone,

For starters, I am new to Linux but I do try to do some research and try things on my own before finally asking for help. With that said, I am trying to get my Emby server working correctly. At the moment, when I try to play some media, I get “Unable to play media. Please contact the system admin”, which is some kind of permission issue I am assuming.

Initially, I followed the Arch Linux Emby installation instructions to the letter from here, Arch Emby Wiki. It worked right off the bat, but when I reboot or log out, Emby can’t access my media again. I got it working again by opening Konsole and inputting these commands from the Emby Arch Wiki again.

find /mnt/media_files -type f -exec chmod 664 {} +

# make the directories writeable to the media group
find /mnt/media_files -type d -exec chmod 775 {} +

# add the sticky group bit so that newly created directories belong to the media group
find /mnt/media_files -type d -exec chmod g+s {} +
System:
Kernel: 6.10.6-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
clocksource: tsc avail: hpet,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=ff0ab206-a76f-4c49-8f9f-1edbb4d49076 rw rootflags=subvol=@
quiet loglevel=3 splash ibt=off
Desktop: KDE Plasma v: 6.1.4 tk: Qt v: N/A info: frameworks v: 6.5.0
wm: kwin_wayland vt: 1 dm: SDDM Distro: Garuda base: Arch Linux
Machine:
Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
Mobo: ASUSTeK model: ROG STRIX B550-F GAMING WIFI II v: Rev X.0x
serial: <superuser required> part-nu: SKU uuid: <superuser required>
UEFI: American Megatrends v: 3607 date: 03/22/2024
CPU:
Info: model: AMD Ryzen 9 5950X bits: 64 type: MT MCP arch: Zen 3+ gen: 4
level: v3 note: check built: 2022 process: TSMC n6 (7nm) family: 0x19 (25)
model-id: 0x21 (33) stepping: 2 microcode: 0xA20120E
Topology: cpus: 1x cores: 16 tpc: 2 threads: 32 smt: enabled cache:
L1: 1024 KiB desc: d-16x32 KiB; i-16x32 KiB L2: 8 MiB desc: 16x512 KiB
L3: 64 MiB desc: 2x32 MiB
Speed (MHz): avg: 3434 high: 4512 min/max: 2200/5083 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 3400 2: 3400
3: 3400 4: 3400 5: 3400 6: 3400 7: 3400 8: 3400 9: 3400 10: 3400 11: 3400
12: 3400 13: 3400 14: 3400 15: 3400 16: 3400 17: 3400 18: 3400 19: 3400
20: 3400 21: 3400 22: 3400 23: 3400 24: 3400 25: 3400 26: 3400 27: 3400
28: 3400 29: 4512 30: 3400 31: 3400 32: 3400 bogomips: 217192
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3
Vulnerabilities: <filter>
Graphics:
Device-1: NVIDIA TU104 [GeForce RTX 2080 Rev. A] vendor: PNY driver: nvidia
v: 560.35.03 alternate: nouveau,nvidia_drm non-free: 550.xx+ status: current
(as of 2024-06; EOL~2026-12-xx) arch: Turing code: TUxxx
process: TSMC 12nm FF built: 2018-2022 pcie: gen: 3 speed: 8 GT/s
lanes: 16 ports: active: none off: DP-2 empty: DP-1, DP-3, HDMI-A-1,
Unknown-2 bus-ID: 07:00.0 chip-ID: 10de:1e87 class-ID: 0300
Device-2: EMEET HD Webcam C960 driver: snd-usb-audio,uvcvideo type: USB
rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 5-3:3 chip-ID: 328f:006d
class-ID: 0102 serial: <filter>
Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.2
compositor: kwin_wayland driver: X: loaded: nvidia unloaded: modesetting
alternate: fbdev,nouveau,nv,vesa gpu: nvidia display-ID: 0
Monitor-1: DP-2 res: 2560x1440 size: N/A modes: N/A
API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2
drv: swrast gbm: drv: nvidia surfaceless: drv: nvidia wayland: drv: nvidia
x11: drv: nvidia inactive: device-1
API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 560.35.03
glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 2080/PCIe/SSE2
memory: 7.81 GiB display-ID: :1.0
API: Vulkan v: 1.3.279 layers: 11 device: 0 type: discrete-gpu
name: NVIDIA GeForce RTX 2080 driver: nvidia v: 560.35.03
device-ID: 10de:1e87 surfaces: xcb,xlib,wayland
Audio:
Device-1: NVIDIA TU104 HD Audio vendor: PNY driver: snd_hda_intel v: kernel
pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 07:00.1 chip-ID: 10de:10f8
class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 09:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: EMEET HD Webcam C960 driver: snd-usb-audio,uvcvideo type: USB
rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 5-3:3 chip-ID: 328f:006d
class-ID: 0102 serial: <filter>
API: ALSA v: k6.10.6-zen1-1-zen status: kernel-api with: aoss
type: oss-emulator tools: N/A
Server-1: PipeWire v: 1.2.3 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
vendor: Foxconn driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
lanes: 1 bus-ID: 05:00.0 chip-ID: 14c3:0616 class-ID: 0280
IF: wlp5s0 state: down mac: <filter>
Device-2: Intel Ethernet I225-V vendor: ASUSTeK driver: igc v: kernel
pcie: gen: 2 speed: 5 GT/s lanes: 1 port: N/A bus-ID: 06:00.0
chip-ID: 8086:15f3 class-ID: 0200
IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
IF-ID-1: enp1s0f0u3 state: unknown speed: -1 duplex: half mac: <filter>
Info: services: NetworkManager, smbd, systemd-timesyncd, wpa_supplicant
Bluetooth:
Device-1: OPPO SM8350-MTP _SN:1F1828F5 driver: rndis_host v: kernel
type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:8
chip-ID: 22d9:2766 class-ID: 0a00 serial: <filter>
Device-2: Foxconn / Hon Hai Wireless_Device driver: btusb v: 0.8 type: USB
rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-5:2 chip-ID: 0489:e0e2
class-ID: e001 serial: <filter>
Report: ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2 lmp-v: 11
status: discoverable: no pairing: no class-ID: 6c0104
Drives:
Local Storage: total: 28.34 TiB used: 14.46 TiB (51.0%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 990 PRO with
Heatsink 2TB size: 1.82 TiB block-size: physical: 512 B logical: 512 B
speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter> fw-rev: 4B2QJXD7
temp: 40.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 PRO 1TB
size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
tech: SSD serial: <filter> fw-rev: 2B6Q scheme: GPT
ID-3: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 840 PRO Series
size: 119.24 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
tech: SSD serial: <filter> fw-rev: 6B0Q scheme: GPT
ID-4: /dev/sdc maj-min: 8:32 vendor: Seagate model: ST3000DM001-1ER166
size: 2.73 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
tech: HDD rpm: 7200 serial: <filter> fw-rev: CC25 scheme: GPT
ID-5: /dev/sdd maj-min: 8:48 vendor: Seagate model: ST1000DM003-1ER162
size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
tech: HDD rpm: 7200 serial: <filter> fw-rev: CC43 scheme: GPT
ID-6: /dev/sde maj-min: 8:64 vendor: Toshiba model: HDWR11A size: 9.1 TiB
block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s tech: HDD
rpm: 7200 serial: <filter> fw-rev: 0603 scheme: GPT
ID-7: /dev/sdf maj-min: 8:80 vendor: Seagate model: ST8000DM002-1YW112
size: 7.28 TiB block-size: physical: 4096 B logical: 512 B speed: 3.0 Gb/s
tech: HDD rpm: 7200 serial: <filter> fw-rev: DN01 scheme: GPT
ID-8: /dev/sdg maj-min: 8:96 vendor: Western Digital
model: WD60EDAZ-11U78B0 size: 5.46 TiB block-size: physical: 4096 B
logical: 512 B type: USB rev: 3.1 spd: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1
tech: HDD rpm: 5400 serial: <filter> fw-rev: 4009 scheme: GPT
Partition:
ID-1: / raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 29.79 GiB (3.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 588 KiB (0.2%) fs: vfat dev: /dev/sda1 maj-min: 8:1
ID-3: /home raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 29.79 GiB (3.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-4: /var/log raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 29.79 GiB (3.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-5: /var/tmp raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 29.79 GiB (3.1%) fs: btrfs dev: /dev/sda2 maj-min: 8:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 94.19 GiB used: 0 KiB (0.0%) priority: 100
comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 32 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 48.6 C mobo: 36.0 C
Fan Speeds (rpm): N/A
Info:
Memory: total: 96 GiB note: est. available: 94.19 GiB used: 4.13 GiB (4.4%)
Processes: 527 Power: uptime: 1h 12m states: freeze,mem,disk suspend: deep
avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
suspend, test_resume image: 37.63 GiB services: org_kde_powerdevil,
power-profiles-daemon, upowerd Init: systemd v: 256 default: graphical
tool: systemctl
Packages: pm: pacman pkgs: 1881 libs: 541 tools: octopi,pamac,paru
Compilers: clang: 18.1.8 gcc: 14.2.1 Shell: garuda-inxi default: fish
v: 3.7.1 running-in: konsole inxi: 3.3.35
Garuda (2.6.26-1):
System install date:     2024-08-29
Last full system update: 2024-08-29
Is partially upgraded:   Yes
Relevant software:       snapper NetworkManager dracut nvidia-dkms
Windows dual boot:       Probably (Run as root to verify)
Failed units:

The media plays fine after the commands have been executed but as soon as I reboot it is back to square one again.

After some Googling, I decided to try running a shell script with these commands above when I log in to the system. I went to the directory /profile.d and created the file and then put the commands in the file and saved it. After a reboot, I am prompted by the log in screen, which I enter my password. Then, my monitor reports after a few seconds that it has no signal and have a blank screen. I to the console and remove the file in profile.d and it works, though I am scratching my head as to why 3 simple commands could screw up the Display Manager. Boggled. I have been at this for a week now and getting really frustrated so I came here to ask for help. What can I do that would make the file permissions stick after a reboot and why does it not keep my settings? Am I making it more difficult than what it should be?

Regards,

Tim

Hello @tda0626 and welcome to the forum!

It is great to see that you already did some research on your own and tried to find a solution.
Also, very good that you are using code blocks for code!

One thing tho :wink: Could you please edit your post and add the output of garuda-inxi in a code block as well?
This is default needed for every support request here. Thank you a bunch.

3 Likes

Put your script in /home/$USER/.local/bin/
make it executable and in KDE System setting use Autostart - add start script.
Or use autostart folder in other DE’s.

@BrutalBirdie Yep when I get home from work I can post that info.

@SGS thank you. I will try that this evening.

Edit:

Added Garuda system info to post…

1 Like

I’ve been using emby on windows for many years now. I was very happy to see it become available on arch linux (Garuda). I have all my media on a NAS device. I can run both the Linux and Windows Emby Server at the same time.
When I reboot the Emby server is automatically started:

sudo systemctl start emby-server      # Start the service
sudo systemctl enable emby-server     # Start the service on bootup
systemctl status emby-server.service  # Check the service is running

I also mount the NAS device automatically on reboot also. I found that this does not wake the NAS device up (mine is set to sleep in 30 minutes with no activity), so when Emby attemps to access it has to wait ~30 seconds. This may give the appearance that something is not running. On my windows server Emby will time out and display an error message, but a retry does usually work.

It is possible you synced the repos, then installed one or a few packages without updating the rest. A partially upgraded system can introduce issues that are difficult to diagnose or fix. See this Arch Wiki link for a more in-depth explanation: System maintenance - ArchWiki

As soon as you have a chance, you should bring your system fully up to date.

garuda-update

If a script in /etc/profile.d/ hangs or fails, it it can disrupt the normal initialization of the shell environment. That can in turn stop the graphical environment from starting, because commonly desktop environments rely on the successful initialization of the user’s shell environment to launch properly.

A safer way to run a script like this would be a systemd service. However, this script should not be needed in the first place; it should be possible to make whatever permissions you want persistent instead.

Are you mounting this resource in /etc/fstab? If so, let’s take a look at the fstab entry.

Let’s also check the ownership of this mount point as it is when you first boot the desktop (before running the find/chmod commands).

eza -ldg /mnt/media_files

Thanks for the input. I got it to work once because it asked for my password when booting to desktop but now after a restart it doesn’t ask for the password so it fails to run the sudo parts of the script. It should not be this hard to get something simple to work, shaking my head.

Script

#!/bin/bash

sudo systemctl start emby-server      # Start the service
sudo systemctl enable emby-server     # Start the service on bootup
sudo chown -R tim:media /run/media
sudo find /run/media -type f -exec chmod 664 {} +
sudo find /run/media -type d -exec chmod 775 {} +
sudo find /run/media -type d -exec chmod g+s {} +

Autostart output

Autostart Output

Regards,

Tim

Ok, got my ntfs drives mounted through fstab. They all show up in /mnt now and Emby can access them.

The only drive left is an external 10TB exfat drive. How can I add that one to fstab? I tried and can’t seem to get it to work.

Tim

Figured it out finally. My fstab entry would not work until I went in to the terminal and typed this command in the terminal

mount -t exfat /dev/sdg1 /mnt/sdg

Thanks for everyone’s help.

Tim

You could run the script as a systemd service.

1 Like

I am not sure how to do that yet.