ostree icon indicating copy to clipboard operation
ostree copied to clipboard

error: Not a regular file or symlink: S.gpg-agent.extra

Open abitrolly opened this issue 5 years ago • 11 comments

Trying to save SD card partition into freshly created .osrepo fails.

✗ sudo ostree --repo=.osrepo commit --branch manjaro /run/media/root/ROOT/   
error: Not a regular file or symlink: S.gpg-agent.extra

The mounted SD card content is unpacked Manjaro Linux for ARM.

abitrolly avatar Mar 11 '20 14:03 abitrolly

Thanks for the report. It sounds like you are trying to commit a Unix socket (S.gpg-agent.extra), is that intended?

lucab avatar Nov 16 '20 14:11 lucab

@lucab I am not sure how such socket may exist on a SD card mount. I didn't expect any sockets in this case.

abitrolly avatar Nov 16 '20 22:11 abitrolly

Did you ever boot from that SD card? It might just be remnants from gpg-agent starting in a homedir on there. You should be able to remove that file and try again.

jlebon avatar Nov 17 '20 15:11 jlebon

@jlebon if I remember correctly, I needed ostree to remaster Manjaro image for Raspberry PI. The image is probably never booted, or at least never booted into user session. It might be repeatable with Manjaro image.

abitrolly avatar Nov 17 '20 17:11 abitrolly

There is indeed a socket file in that image (/tmp/img is my temporary mountpoint):

$ sha256sum Manjaro-ARM-kde-plasma-rpi4-20.10.img 
f51969cc5fa1f777b53bef210820d904635c89e4ae430af0465744a553cb2fbe  Manjaro-ARM-kde-plasma-rpi4-20.10.img

$ find /tmp/img -name 'S.gpg-agent.extra' 
/tmp/img/etc/pacman.d/gnupg/S.gpg-agent.extra

$ stat /tmp/img/etc/pacman.d/gnupg/S.gpg-agent.extra
  File: /tmp/img/etc/pacman.d/gnupg/S.gpg-agent.extra
  Size: 0               Blocks: 0          IO Block: 4096   socket
Device: 700h/1792d      Inode: 131801      Links: 1
Access: (0700/srwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-10-12 20:15:59.501126108 +0000
Modify: 2020-10-12 20:15:59.501126108 +0000
Change: 2020-10-12 20:28:29.630358615 +0000
 Birth: 2020-10-12 20:28:29.630358615 +0000

lucab avatar Nov 17 '20 18:11 lucab

Related to this, while reviewing https://github.com/ostreedev/ostree/pull/2242, I realized that the archive import API supports a ignore_unsupported_content flag. We could extend that for directory commits too and expose it as e.g. ostree commit --ignore-unsupported-content.

jlebon avatar Nov 17 '20 19:11 jlebon

My original goal was to use ostree to modify Linux images that are written to SD card. Is it safe to ignore such sockets on a filesystem? They will be removed in resulting image, right?

abitrolly avatar Nov 17 '20 21:11 abitrolly

From https://wiki.archlinux.org/index.php/Pacman/Package_signing, it seems that the pacman trusted keys are simply stored in a GnuPG homedir there. Pacman will be of little use to you on an ostree system since it will be immutable, so you could just wipe the whole directory and probably never notice. However, If you want to retain that, just delete any leftover sockets there. GnuPG names them all beginning with S. and will recreate them as necessary. So, just rm -f etc/pacman.d/gnupg/S.* before committing should be fine.

Generally there's a bit of cleanup to do before committing an OS because any configuration or state in the tree would later be distributed to everyone and that might not be correct. So, while it might work fine to mount an image and throw it all into a commit, it's likely you'll want to trim some things out like this.

dbnicholson avatar Nov 17 '20 22:11 dbnicholson

I hoped to use ostree as a generic version control system while working on that image. Using git for that purpose is impractical due to the image size. Losing information from the image is also not practical, so I guess ostree just doesn't fit the use case.

abitrolly avatar Nov 18 '20 02:11 abitrolly

@abitrolly to the best of my knowledge, the socket file in the image is a leftover/mistake. As this is an inert image, there is no process anymore alive that can accept connections on that unix socket, which is effectively a dead entry in the filesystem. If that makes sense, would you mind opening a bug to the distro in order to have it filtered out of the image?

@jlebon I'm not too familiar with the API, are you suggesting a list of specific unsupported things to ignore or a plain "keep-going on all unsupported" switch?

lucab avatar Nov 18 '20 10:11 lucab

It would be great if we could ignore sockets instead of failing the whole commit.

akvadrako avatar Sep 13 '22 16:09 akvadrako