During initial boot Could not get lock /var/lib/apt/lists/lock

Creating a bug report/issue

Required Information

  • DietPi version | cat /boot/dietpi/.version 8.19.1 (master, owner: MichaIng, G_LIVE_PATCH_STATUS=[applied,applied,not applied]
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN bookworm 0
  • Kernel version | uname -a Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
  • Architecture | dpkg --print-architecture arm64
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3) RPi 3 Model B+ (aarch64)
  • Power supply used | (EG: 5V 1A RAVpower) 5V DC 3A
  • SD card used | (EG: SanDisk ultra) SanDisk Extreme 32GB

Additional Information (if applicable)

  • Can this issue be replicated on a fresh installation of DietPi? Yes

Steps to reproduce

  1. Copy image onto disk (using either dd if=DietPi_RPi-ARMv8-Bookworm.img of=/dev/disk2 or Raspberry Pi Imager ; tried both)
  2. Adjust variables in dietpi.txt to the following
    AUTO_SETUP_LOCALE=en_US.UTF-8
    AUTO_SETUP_KEYBOARD_LAYOUT=us
    AUTO_SETUP_TIMEZONE=Europe/Berlin
    AUTO_SETUP_AUTOMATED=1
    AUTO_SETUP_INSTALL_SOFTWARE_ID=20 # vim"
    AUTO_SETUP_INSTALL_SOFTWARE_ID=50 # syncthing"
    AUTO_SETUP_INSTALL_SOFTWARE_ID=162 # docker"
    SURVEY_OPTED_IN=1
    
  3. Insert into RPi and boot up

Expected behaviour

  • System should be installed automatically

Actual behaviour

  • Fails with ‘Could not get lock /var/lib/apt/lists/lock …’
  • Then shows Failure screen

Extra details

Let me know if you need more info (I’m a new user and can only add 1 image ; ) ).

fyi: I did run a buster DietPi for around 5 years.

Now I would like to upgrade to Bookworm with a fresh install (because previous dist upgrade bugged out).

As a workaround, can you wait for 5 minutes before hitting retry? Looks like a parallel update process is started in background which should not be the case.

Or you don’t use the automatic install :see_no_evil:

Ping @MichaIng something to investigate

Thanks for the tip. I will try that.

However, now I get the following error. So this one does not seem to be consistent always.

See Initial Boot "Time Sync timed out" and apt update repo signature not valid yet => Failed install

I tried again and this time I got to this error again.

I did as you said and waited 5+ minutes and hit .
However, in the end I end up with the same as in the other error linked above (Initial Boot “Time Sync timed out”…)
Namely the following flickering in the top left corner of the screen:

[ INFO ] Dietpi-Software | Dietpi has not fully been installed.
This must be completet prior to using DietPi by selecting:
  - Go Start Install.

=>
https://upload.disroot.org/r/ySmRYf72#KdP4yJbOHy6iLuWA1scTVuNo42ZoLf7bWcXm9QB4y9U=
https://upload.disroot.org/r/1Cg5UjGA#EQ075gsO86s0d3uu5Ne1vmXf0MmX/KxZKPDsTjQDVjA=

(Using external image hoster now, as I can always only upload one image per post…)

And I can only share 2 links per post ; ). So here is the third image:
https://upload.disroot.org/r/83bkWNFS#BdM1n/NYC+govSJfPDopcMLzNEeK2MPQPVqrKirOvAA=

Do you still see my messages? I see that they are being “flagged”… Why?

Spam filter got triggered, bc ofseveral posts in short time with links to same domain.

Yes, we have spam protection. Unfortunately, this is necessary to exclude spam bots. I have now added you as a basic member and you should have a bit more freedom to post.

OK, let’s try to solve your two problems one by one. First, you can flash a new image and not customise the dietpi.txt, just use the default one. Once this is done, boot your device and try to connect via SSH. You should now be prompted to start the initial setup process. If you encounter a problem, you should be able to scroll up a little in your SSH session and copy/paste the error message.

Mornin’,

well, I opted for a manual install already (no change to dietpi.txt) and I experienced no problems at all.

Appears to me that automated install has some issues.

I will have to install the old system back again due to a forgotten psql migration. So if you need any more data/tests, let me know. I think I could squeeze one or two more SD card unstick and restick into today ; ).

After several manual installs, I can say that manual installations are very stable. So far no issues.
I’m already quite for, so will probably not want to waste the system again ; ).

This should fix it for new images: v8.20 · MichaIng/DietPi@e554fa2 · GitHub

1 Like