kpcyrd / spotify-launcher

Client for spotify's apt repository in Rust for Arch Linux
Other
176 stars 9 forks source link

ZFS: Error: Failed to update directories #10

Closed mingcenwei closed 1 year ago

mingcenwei commented 2 years ago

When I run spotify-launcher, the following error will occur:

username> spotify-launcher
[2022-08-26T18:30:21Z INFO  spotify_launcher::config] Loading configuration file at "/etc/spotify-launcher.conf"
[2022-08-26T18:30:21Z INFO  spotify_launcher::apt] Downloading release file...
[2022-08-26T18:30:22Z INFO  spotify_launcher::apt] Downloading signature...
[2022-08-26T18:30:23Z INFO  spotify_launcher::apt] Verifying pgp signature...
[2022-08-26T18:30:23Z INFO  spotify_launcher::apt] Signature verified successfully!
[2022-08-26T18:30:23Z INFO  spotify_launcher::apt] Downloading package index...
[2022-08-26T18:30:24Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2022-08-26T18:30:24Z INFO  spotify_launcher::apt] Downloading deb file for "spotify-client_1.1.84.716.gc5f8b819_amd64.deb" version="spotify-client" ("1:1.1.84.716.gc5f8b819")
[2022-08-26T18:30:56Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2022-08-26T18:30:59Z INFO  spotify_launcher] Extracting to "/home/username/.local/share/spotify-launcher/install-new"...
[2022-08-26T18:30:59Z INFO  spotify_launcher] Setting new directory active
Error: Failed to update directories "/home/username/.local/share/spotify-launcher/install" and "/home/username/.local/share/spotify-launcher/install-new"

Caused by:
    0: Could not exchange paths: Invalid argument
    1: Invalid argument
kpcyrd commented 2 years ago

This seems to be an issue with xch to atomically swap directories:

https://github.com/kpcyrd/spotify-launcher/blob/9cc6c75ce7bf1fd75ace52de2d79bdb7851448bf/src/main.rs#L113-L119

Which filesystem are you using? :) The mountpoint for that directory can be shown with df /home/username/.local/share/spotify-launcher.

mingcenwei commented 2 years ago

I use ZFS:

$USER> df -- ~/.local/share/
Filesystem                               1K-blocks      Used Available Use% Mounted on
pool_name/data/default/home 407179392 180318080 226861312  45% /home

$USER> findmnt -- /home
TARGET SOURCE                                   FSTYPE OPTIONS
/home  pool_name/data/default/home zfs    rw,relatime,xattr,posixacl
kpcyrd commented 2 years ago

Thanks, I've filed this as a bug in the xch crate https://github.com/WanzenBug/xch/issues/3 :)

lechum2 commented 1 year ago

Hi, I have stumbled on the similar issue, but not on on ext4. However there is ecrptfs involved.

$ spotify-launcher    
[2023-01-19T09:08:20Z INFO  spotify_launcher::config] Loading configuration file at "/home/lechu/.config/spotify-launcher.conf"
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Downloading release file...
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Downloading signature...
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Verifying pgp signature...
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Signature verified successfully!
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Downloading package index...
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2023-01-19T09:08:20Z INFO  spotify_launcher::apt] Downloading deb file for "spotify-client_1.1.84.716.gc5f8b819-2_amd64.deb" version="spotify-client" ("1:1.1.84.716.gc5f8b819-2")
[2023-01-19T09:09:05Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2023-01-19T09:09:08Z INFO  spotify_launcher] Extracting to "/home/lechu/.local/share/spotify-launcher/install-new"...
[2023-01-19T09:09:09Z INFO  spotify_launcher] Setting new directory active
Error: Failed to update directories "/home/lechu/.local/share/spotify-launcher/install" and "/home/lechu/.local/share/spotify-launcher/install-new"

Caused by:
    0: Could not exchange paths: Invalid argument
    1: Invalid argument
$ df -- ~/.local/share                                                                                                                                                               [10:14:38]
Filesystem           1K-blocks      Used Available Use% Mounted on
/home/lechu/.Private 354243944 193455908 142720224  58% /home/lechu
$ findmnt -- /home                                                                                                                                                                   [10:15:20]
TARGET SOURCE         FSTYPE OPTIONS
/home  /dev/nvme0n1p7 ext4   rw,relatime
$ findmnt -- /home/lechu                                                                                                                                                             [10:15:26]
TARGET      SOURCE               FSTYPE   OPTIONS
/home/lechu /home/lechu/.Private ecryptfs rw,nosuid,nodev,relatime,ecryptfs_fnek_sig=4c81295950b749ff,ecryptfs_sig=49faa0643ea930d6,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_si
kpcyrd commented 1 year ago

I've uploaded a 0.5.0 release that tries to do an atomic swap and if this fails it deletes the active install directory and then moves install-new to install. This should work on all filesystems.

Let me know if this works for you. :)

lechum2 commented 1 year ago

It shows a warning, but works fine now.

$ spotify-launcher                                                                                                                                                                   [20:54:03]
[2023-01-20T19:54:15Z INFO  spotify_launcher::config] Loading configuration file at "/home/lechu/.config/spotify-launcher.conf"
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Downloading release file...
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Downloading signature...
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Verifying pgp signature...
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Signature verified successfully!
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Downloading package index...
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2023-01-20T19:54:15Z INFO  spotify_launcher::apt] Downloading deb file for "spotify-client_1.1.84.716.gc5f8b819-2_amd64.deb" version="spotify-client" ("1:1.1.84.716.gc5f8b819-2")
[2023-01-20T19:54:54Z INFO  spotify_launcher::apt] Verifying with sha256sum hash...
[2023-01-20T19:54:54Z INFO  spotify_launcher::extract] Extracting to "/home/lechu/.local/share/spotify-launcher/install-new"...
[2023-01-20T19:54:57Z INFO  spotify_launcher::extract] Atomically swapping new directory at "/home/lechu/.local/share/spotify-launcher/install-new" with "/home/lechu/.local/share/spotify-launcher/install"...
[2023-01-20T19:54:57Z WARN  spotify_launcher::extract] Failed to swap "/home/lechu/.local/share/spotify-launcher/install-new" with "/home/lechu/.local/share/spotify-launcher/install": Could not exchange paths: Invalid argument: Invalid argument
spotify: /usr/lib/libcurl-gnutls.so.4: no version information available (required by spotify)
/home/lechu/.local/share/spotify-launcher/install/usr/share/spotify/spotify: /usr/lib/libcurl-gnutls.so.4: no version information available (required by /home/lechu/.local/share/spotify-launcher/install/usr/share/spotify/spotify)
/home/lechu/.local/share/spotify-launcher/install/usr/share/spotify/spotify: /usr/lib/libcurl-gnutls.so.4: no version information available (required by /home/lechu/.local/share/spotify-launcher/install/usr/share/spotify/spotify)
[libprotobuf ERROR ../core/vendor/protobuf3/src/google/protobuf/wire_format_lite.cc:577] String field 'spotify.event_sender.proto.DroppedEvents.DroppedEventsBySequenceIdEntry.key' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. 
/proc/self/exe: /usr/lib/libcurl-gnutls.so.4: no version information available (required by /proc/self/exe)
lechum2 commented 1 year ago

Thanks :)

kpcyrd commented 1 year ago

The warning was expected and it's doing a naive non-atomic swap of the directories (rm -rf install && mv install-new install). I just noticed the log output on info level is not ideal.

Anyway closing this for now. :)