openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.76k forks source link

zfs export - busy pool - following root on zfs docs #16036

Open mcint opened 8 months ago

mcint commented 8 months ago

System information

Type Version/Name
Distribution Name KDE Neon 5.26 / Ubuntu Jammy 22.04
Distribution Version jammy 22.04
Kernel Version 5.15.0-52-generic
Architecture x86_64
OpenZFS Version zfs-2.1.5-1ubuntu6~22.04.3 / zfs-kmod-2.1.4-0ubuntu0.1

Describe the problem you're observing

Following openzfs "root on zfs" docs, I ran into an issue during step 5 grub installation at item 10 (or for practical scrolling purposes, just before step 6 first boot similar to #9606.

root@neon:~# grep rpool /proc/*/mounts | cut -d/ -f3 | uniq | xargs ps
    PID TTY      STAT   TIME COMMAND
    902 ?        Ss     0:01 /lib/systemd/systemd-udevd
    918 ?        Ss     0:00 /usr/sbin/haveged --Foreground --verbose=1
    919 ?        Ss     0:00 /lib/systemd/systemd-resolved
    921 ?        Ssl    0:00 /lib/systemd/systemd-timesyncd
   1253 ?        Ssl    0:00 /usr/libexec/accounts-daemon
   1264 ?        Ssl    0:03 /usr/sbin/NetworkManager --no-daemon
   1268 ?        Ssl    0:00 /usr/libexec/iio-sensor-proxy
   1269 ?        Ssl    0:00 /usr/sbin/irqbalance --foreground
   1284 ?        Ss     0:00 /lib/systemd/systemd-logind
   1337 ?        Ssl    0:00 /usr/sbin/ModemManager
   1338 ?        Ssl    0:00 /usr/libexec/boltd
   1353 ?        Ss     0:00 /usr/lib/bluetooth/bluetoothd
   1827 ?        Ssl    0:04 /usr/libexec/upowerd

Killing these (and then fixing my display and NetworkManager, worked to fix my problem, but reporting as a rough edge.

Describe how to reproduce the problem

Include any warning/errors/backtraces from the system logs

jstasiak commented 5 months ago

I bumped into the same thing following the same how-to guide using Ubuntu 24.04 server image in an Aarch64 VM.

# zpool export -a
cannot export 'rpool': pool is busy
# uname -a
Linux testvm 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 02:32:42 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

In my case these were the processes listed by the command:

# grep rpool /proc/*/mounts | cut -d/ -f3 | uniq | xargs ps
    PID TTY      STAT   TIME COMMAND
    975 ?        Ss     0:00 /usr/lib/systemd/systemd-resolved
    976 ?        Ssl    0:00 /usr/lib/systemd/systemd-timesyncd
   1267 ?        Ss     0:00 /usr/lib/systemd/systemd-networkd
   1302 ?        S<s    0:00 /usr/lib/systemd/systemd-logind
   1309 ?        Ssl    0:00 /usr/lib/polkit-1/polkitd --no-debug
   1393 ?        Ssl    0:00 /usr/sbin/ModemManager

Killing them allowed zpool export -a to succeed.

bcsmith2846 commented 3 months ago

I ran into this as well running Ubuntu 24.04 LTS server via a Live USB. If you remove polkitd and add gpg-agentd, the blocking processes for me were the same as @jstasiak. I this this may be related to doing the setup in an SSH session. Once I killed the blocking processes, the SSH session was killed, and I was able to successfully run zpool export -a from the server's physical terminal.

As a note for anyone stumbling on this: I stopped the systemd sockets and services for all the processes unrelated to networking or SSH that had systemd services, and then ran a one-line systemctl stop <service1> && systemctl stop <service2> && kill -9 <PID> for the remaining processes. The last command killed the SSH session, so I went over to the physical server and ran the final zpool export -a at the server's terminal and it ran successfully. I was then able to reboot the server and continue.