Just some Internet guy

He/him/them 🏳️‍🌈

  • 1 Post
  • 129 Comments
Joined 1 year ago
cake
Cake day: June 25th, 2023

help-circle

  • Make sure to use machinectl and not sudo or anything else. That’s about the symptoms I’d expect from an incomplete session setup. The use of machinectl there was very deliberate, as it goes through all the PAM, logind, systemd and D-Bus stuff as any normal login. It gets you a clean and properly registered session, and also gets rid of anything tied to your regular user:

    max-p@desktop ~> loginctl list-sessions
    SESSION  UID USER  SEAT  LEADER CLASS   TTY   IDLE SINCE
          2 1000 max-p seat0 3088   user    tty2  no   -    
          3 1000 max-p -     3112   manager -     no   -    
          8 1001 tv    -     589069 user    pts/4 no   -    
          9 1001 tv    -     589073 manager -     no   -    
    

    It basically gets you to a state of having properly logged into the system, as if you logged in from SDDM or in a virtual console. From there, if you actually had just logged in a tty as that user, you could run startplasma-wayland and end up in just as if you had logged in with SDDM, that’s what SDDM eventually launches after logging you in, as per the session file:

    max-p@desktop ~> cat /usr/share/wayland-sessions/plasma.desktop 
    [Desktop Entry]
    Exec=/usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland
    TryExec=/usr/bin/startplasma-wayland
    DesktopNames=KDE
    Name=Plasma (Wayland)
    # ... and translations in every languages
    

    From there we need one last trick, it’s to get KWin to start nested. That’s what the additional WAYLAND_DISPLAY=/run/user/1000/wayland-0 before is supposed to do. Make sure that this one is ran within the machinectl shell, as that shell and only that shell is the session leader.

    The possible gotcha I see with this, is if startplasma-wayland doesn’t replace that WAYLAND_DISPLAY environment variable with KWin’s, so all the applications from that session ends up using the main user. You can confirm this particular edge case by logging in with the secondary user on a tty, and running the same command including the WAYLAND_DISPLAY part of it. If it starts and all the windows pop up on your primary user’s session, that’s the problem. If it doesn’t, then you have incorrect session setup and stuff from your primary user bled in.

    Like, that part is really important, by using machinectl the process tree for the secondary user starts from PID 1:

    max-p@desktop ~> pstree
    systemd─┬─auditd───{auditd}
            ├─bash─┬─(sd-pam)                 # <--- This is the process machinectl spawned
            │      └─fish───zsh───fish───zsh  # <-- Here I launched a bunch of shells to verify it's my machinectl shell
            ├─systemd─┬─(sd-pam) # <-- And that's my regular user
            │         ├─Discord─┬─Discord───Discord───46*[{Discord}]
            │         ├─DiscoverNotifie───9*[{DiscoverNotifie}]
            │         ├─cool-retro-term─┬─fish───btop───{btop}
            │         ├─dbus-broker-lau───dbus-broker
            │         ├─dconf-service───3*[{dconf-service}]
            │         ├─easyeffects───11*[{easyeffects}]
            │         ├─firefox─┬─3*[Isolated Web Co───30*[{Isolated Web Co}]]
    

    Super weird stuff happens otherwise that I can’t explain other than some systemd PAM voodoo happens. There’s a lot of things that happens when you log in, for example giving your user access to keyboard, mouse and GPU, and the type of session depends on the point of entry. Obviously if you log in over SSH you don’t get the keyboard assigned to you. When you switch TTY, systemd-logind also moves access to peripherals such that user A can’t keylog user B while A’s session is in the background. Make sure the machinectl session is also the only session opened for the secondary user, as it being assigned to a TTY session could also potentially interfere.

    what distro/plasma version are you running? (here it’s opensuse slowroll w/ plasma 6.1.4)

    Arch, Plasma 6.1.5.

    what happens if you just run startplasma-wayland from a terminal as your user? (I see the plasma splash screen and then I’m back to my old session)

    You mean a tty or a terminal emulator like Konsole?

    • In a tty
      • if I’m already logged in it should switch to the current session as multi-instance is not supported
      • if it’s my only graphical session, it should start Plasma normally with the only exception being KWallet not unlocking automatically.
    • In a terminal within my graphical session: nothing at all.


  • Totally possible. It’ll work best with Wayland thanks to nested compositor support, whereas on Xorg you’d need to use Xephyr which doesn’t do hardware acceleration.

    # Give the other user access to your Wayland socket
    setfacl -m u:otheruser:rx $XDG_RUNTIME_DIR
    setfacl -m u:otheruser:rwx $XDG_RUNTIME_DIR/wayland-0
    
    # Open a session as the other user (note the trailing @, it's there to login in to the local machine)
    sudo machinectl login otheruser@
    
    # Start your DE!
    WAYLAND_DISPLAY=/run/user/$(id -u yourmainuser)/wayland-0 startplasma-wayland
    

    And tada! Nested Wayland session



  • I would use maybe a Raspberry Pi or old laptop with two drives (preferably different brands/age, HDD or SSD doesn’t really matter) in it using a checksumming filesystem like btrfs or ZFS so that you can do regular scrubs to verify data integrity.

    Then, from that device, pull the data from your main system as needed (that way, the main system has no way of breaking into the backup device so won’t be affected by ransomware), and once it’s done, shut it off or even unplug it completely and store it securely, preferably in a metal box to avoid any magnetic fields from interfering with the drives. Plug it in and boot it up every now and then to perform a scrub to validate that the data is all still intact and repair the data as necessary and resilver a drive if one of them fails.

    The unfortunate reality is most storage mediums will eventually fade out, so the best way to deal with that is an active system that can check data integrity and correct the files, and rewrite all the data once in a while to make sure the data is fresh and strong.

    If you’re really serious about that data, I would opt for both an HDD and an SSD, and have two of those systems at different locations. That way, if something shakes up the HDD and damages the platter, the SSD is probably fine, and if it’s forgotten for a while maybe the SSD’s memory cells will have faded but not the HDD. The strength is in the diversity of the mediums. Maybe burn a Blu-Ray as well just in case, it’ll fade too but hopefully differently than an SSD or an HDD. The more copies, even partial copies, the more likely you can recover the entirety of the data, and you have the checksums to validate which blocks from which medium is correct. (Fun fact, people have been archiving LaserDiscs and repairing them by ripping the same movie from multiple identical discs, as they’re unlikely to fade at exactly the same spots at the same time, so you can merge them all together and cross-reference them and usually get a near perfect rip of it).



  • No but it does show how much capitalism relies on the absolute exploitation of the labor market and the double-standards from the US in that regard. Free market good but only when US companies are the ones fucking everyone over.

    • US companies buying cheap stuff from China and marking it up 500%: good, American values
    • China cuts the middleman and sells the same product for the same price they would sell it to the reseller: noooooo we can’t compete with that, China bad, it’s so unfair! Waaaaaaa

    At least the EU doesn’t constantly brag about muh freedom and how the free market is the best thing ever and you’re a commie if you don’t agree that capitalism is the best.




  • I’ve read some posts about editing fstab to mount them at startup, but they don’t cover whether the drives will be available to other users or not. Can I just add them to fstab and mount them somewhere that’s available to all users, then sort out the permissions? If so, where’s the best place to put them?

    Yes pretty much. It just explicitly tells the system where to mount it, and for some filesystems you can even force the UID/GID and modes.

    Usually /mnt/whatever for static mounts and /media/whatever for removable mounts (those appear as drives in file managers, whereas /mnt doesn’t). You can set the users option in fstab and it’ll let users mount and unmount it without sudo as well, or auto to always mount it on boot.

    From there usually you can make a shared group, chown the mount to root:thatgroup, then chmod g+s to make sure the group is inherited. And you should mostly be good to go.




  • Apart from the technical reasons already mentioned, before things like Twitch and TikTok and Instagram were a thing, people mostly downloaded content and very rarely uploaded much. So it made sense for the ISPs to allocate more downstream channels and advertise much higher download speeds which is what everyone cared about. Especially with DSL and aging copper lines, it kind of tops out at 40-50 Mbps for most people when lucky (even though VDSL2-Vplus technically can go up to 300/100). Especially if you’re shoving IPTV on that line, 25/25 is much less desirable for the average consumer than say, 45/5.

    And as others have said, it’s much easier for the ISP to throw more power on your lines to sustain faster speeds, so it just kind of happened that it was convenient for everyone to do it that way.

    It also has the side effect of heavily discouraging hosting servers at home, reduces the amount of bandwidth used by torrenting and the likes.


  • I haven’t looked into it particularly deep but it’s not like there’s a ton of stuff a WM can possibly do unless the code base is littered with raw X11 calls everywhere.

    Most of the window placement and tiling logic shouldn’t be tied directly to X11 and only a small part of it should really be interacting with X11 to place and size windows. So one should target that intermediate spot that makes all the X11 calls.

    And if the code is too shit to port, it probably deserves to die.


  • It’s possible to do but also probably not worth the amount of effort to reimplement all of those protocols only for super old WMs that don’t have a Wayland equivalent. None of them are particularly complex, so It’s probably easier to just port those to wlroots than implement the compatibility, and it’s an opportunity to make an API or library to make it easy to write WMs.


  • I know, that was an example of why it doesn’t work on ZFS. That would be the closest you can get with regular ZFS, and as we both pointed out, it makes no sense, it doesn’t work. The L2ARC is a cache, you can’t store files in it.

    The whole point of bcachefs is tiering. You can give it a 4TB NVMe, a 4TB SATA SSD and a 8 GB HDD and get almost the whole 16 TB of usable space in one big filesystem. It’ll shuffle the files around for you to keep the hot data set on the fastest drive. You can pin the data to the storage medium that matches the performance needs of the workload. The roadmap claims they want to analyze usage pattern and automatically store the files on the slowest drive that doesn’t bottleneck the workload. The point is, unlike regular bcache or the ZFS ARC, it’s not just a cache, it’s also storage space available to the user.

    You wouldn’t copy the game to another drive yourself directly. You’d request the filesystem to promote it to the fast drive. It’s all the same filesystem, completely transparent.


  • Simple example: my Steam library could be RAID0 and unencrypted but my backups I definitely want to be RAID1 and compressed, and encrypted for security. The media library doesn’t need encryption but maybe want it in RAID1 because ripping movies takes forever. I may also want to have the games on NVMe when I play them, and stored on the HDDs when I’m not playing them, and my VMs on the SATA SSD array as a performance middleground.


  • ZFS doesn’t support tiered storage at all. Bcachefs is capable of promoting and demoting files to faster but smaller or slower but larger storage. It’s not just a cache. On ZFS the only option is really multiple zpools. Like you can sort of do that with the persistent L2ARC now but TBs of L2ARC is super wasteful and your data has to fully fit the pool.

    Tiered storage is great for VMs and games and other large files. Play a game, promote to NVMe for fast loadings. Done playing, it gets moved to the HDDs.


  • It doesn’t change the preferences but it does replace bootx64.efi which is the default bootloader executable for a drive, when the UEFI doesn’t have more specific entries. In some configurations both Windows and GRUB want to be that.

    If you add a boot entry for GRUB and don’t point it to the default executable, then it won’t be affected. Until you reset the BIOS or try to use the drive in another system that is, in which case the firmware will then only know about the default executable. But it’s easy to add the boot entries back.