Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/dev/null permission denied to root [SOLVED]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 9:23 am    Post subject: /dev/null permission denied to root [SOLVED] Reply with quote

Hi to all gentoo guys, i'm an newbie of this s.o. and on the this forum (i normally work with windows in a meccatronics and automation context) but I'd like to start to work on a linux distribution with some of my application (with a VM on virtualbox).
I trust you will have patience because I am not an expert (this is my fifth day of work with linux): :roll: .

After an installation finding the official install guide (my gentoo is a VM guest on VirtualBox and windows host) i become to use the distro and create a user to understand how the system work on users, groups and this type of arguments (the coveted bases).
When i've try do make an emerge app-admin/sudo i can't complete the installation of the package because i saw that:
Code:
ls -l /dev/null
brw-rw----   1 [b]root[/b] disk    8,   7 Sep 27 20:13 sda7

so i post this problem before on italian gentoo forum (yes, i'm italian) and the guys of that forum section were very helpful and kind to help me to understand the problem, installing the package by arranging some things including the permissions of the /dev/null directory. Unfortunately every time i reboot the system the /dev/null permissions settings are restored as above and we can't understand why.
We have try this solution:
Code:
# rm  /dev/null
# mknod -m 666 /dev/null c 1 3

but without solving.

For myself i've googled about the problem and i've read about this file /etc/fstab, if it's modified you can corrupt the permission functioning and this was one of my modification to include the shared folder from host-guest auto mounting, here the link of my /etc/fstab file:

https://pastebin.com/VX5CEx6u
and the content fo /etc/udev/rules.d/60-vboxadd.rules file:
Code:
KERNEL=="vboxguest", NAME="vboxguest", OWNER="vboxadd", MODE="0660"
KERNEL=="vboxuser", NAME="vboxuser", OWNER="vboxadd", MODE="0666"


Thanks in advance to anyone who wanted to help me.

P.S. There's a documentation about the logic (some master log file or what?)to use to investigate about the 'portage & programming' problem?


Last edited by cesma on Mon Jan 15, 2018 6:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 10:21 am    Post subject: Reply with quote

cesma,

Your /dev/null is broken.

Code:
ls -l /dev/null
brw-rw----   1 root disk    8,   7 Sep 27 20:13 sda7


It should be
Code:
ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 May 12  2013 /dev/null


You have a block device that points /dev/null to /dev/sda7. If that worked, your sda7 has been overwritten.
/dev/null should be a character device that everyone can write to.

As /dev is in tmpfs, which is a piece of RAM, a reboot should fix it. The RAM will be rewritten.
If its not fixed, we will need to find what is creating /dev/null incorrectly.

You can use mknod as a temporary fix. Anything you do with mknod will drop out at the next boot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 11:08 am    Post subject: Reply with quote

Hi NeddySeagoon thx for your support, i've read many of your old thread, you always have good intuitions. 8O

Ok i've proceed with a rebbot but /dev/null is returned with the same problem.


This is the output of my emerge --info command : https://pastebin.com/FK48LjhD


Last edited by cesma on Mon Jan 15, 2018 2:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 11:15 am    Post subject: Reply with quote

cesma,

Something is overwriting the correct /dev/null.
I suspect that the something is udev due to an incorrect udev rule.

Is /dev/sda7 your root filesystem?
You should get a /dev/root symbolic link that points to /dev/sd... whatever your root is.

Use wgetpaste to put all of dmesg onto a pastebin site and post the link.
There may be hints there.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 1:14 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

Something is overwriting the correct /dev/null.
I suspect that the something is udev due to an incorrect udev rule.

Is /dev/sda7 your root filesystem?
You should get a /dev/root symbolic link that points to /dev/sd... whatever your root is.

Use wgetpaste to put all of dmesg onto a pastebin site and post the link.
There may be hints there.


First of all Neddy the concept you espone to me is understood but you speak to me of /dev/sda7 but when i control the /etc/fstab file i don't see any /dev/sda7 but only :

Code:
/dev/sda2   /boot        ext4    defaults,noatime     0 2
/dev/sda3   none         swap    sw                   0 0
/dev/sda4   /            ext4    noatime              0 1
 
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0 
 
#VirtualBox shared folder autoloading
Linux_Gentoo /mnt/scambio_vbox vboxsf defaults 0 0
[/code]



    /dev/sda1 ---> Bios boot partition 2M;
    /dev/sda2 ---> Boot partition ext4 128M;
    /dev/sda3 ---> Swap 2G
    /dev/sda4 ---> Root ext4 27G


where is the /dev/sda7 of you are speaking about?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 2:25 pm    Post subject: Reply with quote

cesma,

Your original post contains
Code:
ls -l /dev/null
brw-rw----   1 [b]root[/b] disk    8,   7 Sep 27 20:13 sda7   


This shows that your /dev/null is being overwritten by the correct entry for /dev/sda7.
We don't yet know how or why.

Please put your dmesg onto a pastebin, There may be something there.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 3:16 pm    Post subject: Reply with quote

Sorry Neddy but during this thread i'm in a startup VLC session.

Ok now i've see and understand.

This is the output ---> https://pastebin.com/SgSGxm8q
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 3:27 pm    Post subject: Reply with quote

Sorry Neddy but mabe i've post a wrong output because now:

Code:
#ls -l /dev/null
crw-rw---- 1 root root 1, 3 13 gen /dev/null


this thing of /dev/sda7 don't ring well to my hears infact date is completely wrong sorry. :oops:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 3:42 pm    Post subject: Reply with quote

cesma,

Code:
ls -l /dev/null
crw-rw---- 1 root root 1, 3 13 gen /dev/null
is almost correct.
Its missing the rw permissions for non root users.

The entries in /dev are created by the kernel. That's what the DEVTMPFS kernel configuration option does.
The permissions are adjusted by udev after the kernel has created the /dev entry.

Is udev actually running?
Did it crash?

What does
Code:
ps -Alf | grep udev
5 S root       653     1  0  80   0 -  5888 SyS_ep Jan14 ?        00:00:00 /sbin/udevd --daemon
0 S root      7602  7595  0  80   0 -  1724 -      15:40 pts/3    00:00:00 grep --colour=auto udev
show?

/sbin/udevd --daemon is the important bit.
If that's missing, udev is not running, so it can't correct the permissions in /dev.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 4:06 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

Code:
ls -l /dev/null
crw-rw---- 1 root root 1, 3 13 gen /dev/null
is almost correct.
Its missing the rw permissions for non root users.

The entries in /dev are created by the kernel. That's what the DEVTMPFS kernel configuration option does.
The permissions are adjusted by udev after the kernel has created the /dev entry.

Is udev actually running?
Did it crash?

What does
Code:
ps -Alf | grep udev
5 S root       653     1  0  80   0 -  5888 SyS_ep Jan14 ?        00:00:00 /sbin/udevd --daemon
0 S root      7602  7595  0  80   0 -  1724 -      15:40 pts/3    00:00:00 grep --colour=auto udev
show?

/sbin/udevd --daemon is the important bit.
If that's missing, udev is not running, so it can't correct the permissions in /dev.



my output is:
Code:
ps -Alf | grep udev
0 S root      4278  4177  0  80   0 -  1579 pipe_w 00:48 pts/0    00:00:00 grep --colour=auto


No /sbin/udevd --daemon for me. How can i proceed?


Last edited by cesma on Mon Jan 15, 2018 4:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 6839

PostPosted: Mon Jan 15, 2018 4:09 pm    Post subject: Reply with quote

Code:
/etc/init.d/devfs:   [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3

Code:
rc-update | grep devfs
                devfs |                                        sysinit
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 4:27 pm    Post subject: Reply with quote

krinn wrote:
Code:
/etc/init.d/devfs:   [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3

Code:
rc-update | grep devfs
                devfs |                                        sysinit


Hi krinn,

i need some clarifications:

    1 - /etc/init.d/devfs: [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3 this declaration it's already present under seed_dev() function, you want that i add this line at the top of the fiel or what?
    2 -
    Code:
    rc-update | grep devfs
                    devfs |                                        sysinit


    is/are one or two differents commands?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 4:32 pm    Post subject: Reply with quote

cesma,

Did udev crash or was it never started?

Code:
# rc-update show | grep udev
                 udev |                                 sysinit
         udev-trigger |                                 sysinit
shows udev and udev-trigger in the sysinit runlevel, which is correct.
The stage3 sets this up for you.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 4:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

Did udev crash or was it never started?

Code:
# rc-update show | grep udev
                 udev |                                 sysinit
         udev-trigger |                                 sysinit
shows udev and udev-trigger in the sysinit runlevel, which is correct.
The stage3 sets this up for you.


I suppose it never started because i don't have any output if i type rc-update show | grep udev. 8O
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 4:54 pm    Post subject: Reply with quote

cesma,

We need to check that you are actually intending to use OpenRC before we try to fix that.
Please post the output of
Code:
emerge --info


Your dmesg does not indicate which init system you have in use.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 6839

PostPosted: Mon Jan 15, 2018 5:08 pm    Post subject: Reply with quote

cesma wrote:
i need some clarifications:

Yes, sorry i didn't had time when i answer this to gave more than that, but it wasn't really for you (i have saw your new to linux and gentoo), more a hint for NeddySeagoon that devfs is the one that set the permissions on /dev/null.
Which imply, if devfs is not start, the /dev/null permissions are not set.

If you want the real explain i should had gave earlier:
you can do rc-update | grep devfs and the correct answer to this is that you should seen: devfs is 1/ present 2/ run in sysinit runlevel

but as simple as it is, i didn't had time earlier except copy/paste
i should had keep it for later when i could explain what i mean behind this, as this create more confusion to you and wasn't then helping as i think i was.


Last edited by krinn on Mon Jan 15, 2018 5:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 5:09 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

We need to check that you are actually intending to use OpenRC before we try to fix that.
Please post the output of
Code:
emerge --info


Your dmesg does not indicate which init system you have in use.



emerge --info ---> https://pastebin.com/U5VBf93F
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 5:20 pm    Post subject: Reply with quote

cesma,

Good.
Code:
sys-apps/openrc:          0.34.11::gentoo


Try
Code:
rc-update add udev sysinit
rc-update add udev-trigger sysinit


If there are no errors, reboot and tell what happens.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 6:27 pm    Post subject: Reply with quote

Ok ,i' m here and now it work i've verify /sbin/udevd --daemon bit it's set, same for
rc-update | grep devfs and finally my /dev/null permissions are ok.

Can you help me to understand what was wrong in my installation?
I'd like to improve my knowledge about this architecture but when i become to approach the documentation i beginning to jump from an argument to another, which may be the approach? I have not looked at the English forum, but if you would like to show me an appropriate starting point for my poor knowledge, I would be grateful.

I'll change the title in [solved] and give the link of this solution to my italian forum friends, thank you Neddy.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 795

PostPosted: Mon Jan 15, 2018 6:40 pm    Post subject: Reply with quote

Shot in the dark that the root filesystem (on /dev/sda4) has a "dev/nul" entry already. I've had to create what end up being /dev/null and /dev/console in order to get the system to boot. I create them from a sysrescue boot, looking at what I mount as /mnt/genoo. The "made from scratch" entries are therefore at /mnt/gentoo/dev/null and /mnt/gentoo/dev/console.

If udev isn't running, /dev/null must exist on the filesystem.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 7:41 pm    Post subject: Reply with quote

cesma,

When your system starts, the kernels devtmpfs populates /dev.
The kernel doesn't care about permissions. It does everything as root, including starting udev.

When udev starts it gets an event for every entry in /dev and runs its rule set to create symbolic links, change permission and so on.
The kernel creates /dev/null without any access for users. udev changes that when it processes the event related to the creation of /dev/null.

What services are in what runlevel are listed in /etc/runlevels Try
Code:
ls -R /etc/runlevels

I suspect that udev and/or udev-trigger were removed from the sysinit runlevel somehow.

Its also possible that the stage3 file you used has a bug because those settings should have been in the stage3.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 8:41 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

When your system starts, the kernels devtmpfs populates /dev.
The kernel doesn't care about permissions. It does everything as root, including starting udev.

When udev starts it gets an event for every entry in /dev and runs its rule set to create symbolic links, change permission and so on.
The kernel creates /dev/null without any access for users. udev changes that when it processes the event related to the creation of /dev/null.

What services are in what runlevel are listed in /etc/runlevels Try
Code:
ls -R /etc/runlevels

I suspect that udev and/or udev-trigger were removed from the sysinit runlevel somehow.

Its also possible that the stage3 file you used has a bug because those settings should have been in the stage3.


This is my output:

Code:

ls -R /etc/runlevels
/etc/runlevels:
boot default nonetwork shutdown sysinit

/etc/runlevels/boot:
binfmt   hostname localmount mtab               root   termencoding
bootmisc hwclock  loopback   opentmpfiles-setup swap   urandom
fsck     keymaps  modules    procfs             sysctl

/etc/runlevels/default:
cronie local net.eth0 netmount sshd sysklogd vboxadd vboxadd-service

/etc/runlevels/nonetwork:
local

/etc/runlevels/shutdown:
killprocs mount-ro savecache

/etc/runlevels/sysinit:
devfs dmesg kmod-static-nodes opentmpfiles-dev sysfs udev udev-trigger


Hey Neddy and what can you tell me about my need to have a more organized way to start to deepen
the basics of the system? Any source on the forum or not (books) to which you can report me?


Last edited by cesma on Mon Jan 15, 2018 8:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 8:57 pm    Post subject: Reply with quote

cesma,

That looks OK. Be aware that there is no correct list.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cesma
n00b
n00b


Joined: 08 Jan 2018
Posts: 61

PostPosted: Mon Jan 15, 2018 9:00 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cesma,

That looks OK. Be aware that there is no correct list.


Hey Neddy and what can you tell me about my need to have a more organized way to start to deepen
the basics of the system? Any source on the forum or not (books) to which you can report me?
I would like to be able to get to analyze the system as you do.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41405
Location: 56N 3W

PostPosted: Mon Jan 15, 2018 9:15 pm    Post subject: Reply with quote

cesma,

My skill set comes from experience. Experience is what you get just after you needed it. :)
I've been playing with computers since I was about 10 years old. That's over 50 years ago now.
At that time I was probably the only one in a school of about 1100 to have computer programming as a hobby.

I also used to work with problem solving on embedded systems. No screen or keyboard.
The methods there apply to Gentoo too.

1. Build on what you know works
2. Keep the problem space small.
3. Develop a theory, then change one thing to test the theory.
3a) Repeat 3 until you understand the problem, modifying the theory when the test results don't support it.

If you change several things at the same time its difficult to unravel the effects.

I'll reccommend Linux Sea. I'm not sure if there is a dead tree version.
The author is a Gentoo developer.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum