The rm command is not working for me

Hello Garuda users I'm trying to delete files and folders off my attached USB devices but it's not helping, I don't get any errors though but the files and folders dont get deleted.

if I try the same file on my other Linux Distro Elementary OS Loki on my other SSD the proces goes well and the files or folders gets deleted

this is the command I'm running trying trying to delete write protected files and folders:

sudo rm -f -r -d /media/object-undefined/57689090-24a1-4794-9203-d659d13db8cd/media/

Hers my System info

System:
Kernel: 5.15.64-1-lts arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
root=UUID=fd064626-5c5f-4be1-9f81-5f6ac8b2f47d rw rootflags=subvol=@
quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1
resume=UUID=d8ae0431-a1a2-48e5-b320-073dd2566394 loglevel=3
Desktop: KDE Plasma v: 5.25.4 tk: Qt v: 5.15.5 info: latte-dock
wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Desktop System: HP product: HP ProDesk 600 G2 DM v: N/A
serial: <superuser required> Chassis: type: 15 serial: <superuser required>
Mobo: HP model: 8169 v: KBC Version 05.26 serial: <superuser required>
UEFI: HP v: N22 Ver. 02.09 date: 03/10/2016
CPU:
Info: model: Intel Core i5-6500T bits: 64 type: MCP arch: Skylake-S
gen: core 6 built: 2015 process: Intel 14nm family: 6 model-id: 0x5E (94)
stepping: 3 microcode: 0xF0
Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB
desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB
desc: 1x6 MiB
Speed (MHz): avg: 2827 high: 2993 min/max: 800/3100 scaling:
driver: intel_pstate governor: performance cores: 1: 2993 2: 2947 3: 2864
4: 2507 bogomips: 19999
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Vulnerabilities:
Type: itlb_multihit status: KVM: VMX unsupported
Type: l1tf mitigation: PTE Inversion
Type: mds mitigation: Clear CPU buffers; SMT disabled
Type: meltdown mitigation: PTI
Type: mmio_stale_data mitigation: Clear CPU buffers; SMT disabled
Type: retbleed mitigation: IBRS
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
prctl and seccomp
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
sanitization
Type: spectre_v2 mitigation: IBRS, IBPB: conditional, RSB filling,
PBRSB-eIBRS: Not affected
Type: srbds mitigation: Microcode
Type: tsx_async_abort mitigation: TSX disabled
Graphics:
Device-1: Intel HD Graphics 530 vendor: Hewlett-Packard driver: i915
v: kernel arch: Gen-9 process: Intel 14n built: 2015-16 ports:
active: HDMI-A-1 empty: DP-1, DP-2, DP-3, HDMI-A-2 bus-ID: 00:02.0
chip-ID: 8086:1912 class-ID: 0300
Display: x11 server: X.Org v: 21.1.4 with: Xwayland v: 22.1.3
compositor: kwin_x11 driver: X: loaded: intel unloaded: modesetting
alternate: fbdev,vesa gpu: i915 display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: HDMI-A-1 mapped: HDMI1 model: Mi Monitor serial: <filter>
built: 2020 res: 1920x1080 dpi: 92 gamma: 1.2
size: 530x290mm (20.87x11.42") diag: 603mm (23.7") ratio: 16:9 modes:
max: 1920x1080 min: 720x400
OpenGL: renderer: Mesa Intel HD Graphics 530 (SKL GT2) v: 4.6 Mesa 22.1.7
direct render: Yes
Audio:
Device-1: Intel 100 Series/C230 Series Family HD Audio
vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
chip-ID: 8086:a170 class-ID: 0403
Sound Server-1: ALSA v: k5.15.64-1-lts running: yes
Sound Server-2: JACK v: 1.9.21 running: no
Sound Server-3: PulseAudio v: 16.1 running: no
Sound Server-4: PipeWire v: 0.3.57 running: yes
Network:
Device-1: Intel Ethernet I219-LM vendor: Hewlett-Packard driver: e1000e
v: kernel port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15b7 class-ID: 0200
IF: eno1 state: down mac: <filter>
Device-2: TP-Link TL-WN823N v2/v3 [Realtek RTL8192EU] type: USB
driver: rtl8xxxu bus-ID: 1-5:3 chip-ID: 2357:0109 class-ID: 0000
serial: <filter>
IF: wlp0s20f0u5 state: up mac: <filter>
Drives:
Local Storage: total: 617.64 GiB used: 190.01 GiB (30.8%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
model: MZVLB512HAJQ-000L7 size: 476.94 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: 4L2QEXA7 temp: 42.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: TCSunBow model: X3 120GB
size: 111.79 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
type: SSD serial: <filter> rev: 8A scheme: MBR
ID-3: /dev/sdb maj-min: 8:16 type: USB vendor: Lexar model: USB Flash
Drive size: 28.91 GiB block-size: physical: 512 B logical: 512 B
type: SSD serial: <filter> rev: PMAP scheme: MBR
SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
Partition:
ID-1: / raw-size: 468.5 GiB size: 468.5 GiB (100.00%) used: 178.13 GiB
(38.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%) used: 578 KiB
(0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 468.5 GiB size: 468.5 GiB (100.00%) used: 178.13
GiB (38.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 468.5 GiB size: 468.5 GiB (100.00%) used: 178.13
GiB (38.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 468.5 GiB size: 468.5 GiB (100.00%) used: 178.13
GiB (38.0%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 7.65 GiB used: 564.2 MiB (7.2%)
priority: 100 dev: /dev/zram0
ID-2: swap-2 type: partition size: 8.18 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
System Temperatures: cpu: 47.0 C pch: 52.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:
Processes: 227 Uptime: 5h 2m wakeups: 0 Memory: 7.65 GiB used: 4.21 GiB
(55.0%) Init: systemd v: 251 default: graphical tool: systemctl
Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: pacman: 1417 lib: 349
Shell: fish v: 3.5.1 default: Bash v: 5.1.16 running-in: konsole
inxi: 3.3.20
Garuda (2.6.6-1):
System install date:     2021-09-24
Last full system update: 2022-09-04
Is partially upgraded:   No
Relevant software:       NetworkManager
Windows dual boot:       No/Undetected
Snapshots:               Timeshift (maybe)
Failed units:            bluetooth-autoconnect.service systemd-guest-user.service

First of all, simply don’t use -f unless you are 100% sure what you are doing
Also, no need to use -d flag with -r flag.

The second thing is, are you sure that data you want to delete is in this folder?

? media directory is generally inside /run/ directory.

Can you post output of

ls /media/object-undefined/

and

ls /run/media/object-undefined/
3 Likes

yes , it’s a folder that goes currupt in Kodi after I don’t shut it down properly, it contains my attached drive data on OSMC, so after it goes corrupt, it creates another folder which makes it impossible for my media center (OSMC) to find and play my stored TV Shows and Movies. the only workaround is to delete that folder and create a new one .

i have been doing this for years on elementary OS Loki and I did it again just now

elementary OS loki is able to delete and make new folders but not on Garuda Dragonized

I’ll send the output and screenshots from both Garuda and elementary OS Loki soon…

No screenshots please.

Try deleting the file from a Garuda live disk.

In Telegramm you said the folder was on an microSD card. Are you sure the card is not write protected or determines itself as broken and forbids write access?

See if dmesg shows any errors about the device.

it's not write protected, if I boot into elementary OS I'm able to delete with ease

So dmesg does not show any errors?

ls /run/media/object-undefined/
drwxr-xr-x - object-undefined  1 Jan  1970  44AC-A5C2
drwxr-xr-x - root             10 Sep 22:00  57689090-24a1-4794-9203-d659d13db8cd

╭─object-undefined@object in ~ as 🧙 took 3ms
ls /media/object-undefined/
"/media/object-undefined/": No such file or directory (os error 2)

╭─object-undefined@object in ~ as 🧙 took 4ms

this is what I'm getting

no errors shown

sudo rm -f -r -d /media/object-undefined/57689090-24a1-4794-9203-d659d13db8cd/media/
[sudo] password for object-undefined:

╭─object-undefined@object in ~ as 🧙 took 19s
╰─λ

this is the output but that folder isn't deleted

:point_up: There it is, as Naman pointed out on your Garuda system these files are stored in the /run directory.

The reason your command isn’t deleting the files you want it to is because you are pointing it at a directory that doesn’t exist.

I am sure it is equally easy to delete from any system, as long as you are using the correct path. It sounds like Elementary OS auto-mounts media in a different directory than Garuda.

It is probably best to verify where your files are stored before running forceful deletion commands. :wink:

5 Likes

sorry I'm a Linux noob, how would I delete that directory using the command line?

what command would I use? I can't delete that directory using the file manager.

https://wiki.archlinux.org/title/Core_utilities#Essentials

1 Like

to my surprise that’s the same path I get from both Garuda and elementary OS

I’m now gettimg this output and error:

sudo rm -f -r -d /run/media/object-undefined/57689090-24a1-4794-9203-d659d13db8cd/media/
[sudo] password for object-undefined:
rm: cannot remove '/run/media/object-undefined/57689090-24a1-4794-9203-d659d13db8cd/media/D4N13 HDD 2': Read-only file system

Are you resistant to advice?

and

6 Likes