WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Cant login as tc over UART  (Read 1050 times)

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Cant login as tc over UART
« on: September 26, 2025, 05:03:04 AM »
Hi,

ive managed to setup UART communication on my raspberry pi zero w yesterday, however ive stumbled upon weird issue.
After piCore is done booting, im prompted to login, but after entering "tc" as login username, this error gets shown:
Code: [Select]
login: can't set groups: Operation not permitted

Also, before the login prompt, this error shows up:
Code: [Select]
login: -f is for root only

which i believe is product of the autologin script?

Anyway, here are the modifications ive done, to setup uart:

cmdline.txt
Code: [Select]
earlycon=pl011,mmio32,0x20201000 ... console=ttyAMA0,115200 ...

config.txt
Code: [Select]
...
[all]
enable_uart=1
dtoverlay=disable-bt

Then i unpacked the "rootfs-piCore-16.0.gz"
Code: [Select]
gunzip -c ../rootfs-piCore-16.0.gz | cpio -id
opt/bootlocal.sh
Code: [Select]
...
 /usr/sbin/startserialtty ttyAMA0 &
...

etc/inittab
Code: [Select]
ttyAMA0::respawn:/sbin/getty -nl /sbin/autologin 115200 ttyAMA0

and finally packaged it back together
Code: [Select]
find . | cpio -o -H newc | gzip -9 > ../rootfs-piCore-16.0.gz
Im guessing, the issue lies in unpacking and packing toghether the root filesystem, causing some permission mashing? Hopefully ive provided enough information.

Thanks very much in advance...
(also i should mention im new to using piCore and tinycore in general, but i got familiar with most concepts via wiki/docs)

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1448
Re: Cant login as tc over UART
« Reply #1 on: September 26, 2025, 06:40:56 AM »
You don’t need startserial, since you are modding inittab.  I’ve not been able to get autologin to work on serial, so I don’t use it, an login works fine.

For what it’s worth, you can modify inittab in bootlocal.sh, then send init a HUP to get it to reload inittab.

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 795
Re: Cant login as tc over UART
« Reply #2 on: September 26, 2025, 07:11:49 AM »
Hello @mikpin777777lucky_!!

You seams like a great Linux user, you get it.
If you need more debugging with the uart.
I have seen you can modify the RPI firmware, so you get some text from the bootloader in uart.
But I am not sure if this is related to your RPI.

https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#bootcode-bin-uart-enable

Happy hacking/coding

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12296
Re: Cant login as tc over UART
« Reply #3 on: September 26, 2025, 08:59:30 AM »
Hi mikpin777777lucky_!!
Welcome to the forum.

I don't know if it makes any difference, but when modifying a rootfs/initrd
I always use zcat and sudo:
Code: [Select]
#   Pack/unpack rootfs.gz
#       To unpack
tc@E310:~$ mkdir tempdir
tc@E310:~$ cd tempdir
tc@E310:~/tempdir$ zcat /path/to/existing/rootfs.gz | sudo cpio -i

#       Make changes
cd ~/tempdir

#       To repack
tc@E310:~/tempdir$ sudo find . | sudo cpio -o -H newc | gzip > /path/to/new/rootfs_modified.gz

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Re: Cant login as tc over UART
« Reply #4 on: September 26, 2025, 09:13:40 AM »
Thanks for many advices (@patrikg and @Rich)! Ive already looked into enabling UART debug messages, and it seems really useful, because it logs dtoverlay status and similiar stuff...

So i commented out the line in bootlocal.sh and changed inittab to look like:
Code: [Select]
ttyAMA0::respawn:/sbin/getty -nl /bin/login 115200 ttyAMA0

but with no luck, i still get stuck here:
Code: [Select]
box login: tc
login: can't set
box login:

Am i missing something here? Thanks again

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1448
Re: Cant login as tc over UART
« Reply #5 on: September 26, 2025, 10:14:27 AM »
I'm not modifying the rootfs, this is what I have in /opt/bootlocal.sh

This is a compute module 4, so I'm using a different serial port, but you get the idea.

Code: [Select]
echo "console::respawn:/sbin/getty -L /dev/ttyAMA5 115200 vt100" >>/etc/inittab
kill -HUP 1

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 795
Re: Cant login as tc over UART
« Reply #6 on: September 26, 2025, 10:22:02 AM »
Hi @Paul_123
I think you are on the right track, with the getty.
Also think of that getty is busybox version.
I think it can't set the term type to ttyAMA0 :)

Code: [Select]
Usage: getty [OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]

Open TTY, prompt for login name, then invoke /bin/login

-h Enable hardware RTS/CTS flow control
-L Set CLOCAL (ignore Carrier Detect state)
-m Get baud rate from modem's CONNECT status message
-n Don't prompt for login name
-w Wait for CR or LF before sending /etc/issue
-i Don't display /etc/issue
-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue
-l LOGIN Invoke LOGIN instead of /bin/login
-t SEC Terminate after SEC if no login name is read
-I INITSTR Send INITSTR before anything else
-H HOST Log HOST into the utmp file as the hostname

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Re: Cant login as tc over UART
« Reply #7 on: September 26, 2025, 10:48:54 AM »
Thanks for sending snippet from your bootlocal.sh. Unfortunately my only way to interact with piCore is making changes in rootfs, because i do not own micro hdmi adapter nor adapter for an keyboard to do initial setup.

But changing inittab from bootlocal.sh seems like elegant solution, but it still results in the same error (for me).

I even tried unpacking and packing rootfs with sudo, as @Rich suggested, but also nothing :(

Command i added to my bootlocal.sh (same as @Rich sent, but with different port):
Code: [Select]
echo "console::respawn:/sbin/getty -L /dev/ttyAMA0 115200 vt100" >>/etc/inittab
« Last Edit: September 26, 2025, 10:50:53 AM by mikpin777777lucky_!! »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1448
Re: Cant login as tc over UART
« Reply #8 on: September 26, 2025, 10:54:49 AM »
What about setting up wifi.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12296
Re: Cant login as tc over UART
« Reply #9 on: September 26, 2025, 12:34:34 PM »
Hi mikpin777777lucky_!!
... Command i added to my bootlocal.sh (same as @Rich sent, but with different port):
Code: [Select]
echo "console::respawn:/sbin/getty -L /dev/ttyAMA0 115200 vt100" >>/etc/inittab
Did you remember to add:
Code: [Select]
kill -HUP 1after your echo command? Without that, inittab won't reload.

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Re: Cant login as tc over UART
« Reply #10 on: September 26, 2025, 12:45:19 PM »
Yeah yeah, ive added both lines. But setting up wifi by editing rootfs isnt entirely bad idea either :) (but having working uart in case of need feels practical).

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1448
Re: Cant login as tc over UART
« Reply #11 on: September 26, 2025, 01:11:08 PM »
Would be so much easier with a keyboard and monitor.

How are you editing bootlocal.sh.  The roots is overwritten by the copy in the backup, unless you are skipping the restoration of the backup.

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Re: Cant login as tc over UART
« Reply #12 on: September 26, 2025, 02:19:36 PM »
Soo as ive stated before, this is how i edit any configuration file in rootfs:
Code: [Select]
sudo gunzip -c ../rootfs-piCore-16.0.gz | cpio -id
nano opt/bootlocal.sh
"change stuff"
find . | cpio -o -H newc | gzip -9 > ../rootfs-piCore-16.0.gz

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1448
Re: Cant login as tc over UART
« Reply #13 on: September 26, 2025, 04:23:18 PM »
You cannot edit bootlocal.sh that way.

Bootlocal is part of the backup set that is in the mydata.tgz file on partition#2

Unless you also are using that with the norestore command line option.

Offline mikpin777777lucky_!!

  • Newbie
  • *
  • Posts: 7
    • doupe
Re: Cant login as tc over UART
« Reply #14 on: September 29, 2025, 10:41:06 AM »
Sorry for not respoding so long... ive spent weekend away from my compupter...
So whats your recommended way of changing configuration files (like for example bootlocal.sh)?