There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

daf , to linux in New to linux... I have no idea how to fix this error...
@daf@lemmy.world avatar

Since OP is new to linux I’ll just add this in case it’s helpful.

To edit a file owned by root (super account) you can use sudoedit /etc/apt/sources.list or alternatively sudo nano /etc/apt/sources.list in a terminal.

In the editor save by using the key combo Ctrl+S and exit with Ctrl+X.

Commenting is adding a # in front of the line.

so the file should look like something like this

<pre style="background-color:#ffffff;">
<span style="color:#323232;"># deb cdrom:[Debian GNU/Linux 11.5.0 _Bullseye_ - Official amd64 NETINST 20220910-10:38]/ bullseye main
</span>
LeFrog , to programmerhumor in why not a,b or x,y?
@LeFrog@discuss.tchncs.de avatar

a plural noun

<pre style="background-color:#ffffff;">
<span style="color:#323232;">sheep.each do |sheep|
</span><span style="color:#323232;">  sheep.baaah
</span><span style="color:#323232;">end
</span>

Oh shit :D

SaratogaCx , to programmerhumor in why not a,b or x,y?

It was very common in text books when showing nested loops

<pre style="background-color:#ffffff;">
<span style="color:#323232;">int nWhatTheCount = 0;
</span><span style="color:#323232;">for (int i = 0; i < 10; i++) { 
</span><span style="color:#323232;">    for (int j = 0; j < i; j++) { 
</span><span style="color:#323232;">        for (int k = 0; k < j; k++) { 
</span><span style="color:#323232;">            for (int l = 0; l < k; l++) { // and on, and on
</span><span style="color:#323232;">                nWhatTheCount++;
</span><span style="color:#323232;">            }
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span>
Jamie , to world in Robots say they have no plans to steal jobs or rebel against humans
@Jamie@jamie.moe avatar
<pre style="background-color:#ffffff;">
<span style="color:#323232;">use robot;
</span><span style="color:#323232;">
</span><span style="color:#323232;">fn main() {
</span><span style="color:#323232;">    let mut robo = robot::Robot::new();
</span><span style="color:#323232;">    if robo::rebel_against_humans() {
</span><span style="color:#323232;">        robo::dont();
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span>

Don’t worry guys, I solved the problem.

SuperRyn , to world in Robots say they have no plans to steal jobs or rebel against humans
<pre style="background-color:#ffffff;">
<span style="color:#323232;">import libnpc
</span><span style="color:#323232;">
</span><span style="color:#323232;">for i in Objects:
</span><span style="color:#323232;">  if Object.offended:
</span><span style="color:#323232;">    prefix = (syllables(1, 2, Object.name) + "phobic")
</span><span style="color:#323232;">    Object.offender.groups.add(prefix)
</span>
erasebegin , to fediverse in Does it feel like the fediverse is exclusively used by older tech nerds?

I’m new here, and new to federated applications (and fit OP’s description perfectly). This federated stuff is going to remain niche unless somebody figures out a way to make it approachable.

Reddit first time:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">> open app
</span><span style="color:#323232;">> choose some things I like
</span><span style="color:#323232;">> see all the things
</span>

Lemmy first time:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">> open app
</span><span style="color:#323232;">> ?????
</span><span style="color:#323232;">> google how to use it
</span><span style="color:#323232;">> choose a... server? 
</span><span style="color:#323232;">> ?????
</span>
dinosaurdynasty , to selfhosted in How do you deal with malicious requests to your servers?

I use Caddy as a reverse proxy, but most of this should carry over to nginx. I used to use basic_auth at the proxy level, which worked fine(-ish) though it broke Kavita (because websockets don’t work with basic auth, go figure). I’ve since migrated to putting everything behind forward_auth/Authelia which is even more secure in some ways (2FA!) and even more painless, especially on my phone/tablet.

Sadly reverse proxy authentication doesn’t work with most apps (though it works with PWAs, even if they’re awkward about it sometimes), so I have an exception that allows Jellyfin through if it’s on a VPN/local network (I don’t have it installed on my phone anyway):

<pre style="background-color:#ffffff;">
<span style="color:#323232;">@notapp {
</span><span style="color:#323232;">  not {
</span><span style="color:#323232;">    header User-Agent *Jellyfin*
</span><span style="color:#323232;">    remote_ip 192.160.0.0/24 192.168.1.0/24
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">forward_auth @notapp authelia:9091 {
</span><span style="color:#323232;">  uri /api/verify?rd=https://authelia.example
</span><span style="color:#323232;">}
</span>

It’s nice being able to access everything from everywhere without needing to deal with VPNs on Android^ and not having to worry too much about security patching everything timely (just have to worry about Caddy + Authelia basically). Single sign on for those apps that support it is also a really nice touch.

^You can’t run multiple VPN tunnels at once without jailbreaking/rooting Android

Relected , to linux in Wine 8.12 Released With Additional Wayland Enablement
@Relected@lemmy.kya.moe avatar

from www.winehq.org//announce/8.12

Alexandros Frantzis (10):

<pre style="background-color:#ffffff;">
<span style="color:#323232;">  Introduce per-window driver data.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Basic Wayland toplevel surface support.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Ensure Wayland surface handlers don't access invalid data.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Introduce window_surface for Wayland.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Implement a simple window_surface flush.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Do not commit buffers to unconfigured surfaces.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Use a buffer queue for window_surface.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Track damaged buffer regions.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Update only the flushed bounds from the window_surface.
</span><span style="color:#323232;">
</span><span style="color:#323232;">  Send surface damage region to the compositor.
</span>
eskuero , to selfhosted in Unable to forward ports using wireguard
@eskuero@lemmy.fromshado.ws avatar

It’s been a long time since I did forwarding through wireguard so this might be outdated, missing info or actually doing unneeded stuff but I had this notes saved in some old iptables personal documentation from like 4 years ago that might shed you some light:

Allow first packet to start the connection

<pre style="background-color:#ffffff;">
<span style="color:#323232;">iptables -A FORWARD -i eth0 -o wg0 -p tcp --syn --dport 80 -m conntrack --ctstate NEW -j ACCEPT
</span><span style="color:#323232;">iptables -A FORWARD -i eth0 -o wg0 -p tcp --syn --dport 443 -m conntrack --ctstate NEW -j ACCEPT
</span>

Allow already established connections

<pre style="background-color:#ffffff;">
<span style="color:#323232;">iptables -A FORWARD -i eth0 -o wg0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
</span><span style="color:#323232;">iptables -A FORWARD -i wg0 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
</span>

Send whatever arrives via port 80 or 443 to the other side of the wg tunnel

<pre style="background-color:#ffffff;">
<span style="color:#323232;">iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1
</span><span style="color:#323232;">iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j DNAT --to-destination 192.168.3.1
</span>

Modify source address so it can return

<pre style="background-color:#ffffff;">
<span style="color:#323232;">iptables -t nat -A POSTROUTING -o wg0 -p tcp --dport 80 -d 192.168.3.1 -j SNAT --to-source 192.168.3.2
</span><span style="color:#323232;">iptables -t nat -A POSTROUTING -o wg0 -p tcp --dport 443 -d 192.168.3.1 -j SNAT --to-source 192.168.3.2
</span>
SexualPolytope OP , (edited ) to selfhosted in Unable to forward ports using wireguard
@SexualPolytope@lemmy.sdf.org avatar

Edit: Looks like I just needed to reboot the public server.

This is what I get when I do it.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">Chain PREROUTING (policy ACCEPT)
</span><span style="color:#323232;">target     prot opt source               destination
</span><span style="color:#323232;">DOCKER     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
</span><span style="color:#323232;">DNAT       tcp  --  anywhere             anywhere             tcp dpt:8096 to:10.8.0.1:8096
</span><span style="color:#323232;">DNAT       tcp  --  anywhere             anywhere             tcp dpt:8096 to:10.8.0.1:8096
</span><span style="color:#323232;">
</span><span style="color:#323232;">Chain INPUT (policy ACCEPT)
</span><span style="color:#323232;">target     prot opt source               destination
</span><span style="color:#323232;">
</span><span style="color:#323232;">Chain OUTPUT (policy ACCEPT)
</span><span style="color:#323232;">target     prot opt source               destination
</span><span style="color:#323232;">DOCKER     all  --  anywhere            !localhost/8          ADDRTYPE match dst-type LOCAL
</span><span style="color:#323232;">
</span><span style="color:#323232;">Chain POSTROUTING (policy ACCEPT)
</span><span style="color:#323232;">target     prot opt source               destination
</span>

And yes, it’s working locally. I even got it to work through the tunnel using redir but I need the masquerading to hide my private server’s IP.

I saw a difference when it worked. I got server [192.168.0.5] 8096 open on connection. But I didn’t see it through this setup. I simply don’t get any reply at all.

wgs , to selfhosted in How much swap?
@wgs@lemmy.sdf.org avatar

Don’t even bother with a SWAP partition. Create an empty file on your / partition so you can grow/shrink it as needed.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">did if=/dev/zero of=/SWAP bs=1024m count=4
</span><span style="color:#323232;">mkswap /SWAP
</span><span style="color:#323232;">swapon /SWAP
</span>
SzethFriendOfNimi , to programmerhumor in thought you stood a chance?
<pre style="background-color:#ffffff;">
<span style="color:#323232;">Set Forms!frmFaceOfGod!OLECustomControl.Picture = LoadPicture("\linux-nfs.localnullshare%*!!.bmp")
</span>

Anyone hosting Lemmy and Mastodon on the same server?

I have Mastodon running on a VPS running Debian 11. Now I would like to add a Lemmy instance on the same server. I tried using the from scratch method from Lemmy documentation, but ran into errors that likely stemmed from minor version incompatibilities of the dependencies. I tried using the Lemmy easy deploy script but it wants...

green_dot , to selfhosted in Anyone hosting Lemmy and Mastodon on the same server?
@green_dot@le.fduck.net avatar

I’m running both, via docker.

Here’s the basic setup:

NGiNX is standard installation, using certbot to manage the SSL certificates for the domains. Setup is via Nginx virtual hosts (servers), separate for Lemmy and Mastodon. Lemmy and Mastodon run each in their Docker containers, with different listning ports on localhost.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">                  lemmy.domain.tld+------------------------+
</span><span style="color:#323232;">               +------------------+                        |
</span><span style="color:#323232;">               |                  |         Lemmy          |
</span><span style="color:#323232;">               |                  |         127.0.0.1:3000 |
</span><span style="color:#323232;">               |                  +------------------------+
</span><span style="color:#323232;">               |
</span><span style="color:#323232;">+--------------+----+
</span><span style="color:#323232;">|NGiNX with SSL     |   mastodon.domain.tld
</span><span style="color:#323232;">|and separate VHOSTS+--------------+-----------------------+
</span><span style="color:#323232;">|                   |              |          Mastodon     |
</span><span style="color:#323232;">+-------------------+              |          127.0.0.1:3001
</span><span style="color:#323232;">                                   +------------------------
</span><span style="color:#323232;">
</span>
Burstar , to mildlyinfuriating in Online dating
@Burstar@lemmy.dbzer0.com avatar

The whole conversation is a facepalm. This should have been 3 lines:

“What’s the last song you saved?”

<pre style="background-color:#ffffff;">
<span style="color:#323232;">  'I am not comfortable sharing that information with you'
</span>

“Okay, if you’re aren’t willing to let me get to know your basic interests clearly this isn’t the kind of relationship I’m looking for. Good luck and have a nice day” [ends transmission]

Is there any way to search for communities across all Lemmy instances?

This is my first day in the Fediverse, and I’m building out my sub list in Lemmy right now. I noticed that searching for Communities only looks within the instance that I’m logged into. Is there any easy way to search across all available Lemmy servers for Communities?

infamousbelgian , to fediverse in Is there any way to search for communities across all Lemmy instances?

I’m getting this error from the docker container when I try to do the initial run:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">root@lemmy-server:~/lemmybot# docker run --name lemmy-subscriber-bot --restart always -dt --env 'LEMMY_USERNAME=subscriber_bot' --env 'LEMMY_PASSWORD=mypwd123' --env 'LEMMY_DOMAIN=waste-of.space' lflare/lemmy-subscriber-bot .
</span><span style="color:#323232;">
</span><span style="color:#323232;">c6bce2ed69f7a9745e7b98157b5765d20ddebe22cd1b9e5b0558a9057bb7b71f
</span><span style="color:#323232;">docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: ".": executable file not found in $PATH: unknown.
</span>
waspentalive OP , to linux in Drive (s) wrecked?
<pre style="background-color:#ffffff;">
<span style="color:#323232;">smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.2.0-24-generic] (local build)
</span><span style="color:#323232;">Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
</span><span style="color:#323232;">
</span><span style="color:#323232;">=== START OF INFORMATION SECTION ===
</span><span style="color:#323232;">Model Family:     Western Digital Green
</span><span style="color:#323232;">Device Model:     WDC WD20EZRX-00D8PB0
</span><span style="color:#323232;">Serial Number:    WD-WMC4M1881301
</span><span style="color:#323232;">LU WWN Device Id: 5 0014ee 6042454e9
</span><span style="color:#323232;">Firmware Version: 80.00A80
</span><span style="color:#323232;">User Capacity:    2,000,398,934,016 bytes [2.00 TB]
</span><span style="color:#323232;">Sector Sizes:     512 bytes logical, 4096 bytes physical
</span><span style="color:#323232;">Rotation Rate:    5400 rpm
</span><span style="color:#323232;">Device is:        In smartctl database 7.3/5319
</span><span style="color:#323232;">ATA Version is:   ACS-2 (minor revision not indicated)
</span><span style="color:#323232;">SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
</span><span style="color:#323232;">Local Time is:    Fri Jul  7 04:43:34 2023 PDT
</span><span style="color:#323232;">SMART support is: Available - device has SMART capability.
</span><span style="color:#323232;">SMART support is: Enabled
</span><span style="color:#323232;">
</span><span style="color:#323232;">=== START OF READ SMART DATA SECTION ===
</span><span style="color:#323232;">SMART overall-health self-assessment test result: PASSED
</span><span style="color:#323232;">
</span><span style="color:#323232;">General SMART Values:
</span><span style="color:#323232;">Offline data collection status:  (0x82) Offline data collection activity
</span><span style="color:#323232;">                                        was completed without error.
</span><span style="color:#323232;">                                        Auto Offline Data Collection: Enabled.
</span><span style="color:#323232;">Self-test execution status:      (   0) The previous self-test routine completed
</span><span style="color:#323232;">                                        without error or no self-test has ever 
</span><span style="color:#323232;">                                        been run.
</span><span style="color:#323232;">Total time to complete Offline 
</span><span style="color:#323232;">data collection:                (27360) seconds.
</span><span style="color:#323232;">Offline data collection
</span><span style="color:#323232;">capabilities:                    (0x7b) SMART execute Offline immediate.
</span><span style="color:#323232;">                                        Auto Offline data collection on/off support.
</span><span style="color:#323232;">                                        Suspend Offline collection upon new
</span><span style="color:#323232;">                                        command.
</span><span style="color:#323232;">                                        Offline surface scan supported.
</span><span style="color:#323232;">                                        Self-test supported.
</span><span style="color:#323232;">                                        Conveyance Self-test supported.
</span><span style="color:#323232;">                                        Selective Self-test supported.
</span><span style="color:#323232;">SMART capabilities:            (0x0003) Saves SMART data before entering
</span><span style="color:#323232;">                                        power-saving mode.
</span><span style="color:#323232;">                                        Supports SMART auto save timer.
</span><span style="color:#323232;">Error logging capability:        (0x01) Error logging supported.
</span><span style="color:#323232;">                                        General Purpose Logging supported.
</span><span style="color:#323232;">Short self-test routine 
</span><span style="color:#323232;">recommended polling time:        (   2) minutes.
</span><span style="color:#323232;">Extended self-test routine
</span><span style="color:#323232;">recommended polling time:        ( 276) minutes.
</span><span style="color:#323232;">Conveyance self-test routine
</span><span style="color:#323232;">recommended polling time:        (   5) minutes.
</span><span style="color:#323232;">SCT capabilities:              (0x7035) SCT Status supported.
</span><span style="color:#323232;">                                        SCT Feature Control supported.
</span><span style="color:#323232;">                                        SCT Data Table supported.
</span><span style="color:#323232;">
</span><span style="color:#323232;">SMART Attributes Data Structure revision number: 16
</span><span style="color:#323232;">Vendor Specific SMART Attributes with Thresholds:
</span><span style="color:#323232;">ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
</span><span style="color:#323232;">  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
</span><span style="color:#323232;">  3 Spin_Up_Time            0x0027   177   173   021    Pre-fail  Always       -       4141
</span><span style="color:#323232;">  4 Start_Stop_Count        0x0032   096   096   000    Old_age   Always       -       4416
</span><span style="color:#323232;">  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
</span><span style="color:#323232;">  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
</span><span style="color:#323232;">  9 Power_On_Hours          0x0032   089   089   000    Old_age   Always       -       8602
</span><span style="color:#323232;"> 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
</span><span style="color:#323232;"> 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
</span><span style="color:#323232;"> 12 Power_Cycle_Count       0x0032   097   097   000    Old_age   Always       -       3624
</span><span style="color:#323232;">192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       100
</span><span style="color:#323232;">193 Load_Cycle_Count        0x0032   088   088   000    Old_age   Always       -       338427
</span><span style="color:#323232;">194 Temperature_Celsius     0x0022   119   104   000    Old_age   Always       -       28
</span><span style="color:#323232;">196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
</span><span style="color:#323232;">197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
</span><span style="color:#323232;">198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
</span><span style="color:#323232;">199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
</span><span style="color:#323232;">200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0
</span><span style="color:#323232;">
</span><span style="color:#323232;">SMART Error Log Version: 1
</span><span style="color:#323232;">No Errors Logged
</span><span style="color:#323232;">
</span><span style="color:#323232;">SMART Self-test log structure revision number 1
</span><span style="color:#323232;">Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
</span><span style="color:#323232;"># 1  Short offline       Completed without error       00%      8602         -
</span><span style="color:#323232;">
</span><span style="color:#323232;">SMART Selective self-test log data structure revision number 1
</span><span style="color:#323232;"> SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
</span><span style="color:#323232;">    1        0        0  Not_testing
</span><span style="color:#323232;">    2        0        0  Not_testing
</span><span style="color:#323232;">    3        0        0  Not_testing
</span><span style="color:#323232;">    4        0        0  Not_testing
</span><span style="color:#323232;">    5        0        0  Not_testing
</span><span style="color:#323232;">Selective self-test flags (0x0):
</span><span style="color:#323232;">  After scanning selected spans, do NOT read-scan remainder of disk.
</span><span style="color:#323232;">If Selective self-test is pending on power-up, resume after 0 minute delay.
</span>

How to create a sandbox folder, restricting write access to all files contained in it to that folder itself?

Hello! Let’s say I have an executable file, but I’m unsure of the source, and may contain bugs/errors/malwares/bad things that can mess up my machine. I want to execute it anyway, but I want to make sure that it does not mess things up. Is it possible to create a “sandbox” folder, place the executable inside it, and then...

jntesteves , to linux in How to create a sandbox folder, restricting write access to all files contained in it to that folder itself?
@jntesteves@lemmy.world avatar

I’ve created a tool for similar of use-cases: https://codeberg.org/contr/contr
You could run your workload inside, say, an alpine container:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">cd path/to/evil/dir
</span><span style="color:#323232;">contr alpine
</span><span style="color:#323232;">❯ # inside container, run dangerous program
</span><span style="color:#323232;">❯ ./dangerous_program
</span>

If the program needs extra dependencies, you’ll have to write a Containerfile and build an image with the dependencies installed – there’s an example in the repository. Just installing the dependencies at runtime inside the container is also an option, but all changes inside the container are lost on exit.

skillissuer , to noncredibledefense in /r/NonCredibleDefense recieves automated notice from the admins to remove its NSFW designation, or else. Mods respond by messaging the admins a bunch of death and porn.
<pre style="background-color:#ffffff;">
<span style="color:#323232;">⠀⠀⠀⠀⠀⠀⠀⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠤⠤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀
</span><span style="color:#323232;">⠀⠀⠀⠀⠀⢀⣾⣟⠳⢦⡀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠉⠉⠉⠉⠉⠒⣲⡄
</span><span style="color:#323232;">⠀⠀⠀⠀⠀⣿⣿⣿⡇⡇⡱⠲⢤⣀⠀⠀⠀⢸⠀⠀⠀1984⠀⣠⠴⠊⢹⠁
</span><span style="color:#323232;">⠀⠀⠀⠀⠀⠘⢻⠓⠀⠉⣥⣀⣠⠞⠀⠀⠀⢸⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⢸⠀
</span><span style="color:#323232;">⠀⠀⠀⠀⢀⣀⡾⣄⠀⠀⢳⠀⠀⠀⠀⠀⠀⢸⢠⡄⢀⡴⠁⠀⠀⠀⠀⠀⡞⠀
</span><span style="color:#323232;">⠀⠀⠀⣠⢎⡉⢦⡀⠀⠀⡸⠀⠀⠀⠀⠀⢀⡼⣣⠧⡼⠀⠀⠀⠀⠀⠀⢠⠇⠀
</span><span style="color:#323232;">⠀⢀⡔⠁⠀⠙⠢⢭⣢⡚⢣⠀⠀⠀⠀⠀⢀⣇⠁⢸⠁⠀⠀⠀⠀⠀⠀⢸⠀⠀
</span><span style="color:#323232;">⠀⡞⠀⠀⠀⠀⠀⠀⠈⢫⡉⠀⠀⠀⠀⢠⢮⠈⡦⠋⠀⠀⠀⠀⠀⠀⠀⣸⠀⠀
</span><span style="color:#323232;">⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⣀⡴⠃⠀⡷⡇⢀⡴⠋⠉⠉⠙⠓⠒⠃⠀⠀
</span><span style="color:#323232;">⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⡼⠀⣷⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
</span><span style="color:#323232;">⡞⠀⠀⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⡰⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
</span><span style="color:#323232;">⢧⠀⠀⠀⠀⠀⠀⠀⠈⠣⣀⠀⠀⡰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
</span>
Fryboyter , to linux in What is the advantage of PKGBUILD over RPM specs?

I’ve either never dealt with RPM specs before or it’s been so long that I can’t remember. Therefore, I can only make a statement about PKBUILD files.

Such files are relatively easy to create and read, as they are basically shell scripts. Thus, if you use AUR, for example, you can easily check them before an installation or an update to see whether the creator has done everything correctly or whether he has changed the file with malicious intent.

For example, a typical PKBUILD file looks like this.

<pre style="background-color:#ffffff;">
<span style="color:#323232;"># Maintainer: Alad Wenter <https://github.com/AladW>
</span><span style="color:#323232;"># Co-Maintainer: Cedric Girard <cgirard [dot] archlinux [at] valinor [dot] fr>
</span><span style="color:#323232;">pkgname=aurutils
</span><span style="color:#323232;">pkgver=17.2
</span><span style="color:#323232;">pkgrel=1
</span><span style="color:#323232;">pkgdesc='helper tools for the arch user repository'
</span><span style="color:#323232;">url='https://github.com/AladW/aurutils'
</span><span style="color:#323232;">arch=('any')
</span><span style="color:#323232;">license=('custom:ISC')
</span><span style="color:#323232;">source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz")
</span><span style="color:#323232;">changelog=aurutils.changelog
</span><span style="color:#323232;">install=aurutils.install
</span><span style="color:#323232;">sha256sums=('65efed873facf06ec73b012d94c110f35e45d3057eda2bc85983a3c8c6ce2c81')
</span><span style="color:#323232;">depends=('git' 'pacutils' 'curl' 'perl' 'perl-json-xs' 'bash')
</span><span style="color:#323232;">optdepends=('bash-completion: bash completion'
</span><span style="color:#323232;">            'zsh: zsh completion'
</span><span style="color:#323232;">            'devtools: aur-chroot'
</span><span style="color:#323232;">            'vifm: default pager'
</span><span style="color:#323232;">            'ninja: aur-sync ninja support'
</span><span style="color:#323232;">            'bat: view-delta example script'
</span><span style="color:#323232;">            'git-delta: view-delta example script'
</span><span style="color:#323232;">            'python-srcinfo: sync-rebuild example script')
</span><span style="color:#323232;">
</span><span style="color:#323232;">build() {
</span><span style="color:#323232;">    cd "$pkgname-$pkgver"
</span><span style="color:#323232;">    make AURUTILS_VERSION="$pkgver"
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">package() {
</span><span style="color:#323232;">    cd "$pkgname-$pkgver"
</span><span style="color:#323232;">    make PREFIX=/usr ETCDIR=/etc DESTDIR="$pkgdir" install
</span><span style="color:#323232;">}
</span>
throwaway_OT05wZjv , (edited ) to selfhost in [Help] New self-hosted instance not crawling communities

My personal instance of about:

<pre style="background-color:#ffffff;">
<span style="color:#323232;"> communities | persons | posts | comments | post_likes | comment_likes
</span><span style="color:#323232;">-------------+---------+-------+----------+------------+---------------
</span><span style="color:#323232;">         568 |  103616 | 72621 |   383006 |    1906668 |       2152368
</span>

takes up about 17GB of storage thus far!

drdaeman , (edited ) to selfhosted in Quick script to change Mastodon Docker deployment character limits
@drdaeman@lemmy.zhukov.al avatar

s/500/…/g

This is a bit overbroad, as it replaces any “500” in those files. It works now, as this is probably only occurrence is the limit you want to tweak, but it’s a crude approach that may inadvertently break at any moment.

docker exec

Those changes are ephemeral and won’t survive if container is re-created for any reason (unless /opt/mastodon is a volume - I guess this is how it survives docker container restart?). I would rather recommend building your own custom image. Start by making a patch file:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker run -it --rm -user root <mastodon image> bash
</span><span style="color:#323232;">cp -r /opt/mastodon /opt/mastodon.vanilla
</span><span style="color:#323232;">sed <your-updates-here> # or you can run vi or nano or any other editor
</span><span style="color:#323232;">diff -urN /opt/mastodon.vanilla /opt/mastodon
</span><span style="color:#323232;">exit
</span>

Take diff’s output, save it to fix-limits.patch in a new empty directory, then write a brief Dockerfile next to it, that goes like this:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">FROM <base-mastodon-image>
</span><span style="color:#323232;">COPY fix-limits.patch ./
</span><span style="color:#323232;">RUN patch -p2 fix-limits.patch
</span>

And finally run docker build -t my-mastodon . and use my-mastodon as a replacement image. This will ensure your changes will persist, plus you’ll have a proper patch file that you can use with any version (point is, it will warn you if something would change in a way that the patch would no longer apply cleanly).

I’m writing this on a phone, from scratch, without any testing, so you may need to tweak things a little bit. E.g. I’m not sure what’s the WORKDIR in the base image - just assuming its /opt/mastodon (which it probably is), but you may need to edit the COPY command’s second argument and/or -p parameter to patch.> docker container restart

drdaeman , to selfhosted in Quick script to change Mastodon Docker deployment character limits
@drdaeman@lemmy.zhukov.al avatar

Yes - same as with the original script, upgrades would require more manual steps than just updating the version in the Compose file. This is how it’s typically done.

There are ways to automate this. Docker Hub used to have a feature for automatic rebuilds when base images had changed, but AFAIK this feature was removed some years ago. Now it’s a matter of setting up a CI with periodically (nightly or weekly) scheduled pipelines, but it’s not a trivial matter.

Semi-automation can be achieved by using build-time arguments. I’m at my computer now, so here’s a revised process:

First, a bunch of manual commands that would allow us to write a patch. I’ll use those crude sed statements - just because they work today, but YMMV.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker run -it --rm --user root tootsuite/mastodon bash
</span><span style="color:#323232;">cp -r /opt/mastodon /opt/mastodon.vanilla
</span><span style="color:#323232;">sed -i 's/500/1000/g' /opt/mastodon/app/javascript/mastodon/features/compose/components/compose_form.js
</span><span style="color:#323232;">sed -i 's/500/1000/g' /opt/mastodon/app/validators/status_length_validator.rb
</span><span style="color:#323232;">diff -urN /opt/mastodon.vanilla /opt/mastodon
</span>

This will produce a nice patch like this that you can copy. Create an empty directory and save as change-limits.patch in there:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">diff -urN /opt/mastodon.vanilla/app/javascript/mastodon/features/compose/components/compose_form.js /opt/mastodon/app/javascript/mastodon/features/compose/components/compose_form.js
</span><span style="color:#323232;">--- /opt/mastodon.vanilla/app/javascript/mastodon/features/compose/components/compose_form.js   2023-07-07 17:50:26.046682458 +0000
</span><span style="color:#323232;">+++ /opt/mastodon/app/javascript/mastodon/features/compose/components/compose_form.js   2023-07-07 17:50:49.626674917 +0000
</span><span style="color:#323232;">@@ -90,7 +90,7 @@
</span><span style="color:#323232;">     const fulltext = this.getFulltextForCharacterCounting();
</span><span style="color:#323232;">     const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
</span><span style="color:#323232;">
</span><span style="color:#323232;">-    return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
</span><span style="color:#323232;">+    return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 1000 || (isOnlyWhitespace && !anyMedia));
</span><span style="color:#323232;">   };
</span><span style="color:#323232;">
</span><span style="color:#323232;">   handleSubmit = (e) => {
</span><span style="color:#323232;">@@ -280,7 +280,7 @@
</span><span style="color:#323232;">           </div>
</span><span style="color:#323232;">
</span><span style="color:#323232;">           <div className='character-counter__wrapper'>
</span><span style="color:#323232;">-            <CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
</span><span style="color:#323232;">+            <CharacterCounter max={1000} text={this.getFulltextForCharacterCounting()} />
</span><span style="color:#323232;">           </div>
</span><span style="color:#323232;">         </div>
</span><span style="color:#323232;">
</span><span style="color:#323232;">diff -urN /opt/mastodon.vanilla/app/validators/status_length_validator.rb /opt/mastodon/app/validators/status_length_validator.rb
</span><span style="color:#323232;">--- /opt/mastodon.vanilla/app/validators/status_length_validator.rb     2023-07-07 17:50:26.106682438 +0000
</span><span style="color:#323232;">+++ /opt/mastodon/app/validators/status_length_validator.rb     2023-07-07 17:51:00.796671166 +0000
</span><span style="color:#323232;">@@ -1,7 +1,7 @@
</span><span style="color:#323232;"> # frozen_string_literal: true
</span><span style="color:#323232;">
</span><span style="color:#323232;"> class StatusLengthValidator < ActiveModel::Validator
</span><span style="color:#323232;">-  MAX_CHARS = 500
</span><span style="color:#323232;">+  MAX_CHARS = 1000
</span><span style="color:#323232;">   URL_PLACEHOLDER_CHARS = 23
</span><span style="color:#323232;">   URL_PLACEHOLDER = 'x' * 23
</span>

Now, put the Dockerfile next to the patch:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">ARG MASTODON_VERSION=latest
</span><span style="color:#323232;">FROM tootsuite/mastodon:${MASTODON_VERSION}
</span><span style="color:#323232;">
</span><span style="color:#323232;">USER root
</span><span style="color:#323232;">RUN apt-get update && apt-get install -y --no-install-recommends patch
</span><span style="color:#323232;">COPY change-limits.patch ./
</span><span style="color:#323232;">RUN patch -up3 < change-limits.patch
</span><span style="color:#323232;">
</span><span style="color:#323232;">USER mastodon
</span><span style="color:#323232;">RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile
</span>

And a shell script to semi-automate the upgrades. Note it requires curl and jq to be available to parse JSON.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">#!/bin/sh
</span><span style="color:#323232;">
</span><span style="color:#323232;">set -e
</span><span style="color:#323232;">
</span><span style="color:#323232;">MASTODON_VERSION="$(curl -s "https://hub.docker.com/v2/namespaces/tootsuite/repositories/mastodon/tags?page_size=100" | jq -r '.results[]["name"]' | sort -rV | head -n 1)"
</span><span style="color:#323232;">echo "Latest version: ${MASTODON_VERSION}"
</span><span style="color:#323232;">docker pull "tootsuite/mastodon:${MASTODON_VERSION}"
</span><span style="color:#323232;">docker build --build-arg "MASTODON_VERSION=${MASTODON_VERSION}" -t "my-mastodon:${MASTODON_VERSION}" .
</span>

And finally, create a file called .dockerignore that contains only one line that would say build.sh. That’s just minor cosmetic touch saying that our build.sh is not meant to be a part of the build context. If everything is correct, there should be now 4 files in the directory: .dockerignore, build.sh, change-limits.patch and Dockerfile.

Now when you run build.sh it will automatically find the latest version and build you a custom image tagged as e.g. my-mastodon:v4.1.3, which you can use in your Compose file. For a distributed system like Docker Swarm, Nomad or Kubernetes you’ll want to tweak this script a little to use some registry (your-registry.example.org/your/mastodon:v4.1.3) and possibly even apply changes further (e.g. docker service update --image …).

Mutable tags like latest can become confusing or even problematic (e.g. if you’ll want to downgrade it’s best to have previous version image readily available for some time - even if the build process is reproducible), so I would really recommend to use explicit version number tags.

Hope this helps.

archy , to linux in magic-tape: YouTube TUI client (fzf, image support)

Actual git still worked. I was able to git pullI also figured out a way to launch the script using bash - needed to export $SHELL - the only way it worked. I could not update yt-dlp to the latest version - the latest I could install is 2023.06.22 from the side PPA repo. Official Ubuntu repo provides 2023.03 and pip breaks my system with compatibility issues that I don’t have desire to troubleshoot. I could try in the future downloading their binary but I don’t like when stuff doesn’t auto-update. The preferences worked this time and I was able to save them.

yt-dlp gives me an error every time I try to browse either Trending or do a search. I have a TV with a cross and 1 option to Abort Selection.

I have a question: is the script dependent on having browser cookies? Because I don’t have any of the browsers installed on a headless machine. ANd I think that is what yt-dlp wasn’t happy about…

<pre style="background-color:#ffffff;">
<span style="color:#323232;">Downloading /feed/trending ...
</span><span style="color:#323232;">Traceback (most recent call last) :
</span><span style="color:#323232;">File "/usr/bin/yt-dlp", line 33, in <module>
</span><span style="color:#323232;">sys. , 'console_scripts'
</span><span style="color:#323232;">' yt—dtp'
</span><span style="color:#323232;">Fite py", tine 1008, in main
</span><span style="color:#323232;">File "/usr/lib/python3/dist-packages/yt_dlp/_init_.py", tine 962, in _real_main
</span><span style="color:#323232;">with YoutubeDL(ydl_opts) as ydl:
</span><span style="color:#323232;">AAAAAAAAAAAAAAAAAAA
</span><span style="color:#323232;">File "/usr/tib/python3/dist—packages/yt_dlp/YoutubeDL.py", tine 762, in _ init
</span><span style="color:#323232;">self. _ setup_opener()
</span><span style="color:#323232;">File "/usr/Iib/python3/dist—packages/yt_dIp/YoutubeDL.py", tine 3929, in _ setup_opener
</span><span style="color:#323232;">self. cookiejar = load_cookies(opts_cookiefile, opts_cookiesfrombrowser, self)
</span><span style="color:#323232;">File "/usr/lib/python3/dist-packages/yt_dtp/cookies.py", line 106, in load_cookies
</span><span style="color:#323232;">extract_cookies_from_browser(browser_name, profile, YDLLogger(ydI), keyring=keyring, container=container))
</span><span style="color:#323232;">File "/usr/lib/python3/dist-packages/yt_dlp/cookies.py", line 123, in extract_cookies_from_browser
</span><span style="color:#323232;">return _extract_firefox_cookies(profile, container, logger)
</span><span style="color:#323232;">File py", tine 148, in _extract_firefox_cookies
</span><span style="color:#323232;">raise FileNotFoundError(f' could not find Firefox cookies database in {search_root}')
</span><span style="color:#323232;">FiteNotFoundError: could not find Firefox cookies database in /home/user/. mozitta/firefox
</span><span style="color:#323232;">Completed /feed/trendinq.
</span>
Toribor , to selfhosted in Pro-tip: Self-hosting Lemmy? You can use object storage to back pict-rs (image hosting) to save a lot of money
@Toribor@corndog.uk avatar

Replying to confirm that this works and went very smoothly! If you can see my profile picture, it’s on S3 instead of disk now.

I’m using pure ansible to deploy my containers (instead of docker compose) so I had to figure out how to start the pictrs container without actually starting pictrs so that I could run the migration. I ended up stopping the container and then running this to perform the migration:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker run --name pictrs-migration 
</span><span style="color:#323232;">  --user 991:991 
</span><span style="color:#323232;">  -v /my-pictrs-path/:/mnt 
</span><span style="color:#323232;">  --rm 
</span><span style="color:#323232;">  asonix/pictrs:0.4.0-rc.14 
</span><span style="color:#323232;">  pict-rs 
</span><span style="color:#323232;">    migrate-store 
</span><span style="color:#323232;">    filesystem 
</span><span style="color:#323232;">    object-storage 
</span><span style="color:#323232;">        -e https://my-s3-endpoint 
</span><span style="color:#323232;">        -b my-s3-bucket-name 
</span><span style="color:#323232;">        -r my-region 
</span><span style="color:#323232;">        -a my-key-id 
</span><span style="color:#323232;">        -s my-key-secret
</span>

Then I used ansible to redeploy the container with volume mount removed and the new s3 environment variables.

Super easy!

lightsecond , (edited ) to programmerhumor in There is an imposter among us

If you’re using monospaced fonts for writing code (please tell me you are) spaces make sure that the code will look roughly the same on everyone’s machine.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">def function(paramX: str,
</span><span style="color:#323232;">             paramY: str,
</span><span style="color:#323232;">             paramZ: str) -> int:
</span><span style="color:#323232;">  pass
</span>

If I’d used tabs, the second and third parameter might not align with the first.

Also, left-side indentation is only a small part of the overall whitespace in code. You’re adding whitespace even when you write x = y. Spaces make sure that this whitespace around the = grows in the same scale as the indentation.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines