sipeed / LonganPi-3H-SDK

LonganPi 3H SDK
GNU General Public License v3.0
28 stars 14 forks source link

firstboot.service not working #23

Open DanilinSA opened 6 months ago

DanilinSA commented 6 months ago

firstboot.service is not working. There is no user in the system.

Possible solution: when creating rootfs you need to delete /etc/machine-id

wu-yue-yu commented 6 months ago

Which version of the image are u using? The 20240226?

DanilinSA commented 6 months ago

My system:

Distributor ID: Ubuntu
Description: Ubuntu 23.10
Release: 23.10

Today I tried to collect a clean image for testing. Updated the repository. But now I have an error on the command "./mklinux.sh"

danilin@TestPC:~/LonganPi-3H-SDK$ ./mklinux.sh
+ '[' '!' -e build/linux ']'
+ git clone https://mirrors.bfsu.edu.cn/git/linux.git build/linux --branch=master
Клонирование в «build/linux»…
remote: Enumerating objects: 9993289, done.
remote: Total 9993289 (delta 0), reused 0 (delta 0), pack-reused 9993289
Получение объектов: 100% (9993289/9993289), 2.04 ГиБ | 7.58 МиБ/с, готово.
Определение изменений: 100% (8518677/8518677), готово.
Updating files: 100% (83472/83472), готово.
+ cd build/linux
+ git checkout 3b47bc037bd44f142ac09848e8d3ecccc726be99
Updating files: 100% (12578/12578), готово.
Примечание: переключение на «3b47bc037bd44f142ac09848e8d3ecccc726be99».

HEAD сейчас на 3b47bc037bd4 Merge tag 'pinctrl-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
+ find ../../linux/ -name '*.patch'
+ sort
+ read line
find: ‘../../linux/’: Нет такого файла или каталога
+ cd ../../
+ cd build/linux
+ export ARCH=arm64
+ ARCH=arm64
++ pwd
+ export INSTALL_PATH=/home/danilin/LonganPi-3H-SDK/build/linux/_install/boot/
+ INSTALL_PATH=/home/danilin/LonganPi-3H-SDK/build/linux/_install/boot/
++ pwd
+ export INSTALL_MOD_PATH=/home/danilin/LonganPi-3H-SDK/build/linux/_install/
+ INSTALL_MOD_PATH=/home/danilin/LonganPi-3H-SDK/build/linux/_install/
+ rm -rf /home/danilin/LonganPi-3H-SDK/build/linux/_install/boot/
+ rm -rf /home/danilin/LonganPi-3H-SDK/build/linux/_install/
+ mkdir -p /home/danilin/LonganPi-3H-SDK/build/linux/_install/boot/
+ mkdir -p /home/danilin/LonganPi-3H-SDK/build/linux/_install/
+ make mrproper
+ make longanpi_3h_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
***
*** Can't find default configuration "arch/arm64/configs/longanpi_3h_defconfig"!
***
make[2]: *** [scripts/kconfig/Makefile:94: longanpi_3h_defconfig] Ошибка 1
make[1]: *** [/home/danilin/LonganPi-3H-SDK/build/linux/Makefile:685: longanpi_3h_defconfig] Ошибка 2
make: *** [Makefile:234: __sub-make] Ошибка 2
wu-yue-yu commented 6 months ago

It seems that the patches are not applied to kernel correctly. You can remove the build/linux directory and run mklinux.sh again.

DanilinSA commented 6 months ago

Today everything came together without errors.

Noticed that the command "./mkrootfs.sh" requires sudo Otherwise we get an error:

D: 1 1803 suite: unstable
D: 1 1803 target: /home/danilin/LonganPi-3H-SDK/sid
D: 1 1803 variant: important
E: cannot create /home/danilin/LonganPi-3H-SDK: Permission denied; cannot create /home/danilin/LonganPi-3H-SDK/sid: Permission denied; cannot create /home/danilin/LonganPi-3H-SDK/sid//etc: Permission denied; cannot create /home/danilin/LonganPi-3H-SDK/sid//etc/apt: Permission denied; cannot create /home/danilin/LonganPi-3H-SDK/sid//etc/apt/apt.conf.d: Permission denied at /usr/bin/mmdebstrap line 192.
    main::error("cannot create /home/danilin/LonganPi-3H-SDK: Permission denie"...) called at /usr/bin/mmdebstrap line 1968
    main::run_setup(HASH(0x559629ad7458)) called at /usr/bin/mmdebstrap line 1824
    main::setup(HASH(0x559629ad7458)) called at /usr/bin/mmdebstrap line 5873
    main::__ANON__() called at /usr/bin/mmdebstrap line 683
    main::get_unshare_cmd(CODE(0x559629ad7f38), ARRAY(0x5596299ffa48)) called at /usr/bin/mmdebstrap line 5920
    main::main() called at /usr/bin/mmdebstrap line 6253
D: 40806 3656 listener: finished reading command
D: 40806 3960 hooklistener errored out: E: received eof on socket at /usr/bin/mmdebstrap line 192.
    main::error("received eof on socket") called at /usr/bin/mmdebstrap line 3657
    eval {...} called at /usr/bin/mmdebstrap line 3647
    main::hooklistener(3) called at /usr/bin/mmdebstrap line 6048
    main::main() called at /usr/bin/mmdebstrap line 6253

I: 40806 6021 main() received signal PIPE: waiting for setup...
D: 40743 6058 finish to listen for hooks
E: mmdebstrap failed to run at /usr/bin/mmdebstrap line 192.
    main::error("mmdebstrap failed to run") called at /usr/bin/mmdebstrap line 6249
    main::main() called at /usr/bin/mmdebstrap line 6253

When you try to boot from the SD, the boot stops.

U-Boot SPL 2024.01-rc2-00069-ge7ebbf370b (Feb 29 2024 - 19:29:20 +0300)
DRAM: 4096 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.9.0   (release):v2.10-rc0-4-g5e52433dd
NOTICE:  BL31: Built : 19:27:05, Feb 29 2024
NOTICE:  BL31: Detected Allwinner H616 SoC (1823)
NOTICE:  BL31: Found U-Boot DTB at 0x4a082cb0, model: LonganPi 3H
ERROR:   RSB: set run-time address: 0x10003

U-Boot 2024.01-rc2-00069-ge7ebbf370b (Feb 29 2024 - 19:29:20 +0300) Allwinner Technology

CPU:   Allwinner H616 (SUN50I)
Model: LonganPi 3H
DRAM:  4 GiB
Core:  48 devices, 19 uclasses, devicetree: separate
WDT:   Not starting watchdog@30090a0
MMC:   mmc@4020000: 0, mmc@4022000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   eth0: ethernet@5020000
Unknown command 'usb' - try 'help'
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
ethernet@5020000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
=>
wu-yue-yu commented 6 months ago

It seems that the kernel is not installed correctly. You can check the boot partition.

DanilinSA commented 5 months ago

Checked it today. If you create directly, it is impossible to log in:

lpi3h login: root
Password:

Login incorrect
lpi3h login: sipeed
Password:

Login incorrect

Judging by the logs, the firstboot.service does not start.

But if you add the line "tar -vf ./build/rootfs.tar --delete ./etc/machine-id" to the end of the mkrootfs.sh file, you will see in the logs

[  OK  ] Reached target network.target - Network.
         Starting firstboot.service - FirstBoot...
[  OK  ] Started iperf3.service - iperf3 server.
...
[  OK  ] Started systemd-timedated.service - Time & Date Service.
[  OK  ] Finished firstboot.service - FirstBoot.
         Starting rc-local.service - /etc/rc.local Compatibility...
         Starting systemd-rfkill.service - Load/Save RF Kill Switch Status...

Then you can log in normally.

lpi3h-ec76 login: sipeed
Password:
Linux lpi3h-ec76 6.7.0-rc3+ #1 SMP PREEMPT Wed Mar 13 19:50:35 MSK 2024 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[  116.287320] systemd-journald[120]: Failed to set ACL on /var/log/journal/2b870f08cb0e4a8196650bae9b89eef9/user-1000.journal, ignoring: Operation not supported
sipeed@lpi3h-ec76:~$
wu-yue-yu commented 5 months ago

Login failure may be related to the system initialization not being complete yet. When logging in for the first time after flashing, the waiting time will be longer. Generally speaking, you should be able to log in successfully after seeing the UTMP service related information displayed on the lpi3h terminal.

As for the firstboot.service, the version of 20240228 image I tested was able to boot up successfully. If you don't see it in the serial information, you can use commands to check the relevant logs:

systemctl status firstboot

Screenshot from 2024-03-14 11-25-14

DanilinSA commented 5 months ago

I'm building firmware in VirtualBox. Could this affect the result?