LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   accidentally delete python3 in /usr/bin (https://www.linuxquestions.org/questions/fedora-35/accidentally-delete-python3-in-usr-bin-4175675450/)

AlanRyu 05-18-2020 02:11 AM

accidentally delete python3 in /usr/bin
 
Hi techleads!

Plz help me!!! I am so desperate now!! I accidentally delete python3 in /usr/bin and this is what happened:
[Ra@localhost bin]$ sudo pip3 install requests beautifulsoup4 lxml termcolor pythonping dnspython
sudo: unable to execute /usr/local/bin/pip3: No such file or directory
[Ra@localhost bin]$ cd /usr/bin/pip
bash: cd: /usr/bin/pip: No such file or directory
[Ra@localhost bin]$ sudo dnf remove python
sudo: unable to execute /usr/bin/dnf: No such file or directory
[Ra@localhost bin]$ sudo yum remove python
sudo: unable to execute /usr/bin/yum: No such file or directory
[Ra@localhost ~]$ python
bash: python: command not found...

Here are some output of commands that may be helpful..
[Ra@localhost bin]$ ll
lrwxrwxrwx. 1 root root 8 Mar 3 00:42 pydoc -> ./pydoc3
lrwxrwxrwx. 1 root root 8 Mar 3 00:42 pydoc3 -> pydoc3.8
-rwxr-xr-x. 1 root root 78 Mar 3 00:42 pydoc3.8
-rwxr-xr-x. 1 root root 392 Jan 30 23:48 pyinotify
lrwxrwxrwx. 1 root root 9 Mar 3 01:05 python -> ./python3
lrwxrwxrwx. 1 root root 16 May 18 16:22 python3.6 -> /usr/bin/python3
-rwxr-xr-x. 1 root root 15408 Mar 3 00:42 python3.8
-rwxr-xr-x. 1 root root 2558 Jan 30 21:45 python-argcomplete-check-easy-install-script
-rwxr-xr-x. 1 root root 318 Jan 30 21:45 python-argcomplete-tcsh

[Ra@localhost bin]$ rpm -q dnf python3-dnf python3 python3-rpm
dnf-4.2.21-1.fc32.noarch
python3-dnf-4.2.21-1.fc32.noarch
python3-3.8.2-2.fc32.x86_64
python3-rpm-4.15.1-3.fc32.1.x86_64
[Ra@localhost bin]$ rpm -q --requires python3-dnf | grep python
/usr/bin/python3
python(abi) = 3.8
python3-gpg
python3-hawkey >= 0.46.2
python3-libcomps >= 0.1.8
python3-libdnf
python3-libdnf >= 0.46.2
python3-rpm >= 4.14.0
[Ra@localhost bin]$ rpm -q --requires python3-rpm | grep python
python(abi) = 3.8

[Ra@localhost bin]$ type -p dnf
/usr/bin/dnf
[Ra@localhost bin]$ sudo rpm --verify --all
.......T. /boot/efi/EFI/BOOT/BOOTIA32.EFI
.......T. /boot/efi/EFI/BOOT/fbia32.efi
.......T. /boot/efi/EFI/fedora/BOOTIA32.CSV
.......T. /boot/efi/EFI/fedora/mmia32.efi
.......T. /boot/efi/EFI/fedora/shimia32-fedora.efi
.......T. /boot/efi/EFI/fedora/shimia32.efi
.M....... g /run/lock/ppp
.M....... g /run/ppp
.M....... c /etc/fstab
.M....G.. g /var/log/lastlog
.M....... g /boot/System.map-5.6.10-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.10-300.fc32.x86_64.img
.......T. /lib/modules/5.6.10-300.fc32.x86_64/modules.builtin.alias.bin
.M....... c /etc/machine-id
.M....... g /var/log/btmp
.M....G.. g /var/log/journal
.M....... g /var/lock/iscsi
.M....... g /var/lock/iscsi/lock
.M....... g /var/lib/snapd/snap/README
.M....... g /var/lib/snapd/state.json
.......T. /boot/efi/EFI/fedora/grubia32.efi
missing /usr/bin/python3
.M....... /boot/efi/System
.M....... /boot/efi/System/Library
.M....... /boot/efi/System/Library/CoreServices
.M.....T. /boot/efi/System/Library/CoreServices/SystemVersion.plist
.M.....T. /boot/efi/mach_kernel
.M....... g /boot/System.map-5.6.11-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.11-300.fc32.x86_64.img
.......T. /lib/modules/5.6.11-300.fc32.x86_64/modules.builtin.alias.bin
.M....... g /boot/System.map-5.6.12-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.12-300.fc32.x86_64.img
.......T. /lib/modules/5.6.12-300.fc32.x86_64/modules.builtin.alias.bin
S.5....T. c /var/lib/unbound/root.key
....L.... c /etc/pam.d/fingerprint-auth
....L.... c /etc/pam.d/password-auth
....L.... c /etc/pam.d/postlogin
....L.... c /etc/pam.d/smartcard-auth
....L.... c /etc/pam.d/system-auth
SM5....T. c /etc/crypto-policies/back-ends/nss.config
.M....G.. g /etc/brlapi.key
....L.... c /etc/nsswitch.conf
.......T. /boot/efi/EFI/fedora/gcdia32.efi
.M....... /var/lib/AccountsService/icons
.M....... g /run/dbus
.M....... g /var/lib/plymouth/boot-duration
.......T. /boot/efi/EFI/BOOT/BOOTX64.EFI
.......T. /boot/efi/EFI/BOOT/fbx64.efi
.......T. /boot/efi/EFI/fedora/BOOTX64.CSV
.......T. /boot/efi/EFI/fedora/mmx64.efi
.......T. /boot/efi/EFI/fedora/shim.efi
.......T. /boot/efi/EFI/fedora/shimx64-fedora.efi
.......T. /boot/efi/EFI/fedora/shimx64.efi
.M....G.P /usr/sbin/tcpdump
.......T. c /etc/selinux/targeted/contexts/customizable_types
..5....T. /var/lib/selinux/targeted/active/commit_num
S.5....T. /var/lib/selinux/targeted/active/file_contexts
S.5....T. /var/lib/selinux/targeted/active/homedir_template
S.5....T. /var/lib/selinux/targeted/active/policy.kern
.......T. /var/lib/selinux/targeted/active/seusers
.......T. /var/lib/selinux/targeted/active/users_extra
.M....G.. g /var/log/lastlog
S.5....T. c /etc/sudoers
.M....... g /etc/udev/hwdb.bin
.M....... c /etc/vconsole.conf
.M....... g /var/lib/systemd/random-seed
.M....... /boot/efi/EFI
S.5....T. c /etc/cups/cups-browsed.conf
....L.... c /etc/nsswitch.conf
.M....... g /var/lib/dnf
.M....... g /var/log/dnf.librepo.log
.M....... g /var/log/hawkey.log
.M....G.. /var/log/gdm
.....UG.. g /var/run/avahi-daemon
missing /run/gluster/metrics
[Ra@localhost bin]$ sudo rpm --verify --all
.......T. /boot/efi/EFI/BOOT/BOOTIA32.EFI
.......T. /boot/efi/EFI/BOOT/fbia32.efi
.......T. /boot/efi/EFI/fedora/BOOTIA32.CSV
.......T. /boot/efi/EFI/fedora/mmia32.efi
.......T. /boot/efi/EFI/fedora/shimia32-fedora.efi
.......T. /boot/efi/EFI/fedora/shimia32.efi
.M....... g /run/lock/ppp
.M....... g /run/ppp
.M....... c /etc/fstab
.M....G.. g /var/log/lastlog
.M....... g /boot/System.map-5.6.10-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.10-300.fc32.x86_64.img
.......T. /lib/modules/5.6.10-300.fc32.x86_64/modules.builtin.alias.bin
.M....... c /etc/machine-id
.M....... g /var/log/btmp
.M....G.. g /var/log/journal
.M....... g /var/lock/iscsi
.M....... g /var/lock/iscsi/lock
.M....... g /var/lib/snapd/snap/README
.M....... g /var/lib/snapd/state.json
.......T. /boot/efi/EFI/fedora/grubia32.efi
missing /usr/bin/python3
.M....... /boot/efi/System
.M....... /boot/efi/System/Library
.M....... /boot/efi/System/Library/CoreServices
.M.....T. /boot/efi/System/Library/CoreServices/SystemVersion.plist
.M.....T. /boot/efi/mach_kernel
.M....... g /boot/System.map-5.6.11-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.11-300.fc32.x86_64.img
.......T. /lib/modules/5.6.11-300.fc32.x86_64/modules.builtin.alias.bin
.M....... g /boot/System.map-5.6.12-300.fc32.x86_64
.M....... g /boot/initramfs-5.6.12-300.fc32.x86_64.img
.......T. /lib/modules/5.6.12-300.fc32.x86_64/modules.builtin.alias.bin
S.5....T. c /var/lib/unbound/root.key
....L.... c /etc/pam.d/fingerprint-auth
....L.... c /etc/pam.d/password-auth
....L.... c /etc/pam.d/postlogin
....L.... c /etc/pam.d/smartcard-auth
....L.... c /etc/pam.d/system-auth
SM5....T. c /etc/crypto-policies/back-ends/nss.config
.M....G.. g /etc/brlapi.key
....L.... c /etc/nsswitch.conf
.......T. /boot/efi/EFI/fedora/gcdia32.efi
.M....... /var/lib/AccountsService/icons
.M....... g /run/dbus
.M....... g /var/lib/plymouth/boot-duration
.......T. /boot/efi/EFI/BOOT/BOOTX64.EFI
.......T. /boot/efi/EFI/BOOT/fbx64.efi
.......T. /boot/efi/EFI/fedora/BOOTX64.CSV
.......T. /boot/efi/EFI/fedora/mmx64.efi
.......T. /boot/efi/EFI/fedora/shim.efi
.......T. /boot/efi/EFI/fedora/shimx64-fedora.efi
.......T. /boot/efi/EFI/fedora/shimx64.efi
.M....G.P /usr/sbin/tcpdump
.......T. c /etc/selinux/targeted/contexts/customizable_types
..5....T. /var/lib/selinux/targeted/active/commit_num
S.5....T. /var/lib/selinux/targeted/active/file_contexts
S.5....T. /var/lib/selinux/targeted/active/homedir_template
S.5....T. /var/lib/selinux/targeted/active/policy.kern
.......T. /var/lib/selinux/targeted/active/seusers
.......T. /var/lib/selinux/targeted/active/users_extra
.M....G.. g /var/log/lastlog
S.5....T. c /etc/sudoers
.M....... g /etc/udev/hwdb.bin
.M....... c /etc/vconsole.conf
.M....... g /var/lib/systemd/random-seed
.M....... /boot/efi/EFI
S.5....T. c /etc/cups/cups-browsed.conf
....L.... c /etc/nsswitch.conf
.M....... g /var/lib/dnf
.M....... g /var/log/dnf.librepo.log
.M....... g /var/log/hawkey.log
.M....G.. /var/log/gdm
.....UG.. g /var/run/avahi-daemon
missing /run/gluster/metrics

[Ra@localhost bin]$ yum-deprecated
bash: yum-deprecated: command not found...

HELP!!!!!!!!!!!!!!!!!!!!

shruggy 05-18-2020 10:33 AM

Quote:

Originally Posted by AlanRyu (Post 6124474)
[Ra@localhost bin]$ ll
lrwxrwxrwx. 1 root root 8 Mar 3 00:42 pydoc -> ./pydoc3
lrwxrwxrwx. 1 root root 8 Mar 3 00:42 pydoc3 -> pydoc3.8
-rwxr-xr-x. 1 root root 78 Mar 3 00:42 pydoc3.8
-rwxr-xr-x. 1 root root 392 Jan 30 23:48 pyinotify
lrwxrwxrwx. 1 root root 9 Mar 3 01:05 python -> ./python3
lrwxrwxrwx. 1 root root 16 May 18 16:22 python3.6 -> /usr/bin/python3
-rwxr-xr-x. 1 root root 15408 Mar 3 00:42 python3.8
-rwxr-xr-x. 1 root root 2558 Jan 30 21:45 python-argcomplete-check-easy-install-script
-rwxr-xr-x. 1 root root 318 Jan 30 21:45 python-argcomplete-tcsh

Looks like /usr/bin/python3.8 is still there. You probably just removed the symlink. Then
Code:

cd /usr/bin
sudo ln -s python3.8 python3


pan64 05-18-2020 11:16 AM

I do not really understand what you posted (why did you do that, what did you try ...) and what's happened at all.
Do not try to remove python3. Now probably you can download that package, pick that file and put it into /usr/bin (por just try to force reinstall).
But as far as I see there can be other problems too...


All times are GMT -5. The time now is 07:10 PM.