Accidently changed the /usr/bin/ ownership

Kernel: 6.1.12-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=ed32595a-d211-4658-b067-e481188b5b26 rw [email protected]
quiet quiet rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3
Desktop: KDE Plasma v: 5.27.1 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Type: Desktop Mobo: Micro-Star model: B450 TOMAHAWK MAX II (MS-7C02) v: 3.0
serial: <superuser required> UEFI: American Megatrends LLC. v: H.90
date: 07/25/2022
Info: model: AMD Ryzen 5 5600X 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: 0xA20120A
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB
L3: 32 MiB desc: 1x32 MiB
Speed (MHz): avg: 3691 high: 3700 min/max: 2200/4650 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 3700 2: 3700
3: 3700 4: 3700 5: 3700 6: 3700 7: 3600 8: 3700 9: 3700 10: 3700 11: 3700
12: 3700 bogomips: 88800
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Device-1: NVIDIA GA104 [GeForce RTX 3060] vendor: PNY driver: nvidia
v: 525.89.02 alternate: nouveau,nvidia_drm non-free: 525.xx+
status: current (as of 2023-02) arch: Ampere code: GAxxx
process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 3 speed: 8 GT/s lanes: 16
link-max: gen: 4 speed: 16 GT/s bus-ID: 26:00.0 chip-ID: 10de:2487
class-ID: 0300
Display: x11 server: X.Org v: 21.1.7 with: Xwayland v: 22.1.8
compositor: kwin_x11 driver: X: loaded: nvidia unloaded: modesetting,vesa
alternate: fbdev,nouveau,nv gpu: nvidia display-ID: :0 screens: 1
Screen-1: 0 s-res: 6960x1920 s-dpi: 109 s-size: 1622x447mm (63.86x17.60")
s-diag: 1682mm (66.24")
Monitor-1: DP-0 pos: bottom-r res: 1920x1080 hz: 60 dpi: 92
size: 531x299mm (20.91x11.77") diag: 609mm (23.99") modes: N/A
Monitor-2: DP-2 pos: primary,top-left res: 1200x1920 hz: 60 dpi: 94
size: 324x518mm (12.76x20.39") diag: 611mm (24.05") modes: N/A
Monitor-3: DP-4 pos: top-center res: 3840x1600 hz: 60 dpi: 111
size: 879x366mm (34.61x14.41") diag: 952mm (37.49") modes: N/A
API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce RTX
3060/PCIe/SSE2 direct-render: Yes
Device-1: NVIDIA GA104 High Definition Audio vendor: PNY
driver: snd_hda_intel v: kernel bus-ID: 5-1.1:4 pcie: chip-ID: 0499:170f
gen: 3 class-ID: 0103 speed: 8 GT/s lanes: 16 link-max: gen: 4
speed: 16 GT/s bus-ID: 26:00.1 chip-ID: 10de:228b class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 28:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: Yamaha Steinberg UR22mkII type: USB driver: snd-usb-audio
Device-4: Intel USB PnP Sound Device type: USB
driver: hid-generic,snd-usb-audio,usbhid bus-ID: 5-2:3 chip-ID: 8086:0808
class-ID: 0300
Sound API: ALSA v: k6.1.12-zen1-1-zen running: yes
Sound Server-1: PulseAudio v: 16.1 running: no
Sound Server-2: PipeWire v: 0.3.66 running: yes
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: f000 bus-ID: 22:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp34s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
IF-ID-1: tailscale0 state: unknown speed: -1 duplex: full mac: N/A
IF-ID-2: virbr0 state: down mac: <filter>
Device-1: TP-Link UB500 Adapter type: USB driver: btusb v: 0.8
bus-ID: 3-1.4:3 chip-ID: 2357:0604 class-ID: e001 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Local Storage: total: 4.12 TiB used: 1.49 TiB (36.2%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital model: PC SN520
SDAPNUW-512G-1014 size: 476.94 GiB block-size: physical: 512 B
logical: 512 B speed: 15.8 Gb/s lanes: 2 type: SSD serial: <filter>
rev: 20110000 temp: 40.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST2000DM008-2FR102
size: 1.82 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
type: HDD rpm: 7200 serial: <filter> rev: 0001 scheme: GPT
ID-3: /dev/sdb maj-min: 8:16 vendor: Toshiba model: HDWD120 size: 1.82 TiB
block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s type: HDD
rpm: 7200 serial: <filter> rev: ACF0 scheme: GPT
ID-4: /dev/sdc maj-min: 8:32 type: USB model: USB DISK 2.0 size: 14.44 GiB
block-size: physical: 512 B logical: 512 B type: N/A serial: <filter>
rev: PMAP scheme: MBR
SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
ID-1: / raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 95.63 GiB (20.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 608 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 95.63 GiB (20.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 95.63 GiB (20.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 476.64 GiB size: 476.64 GiB (100.00%)
used: 95.63 GiB (20.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 31.27 GiB used: 0 KiB (0.0%) priority: 100
dev: /dev/zram0
System Temperatures: cpu: 31.0 C mobo: 30.0 C gpu: nvidia temp: 50 C
Fan Speeds (RPM): fan-1: 2343 fan-2: 685 fan-3: 718 fan-4: 0 fan-5: 0
fan-6: 0 gpu: nvidia fan: 0%
Processes: 367 Uptime: 5m wakeups: 0 Memory: 31.27 GiB
used: 4.71 GiB (15.1%) Init: systemd v: 253 default: graphical
tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7 Packages: pm: pacman
pkgs: 1889 libs: 459 tools: gnome-software,octopi,pamac,paru,yay Shell: fish
v: 3.6.0 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.25
Garuda (2.6.15-1):
System install date:     2023-02-21
Last full system update: 2023-02-25
Is partially upgraded:   No
Relevant software:       snapper NetworkManager mkinitcpio nvidia-dkms
Windows dual boot:       No/Undetected
Failed units:

Hello. I somehow manage to change the /usr/bin ownership and now I'm trying to give it back to root. I receive these errors :

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
chown: changing ownership of '/usr/bin/sudo': Operation not permitted

I managed to go to recovery mode and chown root:root /usr/bin/sudo and `chmod 4755 /usr/bin/sudo , but when I type ls -l /usr/bin/sudo I receive

.rwxr-xr-x 249k root 15 фев 23:35  /usr/bin/sudo

Any ideas how to procede from here? I think the outcome should be something like -rwxr-xr-x 1 root root

Assuming that you will probably restore a snapshot, try the following, while chrooted into the root user:
sudo chown -c root --recursive /usr/bin. If the file perms are messed up as well, run chmod 4755 /usr/bin --recursive (assuming that the perms you listed above are the correct ones, I have no clue about the 4)

I tried to restore a snapshot but I cannot access BTRFS Assistant from the menu and from GRUB I received an error that sbin is missing and cannot load snapshot.

Please don't do this. That will break your system in a way that will be quite difficult to recover.

From my experience all the files in /usr/bin have the same perms, is that not correct?

Yes, that is not correct.


So.. should I try this?

I think reinstalling the package was what solved the issue in the other thread: Permission/authentification failures - #2 by jonathon

Did you try that yet?

sudo pacman -S sudo

Same error
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Is there any way of running BTRFS Assistant or some of the snaps from the terminal, because Snapper Tools and Assistant doesn't start when I try open them from the menu?

How did you
Accidently changed the /usr/bin/ ownership

1 Like

Sorry, that was stupid--of course sudo isn't going to work. :man_facepalming:

You'll have to elevate to root with su, and then try to reinstall it (pacman -S sudo).

Yes, you can restore snapshots from the command line like this: Snapper - ArchWiki

You can also boot to a live environment and restore a snapshot with Btrfs Assistant.

1 Like

By clicking right mouse button -> root actions -> ownership to Active User. I thought that I'm in other folder. :smiling_face_with_tear:
And of course, doing the same but changing ownership to root doesn't seems to be working.

1 Like