must be a superuser. unable to poweroff and shutdown as root

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

must be a superuser. unable to poweroff and shutdown as root

4,324 次查看
vijayaragavansr
Contributor II

Hi All,
am able to download the content from git now.
i built core-image-base and set root password and mounted over NFS and things are working as expected.
but when i execute the command poweroff,reboot,shutdown is asking for super user,
below is the message from terminal
root@hello:~# poweroff
poweroff: must be superuser.
root@hello:~# reboot
reboot: must be superuser.
root@hello:~# shutdown -r now
shutdown: warning: cannot open /var/run/shutdown.pid
shutdown: /dev/initctl: Permission denied
init: must be superuser.
root@hello:~# cat /etc/passwd
root:x:0:0:root:/home/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
rpc:x:999:999::/:/bin/false
avahi:x:998:998::/var/run/avahi-daemon:/bin/false
sshd:x:997:997::/var/run/sshd:/bin/false
messagebus:x:996:995::/var/lib/dbus:/bin/false
rpcuser:x:995:994::/var/lib/nfs:/bin/false
pulse:x:994:1001::/var/run/pulse:/bin/false
root@hello:~# cat /etc/shadow
root:$6$kTvdT/eRFpQ/ZDeA$tBghQG.52TsnHOxaanBo.MtKbKowBwaZtGKBdNPoW.w66xexzRcPbtHFyDO.yP04L.tnsMkcGgGSmpx3rAvMC/:17081:0:99999:7:::
daemon:*:17081:0:99999:7:::
bin:*:17081:0:99999:7:::
sys:*:17081:0:99999:7:::
sync:*:17081:0:99999:7:::
games:*:17081:0:99999:7:::
man:*:17081:0:99999:7:::
lp:*:17081:0:99999:7:::
mail:*:17081:0:99999:7:::
news:*:17081:0:99999:7:::
uucp:*:17081:0:99999:7:::
proxy:*:17081:0:99999:7:::
www-data:*:17081:0:99999:7:::
backup:*:17081:0:99999:7:::
list:*:17081:0:99999:7:::
irc:*:17081:0:99999:7:::
gnats:*:17081:0:99999:7:::
nobody:*:17081:0:99999:7:::
rpc:!:17081::::::
avahi:!:17081::::::
sshd:!:17081::::::
messagebus:!:17081::::::
rpcuser:!:17081::::::
pulse:!:17081::::::
root@hello:~# cat /etc/sudoers
## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##
##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias WEBSERVERS = www1, www2, www3
##
## User alias specification
##
## Groups of users. These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias ADMINS = millert, dowdy, mikef
##
## Cmnd alias specification
##
## Groups of commands. Often used to group related commands together.
# Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# /usr/bin/pkill, /usr/bin/top
# Cmnd_Alias REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff
##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file. Note that other programs use HOME to find
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods. Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to use a hard-coded PATH instead of the user's to find commands
# Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
##
## Uncomment to send mail if the user does not enter the correct password.
# Defaults mail_badpass
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot. Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!REBOOT !log_output
##
## Runas alias specification
##
##
## User privilege specification
##
root ALL=(ALL) ALL
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL
## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw # Ask for the password of the target user
# ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'
## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

i tried all images like core-image-base,fsl-gui-image,etc...
and this is the content of local.conf
MACHINE ??= 'imx6ulevk'
DISTRO ?= 'fsl-imx-x11'
PACKAGE_CLASSES ?= "package_rpm"
#EXTRA_IMAGE_FEATURES = "debug-tweaks"
EXTRA_IMAGE_FEATURES = "ssh-server-openssh"
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -P hello root;"
USER_CLASSES ?= "buildstats image-mklibs"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
#PACKAGECONFIG_append_pn-qemu-native = " sdl"
#PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
BUILD_LDFLAGS_prepend_pn-qemu-native = "-Wl,-rpath-link,/lib/x86_64-linux-gnu "
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"

1.  in core-image-base rootfs /etc/sudoers file not created. - How to create generate /etc/suoders file in bitbake?

0 项奖励
7 回复数

2,951 次查看
westbrook
Contributor III

Hi guys,

I met the same issue. I think this issue is caused by the extract and compress the rootfs tar package using non-root user.

I use a simply way to make the rootfs work, this is not the official resolution:

I have 3 partitions of the eMMC, p1 works fine, p3 is the issue rootfs. so I mount p3 when booting from p1. and change all the file permission of p3. This can simply resolve the "must be superuser." issue.

chmod 777 -R /p3

I can use reboot, shutdown successfully on p3.

The official resolution should be: Use the root user to extract the rootfs tar package from yocto. And compress the customized rootfs with root user as well.

I checked this resolution, it works fine. Try to use root user to work with the rootfs.

BR

Xiao

0 项奖励

2,951 次查看
alexheld
Contributor I

Hey guys,

i have the same problem as Vijayaragavan Srinivasan. I'm building my operating stack with the Poky reference distribution using https://git.yoctoproject.org/git/meta-freescale . The issue persists. I tried the answers above but it didn't help. Can you please give any further hints / support?

Thanks

0 项奖励

2,951 次查看
martin_maurer
Contributor III

I think the problem comes from NFS.

Check on NFS server, I think there are some parameters for NFS. One of it is root_squash or so,

when I remember correctly you need this one (otherwise try also the other one and/or read documentation of your NFS server in detail).

Pay attention to restart NFS server to take over the new argument, before rebooting the IMX6 with RootFs from NFS.

0 项奖励

2,951 次查看
vijayaragavansr
Contributor II

Hi,

i tried the both option at the NFS server but no luck.

/home/vijay/fsl-arm-yocto-bsp/bld-x11/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-minimal/1.0-r0/rootfs *(rw,no_root_squash)
/home/vijay/fsl-arm-yocto-bsp/bld-x11/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-base/1.0-r0/rootfs *(rw,sync,no_root_squash)

root@hello:~# poweroff
poweroff: must be superuser.
root@hello:~# reboot
reboot: must be superuser.
root@hello:~# shutdown -r now
shutdown: warning: cannot open /var/run/shutdown.pid
shutdown: /dev/initctl: Permission denied
init: must be superuser.

same result.

any help please....

0 项奖励

2,951 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Vijayaragavan

please try to test it with Demo Images

http://www.nxp.com/webapp/Download?colCode=L4.1.15_1.1.0_iMX6UL&appType=license&location=null&Parent... 

Documentation

http://www.nxp.com/webapp/Download?colCode=L4.1.15_1.1.0_LINUX_DOCS&Parent_nodeId=133769948107170617... 

then one can build own image using steps provided in Freescale_Yocto_Project_User's_Guide.pdf

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励

2,951 次查看
vijayaragavansr
Contributor II

Hi  igorpadykov,

Thanks for quick reply. its all working well with demo images. I followed the  instruction given in the Freescale_Yocto_Project_User's_Guide.pdf to build image. After the build i booted everything via NFS then i have this problem. please kindly help to overcome.am clueless here.

i have problem with only those set of commands like poweroff,reboot,shutdown...

what am missing in the build?

what script to be added and where to have the complete privilage to root account?

Thanks

Vijay

0 项奖励

2,950 次查看
vijayaragavansr
Contributor II

Hi All,

is the problem of building the rootfs? or the yocto project?  what is the configuration to be done in the local.config to have the full acceess to the root user? please help to overcome this issue.

Thanks

Vijay

0 项奖励