sudo:有效 uid 不是 0,/usr/bin/sudo 是否在设置了“nosuid”选项的文件系统上,还是在没有 root 权限的 NFS 文件系统上?

sudo:有效 uid 不是 0,/usr/bin/sudo 是否在设置了“nosuid”选项的文件系统上,还是在没有 root 权限的 NFS 文件系统上?

我一直在使用cronopetetimeshift在 Pop!_OS 上进行备份。cronopete/home针对timeshift整个系统。

我放入了一个新的 m.2 NVMe 驱动器,希望可以将timeshift备份恢复到空白驱动器,但事实并非如此。

我最终必须将所有内容重新安装到 Pop!_OS 的全新安装中,然后将备份/home从中复制过来cronopete

看起来它基本上起作用了,但现在我尝试这样做sudo apt install python3-virtualenv却出现了错误:

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

我遇到了以下问题,但它仍然无法帮助我解决问题。我不太清楚我需要做什么。

https://www.sudo.ws/troubleshooting.html

Q) Sudo compiles and installs OK but when I try to run it I get:
    effective uid is not 0, is /usr/local/bin/sudo on a file system with the
    'nosuid' option set or an NFS file system without root privileges?

A) The owner and permissions on the sudo binary appear to be OK but when
   sudo ran, the setuid bit did not have an effect.  There are two common
   causes for this.  The first is that the file system the sudo binary
   is located on is mounted with the 'nosuid' mount option, which disables
   setuid binaries.  The output of the "mount" command should tell you if
   the file system is mounted with the 'nosuid' option.  The other possible
   cause is that sudo is installed on an NFS-mounted file system that is
   exported without root privileges.  By default, NFS file systems are
   exported with uid 0 mapped to a non-privileged uid (usually -2).  You
   should be able to determine whether sudo is located on an NFS-mounted
   filesystem by running "df `which sudo`".

它建议运行的两个命令的输出如下:

$ mount          
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=32835804k,nr_inodes=8208951,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=6576088k,mode=755)
/dev/nvme0n1p3 on / type ext4 (rw,noatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=21104)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/nvme0n1p2 on /recovery type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/110 type tmpfs (rw,nosuid,nodev,relatime,size=6576084k,mode=700,uid=110,gid=116)
gvfsd-fuse on /run/user/110/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=110,group_id=116)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=6576084k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /run/user/1000/doc type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sda2 on /media/work/Linux Partition type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
/dev/sda1 on /media/work/Windows Backups type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
$ df `which sudo`
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/nvme0n1p3 482446164 77649084 380220452  17% /

关于如何解决这个问题有什么建议吗?

答案1

好的,这似乎已经解决了问题。主要基于此处找到的答案:

https://stackoverflow.com/questions/16682297/getting-message-sudo-must-be-setuid-root-but-sudo-is-already-owned-by-root/19306929#19306929

  1. space启动 Pop!_OS 时按住
  2. 选择Recovery,弹出操作系统安装程序
  3. SUPER + T打开终端
  4. sudo -i切换到根目录
  5. mount -o remount,rw /
  6. mount --all
  7. chown root:root /usr/bin/sudo
  8. chmod 4755 /usr/bin/sudo
  9. 重启Pop!_OS并正常登录

现在我可以运行sudo诸如此类的命令,sudo apt install python3-virtualenv到目前为止没有任何问题。

答案2

首先,通过以下方式打开 root:

$ sudo -s

然后 :

# chmod u+s /usr/bin/sudo

完毕 !

相关内容