Announcement

Collapse
No announcement yet.

I'm thwarted at every turn trying to move /snap into /home

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I'm thwarted at every turn trying to move /snap into /home

    Background: I'm running Kubuntu 22.04.3 LTS (HWE path, current kernel 6.2.0-34-generic), installed on a 256 GB SSD with additional storage (a LOT of it) on a 1 TB platter drive (legacy from Windows XP) and 1 TB SSD (/home is ~500 GB on the large SSD, / is 50 GB on the smaller, and other partitions take up the rest of the smaller SSD)

    Today I tried to run 'sudo flatpak update' because one of my flatpak applications wouldn't start (I suspected this because it's one I don't use often, and sure enough, it was badly outdated). The update went without a hitch, except that one of the flatpak apps failed to update because there was no more room in my / folder. Like 0 bytes free, was the report.

    Okay, emptied my trash (at least a few discarded system files that I presumed were still present on / after deletion), then ran 'sudo apt autoremove' which cleared 6.6 GB of space and allowed me to finish the flatpak update. But then on checking why my 50 GB / partition was full (a couple LTS versions ago, I routinely installed Kubuntu in 20 GB partitions), I found the /snap folder was 19.6 GB in size, prompting an immediate question of why this folder is in the OS partition instead of somewhere else (and yes, it's probably possible to give it its own partition during installation, if you know you need to).

    The second question arose when I tried to move /snap into /home (which has over 400 GB free; it's on a newish 1 TB SSD): using 'sudo mv snap /home/snap' took a long time (as might be expected, moving between physical devices is a copy/delete operation rather than a rename), then generated a LONG scroll of "mv: cannot remove file <filename>" messages ending with "read-only file system" and left me with a copy of /snap in /home. I then tried 'sudo rm -r -I /snap" and got a matching list of error messages (my intent was to create a link to the copy in /home to replace the original /snap so snap apps will still function but without taking up more than 1/3 of my OS partition). I was able to use mv to rename the folder (to snap.old), and planned to use link to create a link to /home/snap, but got "invalid cross-device link" and I can't make the link in the GUI because of "unfixable security problems in Dolphin" that prevent using Dolphin for privileged operations.

    At present, I can undo the renaming of /snap so my snap apps will still work, but want/need to remove the /snap folder from / and replace it with a link to /home/snap in order to continue using my system until at least next summer when 24.04 is ready for upgrades. Ideally, I'd like to similarly get flatpak apps off / (I thought they were in ~ in a hidden folder?).

    I'm not a Kubuntu guru; I've been using Debian-based Linux for about twelve years, but I use the GUI when I can, command line when I must, and I get under the hood as little as possible (this is a tool for me, not a hobby).

    So, question here is: how can I replace /snap with a link to its copy in /home/snap and free the space in my / partition?

    Edit: I was able to create the link to /home/snap with 'ln -s /snap/home /snap' -- so now I just need to remove /snap.old. Permissions show "rwx" for owner in 'ls -l' so I would expect use of sudo with 'rm -r' ought to work, but it doesn't; see above.
    Last edited by Silent Observer; Oct 14, 2023, 09:49 AM.

    #2
    lsblk -f shows Snap Loops.
    Do Snap Loops installed programs have individual permission locks?
    Last edited by TinyTim; Oct 14, 2023, 10:50 AM.

    Comment


      #3
      Well,I see a lot of Snap Loops, but I don't know about those having permission locks -- yes or no.

      However, I discover that I've seemingly done other harm somewhere in copying and renaming /snap -- I now can't start Firefox (SeaMonkey, fortunately, works fine, but SeaMonkey doesn't work well for some stuff that wants the most secure or up-to-date browser). I found that /snap/bin folder was missing (maybe that's the one thing in /snap that did actually delete?), but copying it back from the copy at /home/snap didn't fix things. My system menu launcher for Firefox now wants to open with SeaMonkey, so something's broken.

      /$ lsblk -f
      NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
      loop0 squashfs 4.0 0 100% /snap/gimp/393
      loop1 squashfs 4.0 0 100% /snap/gtk2-common-themes/13
      loop2 0 100% /snap/bare/5
      loop3 0 100% /snap/core/16202
      loop4 0 100% /snap/core/16091
      loop5 0 100% /snap/core18/2790
      loop6 0 100% /snap/core18/2785
      loop7 0 100% /snap/core20/1974
      loop8 squashfs 4.0 0 100% /snap/core20/2015
      loop9 squashfs 4.0 0 100% /snap/core22/858
      loop10 squashfs 4.0 0 100% /snap/core22/864
      loop11 squashfs 4.0 0 100% /snap/cups/974
      loop12 squashfs 4.0 0 100% /snap/cups/980
      loop13 0 100% /snap/gimp/405
      loop14 squashfs 4.0 0 100% /snap/firefox/3206
      loop15 squashfs 4.0 0 100% /snap/freecad/727
      loop16 squashfs 4.0 0 100% /snap/freecad/759
      loop17 squashfs 4.0 0 100% /snap/gnome-3-28-1804/194
      loop18 squashfs 4.0 0 100% /snap/gnome-3-28-1804/198
      loop19 squashfs 4.0 0 100% /snap/gnome-3-38-2004/140
      loop20 squashfs 4.0 0 100% /snap/gnome-3-38-2004/143
      loop21 squashfs 4.0 0 100% /snap/gnome-42-2204/132
      loop22 squashfs 4.0 0 100% /snap/gnome-42-2204/141
      loop23 squashfs 4.0 0 100% /snap/gtk-common-themes/1535
      loop24 squashfs 4.0 0 100% /snap/kde-frameworks-5-96-qt-5-15-5-core20/7
      loop25 squashfs 4.0 0 100% /snap/kde-frameworks-5-99-qt-5-15-7-core20/7
      loop26 0 100% /snap/firefox/3252
      loop27 squashfs 4.0 0 100% /snap/skype/304
      loop28 0 100% /snap/skype/305
      loop29 squashfs 4.0 0 100% /snap/snapd/20092
      loop30 0 100% /snap/snapd/20290
      sda
      ├─sda1 vfat FAT16 F3A7-69F0 94M 8% /boot/efi
      ├─sda2 ext4 1.0 235bd0b3-2226-4942-ab12-c56289ee2bbb 6.5G 82% /var/snap/firefox/common/host-hunspell
      │ /
      ├─sda3 swap 1 9dc302a8-b647-4b23-8eea-affdc697af83 [SWAP]
      └─sda4 ext4 1.0 Downloads 35d0abf1-32d2-4a24-8830-8525f306664d
      sdb
      ├─sdb1 ntfs Seagate 1T-C 5E5C65065C64D9F3 55.8G 43% /mnt/sdb1
      ├─sdb2
      ├─sdb5 ntfs Seagate 1T-D 88CCAB91CCAB77D8 27.6G 72% /mnt/sdb5
      ├─sdb6 ntfs Seagate 1T-E 3680C08C80C05451 81G 17% /mnt/sdb6
      ├─sdb7 ntfs Seagate 1T-F E6ACC7B2ACC77B95 72.2G 26% /mnt/sdb7
      ├─sdb8 ntfs Seagate 1T-G 48CCD912CCD8FB60 7G 96% /mnt/sdb8
      └─sdb9 ntfs Seagate 1T-H CA58E44A58E436BB 112.4G 67% /mnt/sdb9
      sdc
      ├─sdc1 ext4 1.0 59811c9e-c633-4120-9342-e002e2750683
      ├─sdc2 ext4 1.0 b6f2deaa-793d-42e6-a970-383380c24a71 119.2G 34% /run/timeshift/backup
      │ /mnt/sdc2
      └─sdc3 ext4 1.0 4b9c2919-2a90-432e-84e8-28483861a4b0 457.9G 32% /home
      I see that firefox/3252 doesn't show squashfs like firefox/3206 does, not sure if/how that might be related...

      Edit: I found an answer that said I have to uninstall and reinstall the Firefox snap to get the equivalent of 'sudo apt reinstall' -- but when doing that, I got a message the "remove firefox data" had failed due to read-only filesystem, found no saved snapshot, and couldn't 'snap install firefox' due to 'firefox already installd, see snap help refresh'.

      I'm starting to really hate snap. Flatpak may deserve it just as much, but I haven't had this problem set (yet) with flatpak.

      Further Update: Uninstalling and reinstalling the Firefox snap gained nothing. I could see via 'snap list' that Firefox was changing status from enabled to disabled -- that is, 'snap remove firefox' didn't actually remove it, it just disabled it.

      So apparently even if I remove every snap application I have, I can't ever get back the 19+ GB of my / folder that the /snap takes up...
      Last edited by Silent Observer; Oct 14, 2023, 04:49 PM.

      Comment


        #4
        You've experienced one of the reasons why I umounted snap's loop files and purged snap. I got tired of using flatpak's syntax to add or remove files and uninstalled it using discover. Now, if an app I want to install isn't in the repository, or is more recent than the repository version, I use an AppImage.
        I've saved tons of disk space and my boot time dropped from 30-45 secs to circa 15 seconds. When I moved to Debian 12 I didn't install either snap or flatpak. I'm currently running Plasma 5.27.5 and my boot time is 10-12 seconds.
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          GreyGeek I think I mentioned I'm no Linux guru -- I understood most of what you typed above, but beyond umounting the loop files (which I don't know how to do but I'm confident I can find a command for) and purging snap, I wouldn't have any idea how to do that.

          The snap and flatpaks I currently have installed are programs I need, and that seems to be the only (easily found) Ubuntu-compatible form they're distributed in.

          As far as I can see, flatpak isn't taking up a huge block of space in / (and doesn't make its installations untouchable) so whatever it does in /home or ~ I can deal with -- I've got hundreds of GB free there and SSDs have gotten cheap ($60 for 1 TB, probably less now). And if/when I wind up doing a major reinstall for 24.04 (because the "upgrade" process has never yet worked for me) I can make a separate space for /snap and give it 100 GB or so.

          But for the next roughly a year, I'm stuck with snap (because some of what I have installed as snap doesn't seem to be available as flatpak). Truth be told, I'm getting pretty tired of having to fight with Linux because the upstream can't just pick a method and stick with it. That's not just my autism typing; it's bad design to make huge changes ever couple years or build everything on the assumption that your users will replace their entire computer and keep only the data that will fit on a couple USB sticks ever two to four years. How does anyone ever learn enough to get comfortable with this stuff, short of working with it full time and taking annual (or more frequent) refresher training (and paying through the nose for it)? [/rant]

          I think I found a clue -- do I need to umount the appropriate loop file before I'll be able to remove a particular snap completely? If so, why does "snap remove --purge <application>" do that automatically (yeah, I know, because the three-heads people who write this stuff are more autistic than I am and can't conceive of the users not knowing what they know)?

          Comment

          Working...
          X