balena takeover script - [takeover::stage2] kill_procs failed

Using your balena takeover script on a RasPiOS based device I am getting the following error:

2023-03-06 18:21:05 DEBUG [takeover::common::system] looking at pid: 2883, fd 0, file: '/proc/2883/fd/0' -> '/mnt/old_root/dev/null'
2023-03-06 18:21:05 DEBUG [takeover::common::system] sending signal 15 to 2883
2023-03-06 18:21:05 ERROR [takeover::stage2] kill_procs failed, error A file could not be found, context: libc::lstat failed for path: '/proc/2906/fd/0'
  caused by: No such file or directory (os error 2)

Full output here

It seems like it is trying to kill a process that isn’t running. But why would that happen? Is this a bug in takeover?

Is there a way we can override this or get it to continue somehow?

Hello @shawaj the takeover script is an old script we don’t use anymore. Could you please confirm what type of devices are you trying to use with the takeover script?

Currently there is a group at balena working on the newest version of the brownfield migrator. We can keep you updated when this is ready!

@mpous well we need something to takeover devices no - so not really feasible to wait. The devices are Raspberry Pi 4. We have tested with a vanilla raspi 4 and it works fine. Also @joehounsham told us to use this script to assumed it was working.

However, on the actual devices we are looking to takeover it fails. However, the above error was just a bit of a red herring I think - it only happens every now and again. The actual failure I believe is this:

2023-03-17 17:18:43 INFO  [takeover::stage2] Found 7813 MiB total, 5795 MiB free memory
2023-03-17 17:18:43 INFO  [takeover::stage2] Copied image to '/transfer/balena.img.gz'
2023-03-17 17:18:43 INFO  [takeover::stage2] Copied config to '/transfer/config.json'
2023-03-17 17:18:43 INFO  [takeover::stage2] Attempting to unmount '/dev/mmcblk0p1' from '/mnt/old_root/boot'
2023-03-17 17:18:43 INFO  [takeover::stage2] Successfully unmounted '/mnt/old_root/boot'
2023-03-17 17:18:43 INFO  [takeover::stage2] Attempting to unmount '/dev/mmcblk0p2' from '/mnt/old_root'
2023-03-17 17:18:43 WARN  [takeover::stage2] Failed to unmount partition '/dev/mmcblk0p2' from '/mnt/old_root', error : Sys(EBUSY) 
2023-03-17 17:18:43 INFO  [takeover::stage2] Trying to remount '/dev/mmcblk0p2' on '/mnt/old_root' as readonly
2023-03-17 17:18:43 ERROR [takeover::stage2] unmount_partitions failed; Error { kind: Upstream, cause: Some(Sys(EBUSY)), context: Some("Failed to remount '/dev/mmcblk0p2' on '/mnt/old_root' with fs type: ext4 as readonly") }

What would cause this issue?

1 Like

Managed to fix this issue by doing the mount steps prior to the takeover script:

sudo mkdir /mnt/old_root
sudo mount /dev/mmcblk0p2 /mnt/old_root
1 Like

@shawaj thanks for sharing the solution that worked here for you! Glad to see that the takeover script still works :slight_smile:

Let us know if we can help you more!

1 Like