HankB
Posts: 92
Joined: Fri Jan 01, 2016 2:45 pm

[solved] I2C enable doesn't survive reboot.

Sat Nov 18, 2017 2:52 am

I've renamed the 'pi' user on Raspbian Stretch Lite. I can now enable I2C using raspi-config. As soon as I reboot, it is no longer enabled. Here is what I checked.
  • i2c-dev listed in /etc/modules
  • /etc/modprobe.d/raspi-blacklist.conf is empty
  • dtparam=i2c_arm=on set in /boot/config.txt
  • User running application is member of i2c group.

Here's what I'm experiencing

Code: Select all

hbarta@polana:~ $ lsmod|grep i2c
i2c_dev                 6849  0
hbarta@polana:~ $ sudo i2cdetect -y 1
[sudo] password for hbarta: 
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
hbarta@polana:~ $ sudo modprobe i2c_bcm2835
hbarta@polana:~ $ sudo i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
hbarta@polana:~ $ sudo raspi-config   <<<enable i2c>>>
No passwd entry for user 'pi'
No passwd entry for user 'pi'
hbarta@polana:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
hbarta@polana:~ $ lsmod|grep i2c
i2c_bcm2835             7081  0
i2c_dev                 6849  0
hbarta@polana:~ $ 
raspi-config is just a shell script. I've examined what it does and I do not see what statement is causing the "No passwd entry for user 'pi'." Nor can I tell what it is doing. Suggestions on what else needs to be done to enable i2c are most welcome! I guess I could add a 'pi' user but I'd really prefer not to do that.

thanks,
hank
Last edited by HankB on Thu Dec 07, 2017 5:30 pm, edited 1 time in total.

HankB
Posts: 92
Joined: Fri Jan 01, 2016 2:45 pm

Re: I2C enable doesn't survive reboot.

Mon Nov 20, 2017 5:01 am

I recreated the 'pi' user (but with UID/GID 1001) and reran 'raspi-config'. It no longer reports the "No passwd entry for user 'pi'" error but unfortunately the I2C enable is still not surviving a reboot. :(

If this is not the correct forum to ask this question, where should I ask?

thanks,
hank

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4142
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C enable doesn't survive reboot.

Tue Nov 21, 2017 7:26 pm

HankB wrote: I recreated the 'pi' user (but with UID/GID 1001) and reran 'raspi-config'. It no longer reports the "No passwd entry for user 'pi'" error but unfortunately the I2C enable is still not surviving a reboot. :(
If this is not the correct forum to ask this question, where should I ask?
thanks,
hank
Please be patient - this is the "correct forum" but requires a registered user who has possibly tried (to repeat) what you report and has observed similar (or different) results to be "on-line" - currently only ~2%** of folks using the forum are registered and are able to respond (if they think they can help). I've not observed your issue but I would not have expected to, since I have no need to "delete" the pi user. Did you ensure that your "replacement" user for user pi was a member of all the same groups as pi?
Trev.
** From the boards "footer":

Code: Select all

 
 In total there are 1121 users online :: 19 registered, 1 hidden and 1101 guests (based on users active over the past 5 minutes)
Most users ever online was 1834 on Sun Feb 08, 2015 3:03 pm

Registered users: Baidu [Spider], Bing [Bot], cmwester81, FTrevorGowen, Google [Bot], Google Feedfetcher, Guidoh, hippy, jardino, Kruu, marc_knuckle, MH2, millarjp, Paul Webster, Pawel77, Samuel1982, sandromaio, SoylentGraham, YaCy [Bot], Yahoo [Bot]
Legend: Administrators, Global moderators	

Total posts 1190664 • Total topics 175583 • Total members 217167 • Our newest member Bouncer!95 
Usually running Raspbian Jessie on up to 9 of 13 Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) and Stretch on my P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

HankB
Posts: 92
Joined: Fri Jan 01, 2016 2:45 pm

Re: I2C enable doesn't survive reboot.

Wed Nov 22, 2017 2:55 am

Hi Trevor,
Thank you for the reply. I just double checked and all groups matched.

Code: Select all

hbarta@polana:~ $ egrep "hbarta|pi" /etc/group
adm:x:4:hbarta,pi
dialout:x:20:hbarta,pi
cdrom:x:24:hbarta,pi
sudo:x:27:hbarta,pi
audio:x:29:hbarta,pulse,pi
video:x:44:hbarta,pi
plugdev:x:46:hbarta,pi
games:x:60:hbarta,pi
users:x:100:hbarta,pi
input:x:101:hbarta,pi
netdev:x:108:hbarta,pi
hbarta:x:1000:
spi:x:999:hbarta,pi
i2c:x:998:hbarta,pi
gpio:x:997:hbarta,pi
wireshark:x:119:hbarta,pi
pi:x:1001:
hbarta@polana:~ $ 
I'm pretty sure I logged out and logged in before running raspi-config (so the group additions would be effective) but just to be certain I tried it again. The result was the same - no I2C until I enabled via raspi-config.

best,
hank

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4142
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C enable doesn't survive reboot.

Wed Nov 22, 2017 4:58 pm

HankB wrote:
Wed Nov 22, 2017 2:55 am
Hi Trevor,
Thank you for the reply. I just double checked and all groups matched.

Code: Select all

hbarta@polana:~ $ egrep "hbarta|pi" /etc/group
adm:x:4:hbarta,pi
dialout:x:20:hbarta,pi
cdrom:x:24:hbarta,pi
sudo:x:27:hbarta,pi
audio:x:29:hbarta,pulse,pi
video:x:44:hbarta,pi
plugdev:x:46:hbarta,pi
games:x:60:hbarta,pi
users:x:100:hbarta,pi
input:x:101:hbarta,pi
netdev:x:108:hbarta,pi
hbarta:x:1000:
spi:x:999:hbarta,pi
i2c:x:998:hbarta,pi
gpio:x:997:hbarta,pi
wireshark:x:119:hbarta,pi
pi:x:1001:
hbarta@polana:~ $ 
I'm pretty sure I logged out and logged in before running raspi-config (so the group additions would be effective) but just to be certain I tried it again. The result was the same - no I2C until I enabled via raspi-config.
best,
hank
I use a different method to check user pi's groups etc.:

Code: Select all

pi@raspiP3BStretch16Gb:~ $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi)
(which appears to be consistent with yours)
Trev.
(temporarily logged in via a P3B :-) )
Usually running Raspbian Jessie on up to 9 of 13 Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) and Stretch on my P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

HankB
Posts: 92
Joined: Fri Jan 01, 2016 2:45 pm

Re: I2C enable doesn't survive reboot.

Thu Dec 07, 2017 5:29 pm

Smashed it! It turns out that it was not related to the 'pi' user (or lack thereof.) I had been running this Pi (Model 3B) from a USB flash drive and booting from an SD card. W/out realizing the need to mount /boot from the SD card I had it mounted on the USB drive. My recollection is that I had tried to boot directly from the USB drive and at the time it did not work so I fell back to boot from SD, mount root on USB. Since then I've run 'rpi-update' and more recent firmware does boot directly from the USB drive. I2C configuration now survives a reboot.

The problem in short: 'raspi-config' did not modify files on the boot partition that was 'seen' early in the boot process. I could probably have fixed this by modifying '/etc/fstab' to mount the first partition on the SD card as '/boot'.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 12 guests