r/linuxdev • • Jun 10 '23

I wanted to ask why would I download Linux

3 Upvotes

Hello,

So I'm new to this community (not new to Linux, been using Ubuntu and Fedora for quite some time). I was thinking of buying a new laptop in the near future, and I wanted to decide between a Mac and another Thinkpad (the laptop I have currently, and I really liked it), which brings me to my question.

Why would I get a Thinkpad and install Linux, vs getting a Mac which is Unix based to begin with along with having amazing battery life with it's M2 chip (Ignore price as a factor)?

I was looking back through my Linux journey and I've realized that Linux has had multiple problems for me, such as having issues with dual booting, issues with Microphone and Speakers, distros not fitting on screens,Linux and such.

I was also wondering, couldn't you do most of your stuff regarding linux dev in Macs? as well? I wanted to ask what about Linux can you not reproduce without a high amount of effort on macs.

(Also I wanted to ask whether, in terms of security, are macs inherently better than linux).

Thank you :)


r/linuxdev • • Apr 24 '23

Introducing ManRepository: An Linux Manual page for Ubuntu/ Debian / Arch Linux,...

3 Upvotes

Hello everyone,
I often read Linux manuals pages online and I noticed some issues.
- Often they don't have the manuals of the software I use
- The formatting of the man pages not easily to read
So I decided to create new site to fix this issues and called it ManRepository.com.
It currently indexes all package information of Ubuntu, Debian, and Arch Linux. And displays all man page documents of each package. The man pages are formatted in HTML, making it easy to read them on any device because the website supports responsive design.
Website watch package updates in the repositories and quickly indexes any newly added manuals in the package.
I've already been using the site for a while, and I believe it will be just as helpful to you. Please feel free to try it out and share your feedback with me to help make this project even more useful.
Thank you so much.


r/linuxdev • • Dec 17 '22

How to create a flatpak pakage of an application written in python with pyside6 and rust?

Thumbnail reddit.com
3 Upvotes

r/linuxdev • • Nov 19 '22

How can I send CLI commands to a service in the background

3 Upvotes

I am building an app that will run in the background as a service.

However I cannot figure out how to send commands from the CLI. I've looked into DBus while it does work, it doesn't seem to be the way any other apps/services does it.

For example I've launched the `dbus-monitor`, and ran a bunch of commands to `netstat`, `nftables` etc. And none are using DBus. So what are they using to communicate with the service running in the background?

I would like to send commands such as: `customappname refresh`, `customappname add 'something'` and so forth.

I'd like this to work on as many linux operating systems as possible.

Any info would be great. Thanks.


r/linuxdev • • Aug 24 '22

How to add destructive flag to fsck.exfat that will allow proper repairs (deleting corrupt files)?

3 Upvotes

Fsck.exfat (both the built in one on Ubuntu and the one you get if you install exfat-fuse, assuming they're different) don't seem to be capable of repairing the most common corruption I'm experiencing on ExFAT filesystems.

Every time an ExFAT filesystem breaks (or at least, most times) it's due to a failed file copy resulting in this error during fsck.exfat with any flags:

ERROR /file/location/filename.ext first cluster is wrong. Truncate (y/N)? N

There doesn't seem to be a way to force it to actually fix those files, as it enters "n" for you every time. I've tried every flag available in --help, including the ones that say they will automatically repair it. Even the interactive flag fills in the no response for every file, and isn't in any way interactive.

I'm assuming this is just a poorly worded way to ensure that data isn't accidentally deleted, but what would it take to get a Force override option that actually address the files, and removes them? When I delete the files manually (it lists all the files) fsck reports the filesystem is fine, and I'm able to use it again.

Or is this a bug I should just file a bug report for?

The error:

Files corrupted 5, files fixed 0

Fsck from version util-Linux 2.37.2 Exfatprogs 1.1.3

Ubuntu 22.04.1


r/linuxdev • • May 18 '22

Rough estimate on work involved to get linux camera driver written?

3 Upvotes

This is with regard to the Pinephone Pro which at this time still does not have working cameras.

Apparently they loaded up an Android image to make sure they worked physically.

I'm just curious "abstract/high level" what kind of work is involved to get that done.


r/linuxdev • • Mar 22 '22

Why might a call to sem_wait cause a thread to exit?

3 Upvotes

I can't share my exact code as it's work specific, but I've run into an absolutely baffling issue.

Let's say I have a codebase that looks like such:

#include <semaphore.h>

typedef Queue_s Queue_t; //Arbitrary struct

//The actual code deals with queues, so I've stuck with that example here
struct Queue_s{
sem_t sem;
//Other, currently unimportant queue functions
};

static Queue_t g_queueContainer[NUMBER_OF_QUEUES]//Static list of queues for the 
                                                 //current process
static uint32_t g_containerIndex;
static sem_t    g_libraryMutex;

void Queue_Library_Init()
{
    sem_init(&g_libraryMutex, 0, 1); //Semaphore is for the current process only, 
                                     //size of 1
    (void)memset(g_queueContainer, 0, sizeof(Queue_t) * NUMBER_OF_QUEUES);
    g_containerIndex = 0;
}

void Queue_Do_Stuff()
{
    //Assume that queue is NOT NULL. In real code I would assert
    sem_wait(&g_libraryMutex)
    
    //access the static list of objects
    //Assume this function neither waits, nor has infinite loops.
    //(i.e. its number of operations is FIXED)

    sem_post(&g_libraryMutex);
}

Now, let's assume that Queue_Library_Init() is called ONCE in the main function, and Queue_Do_Stuff() is called an indeterminate number of times. Also assume that semaphores are NEVER destroyed, and once a queue has been allocated and g_containerIndex is incremented, it can never be deallocated or decremented. Once a queue is created, its existence in memory is FIXED.

Eventually, some nth call to Queue_Do_Stuff() causes my running thread to exit with an exit code of zero and no errors. It exits on the call to sem_wait().

Upon running strace on my program, I can see that the very last system call that is made is

futex(/*arbitrary value*/, FUTEX_WAIT_PRIVATE, /*arbitrary value/).

and then exit(0). Several of my more senior coworkers and I have stepped through the code and are completely baffled.

We're trying to port our existing codebase to POSIX, and we're using Ubuntu 20.04 for testing (This is an embedded, avionics use case, so every object that we create in memory we LEAVE in memory for determinism)

Without the actual codebase, I know this is impossible to debug...But would anyone with more experience with Linux system calls have any advice to push us in the right direction?


r/linuxdev • • Feb 19 '22

Linux kernel mailling list

3 Upvotes

How do I access the linux kernel mailing list and find work to do on the kernel


r/linuxdev • • Feb 05 '22

How does and when does one be assertive on a mailing list?

3 Upvotes

There's this seemingly insignificant issue with grub-mkconfig and os-proberwhere it doesn't correctly parse and emit multiple initrd paths on the same initrd line in grub.cfg. If not correctly patched, the paths get strung together with carets, causing the boot to freeze. Most distros that actually depend on this, eg, Manjaro, already patch both packages. I'm a downstream os-prober package maintainer. I don't maintain grub. To support correct parsing of the initrd line to successfully dual boot Manjaro, both grub and os-prober need to be patched. I patched it on my end, but the grub maintainer was understandably a bit hesitant to haul around yet another patch for an issue that was a corner-case, especially, I would imagine, since os-prober is, by default, now disabled by grub for security concerns. He suggested I submit the patch upstream. I managed to find a thread from several years ago showing that this was already submitted upstream to grub. The upstream grub maintainer stated that the patch looked fine but that it first needed to be patched in os-prober. os-prober upstream had finally merged a PR last year that resolved the issue on their end. I bumped the grub thread, stating that it had been patched in os-prober and linked the commit. Nothing. Months later, I decided to join the dev mailing list and submit a git patch there. Dead air. No reply.

I don't expect it to happen soon, if at all. grub has far more important concerns and appears to apply commits in small bunches every 1-3 months. As someone who doesn't often deal with mailing lists, how long does one wait and how exactly could/should one go "ehem"?


r/linuxdev • • Jan 30 '22

Enabling KVM without BIOS setup

3 Upvotes

I'm running Debian 11 LXDE in an old notebook and during the boot I'm receiving the following message:

root@debian:~# dmesg | grep -i kvm
[   20.501228] kvm: disabled by bios
[   20.541824] kvm: disabled by bios

Also, when I try to create a VM in virt-manager, I get the following message:

Warning: KVM is not available. This may mean the KVM package is not installed, or the KVM kernel modules are not loaded. Your virtual machines may perform poorly.

And indeed the VM performs very poor.

However, I'm pretty sure the processor is capable of virtualization:

root@debian:~# lscpu | grep -i "virtualization\|svm"
Virtualization:                  AMD-V
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor ssse3 cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch ibs skinit wdt hw_pstate vmmcall arat npt lbrv svm_lock nrip_save pausefilter

Unfortunately, the BIOS setup is very simple and doesn't have any option of virtualization to be set. Therefore, I can't enable the virtualization via BIOS setup.

Question

Is it possible to enable KVM by other means instead of BIOS setup?


Hardware Specification

 

root@debian:~# dmidecode | grep -i "version\|release"
	Version: V2.12
	Release Date: 04/16/2013
	Version: V2.12
	Version: Type2 - A01 Board Version
	Version: Chassis Version
	Version: AMD E1-1200 APU with Radeon(tm) HD Graphics

r/linuxdev • • Oct 19 '21

Are there any programs or scripts out there that can save and restore desktop states?

3 Upvotes

Like right now, I have 4 VSCode windows open, 2 firefox, spotify, and slack. Is there any program out there that I can use to save the state of these open programs so that when I boot up in the morning I can just issue some-program --startup work to the terminal and it opens all of these up for me? Or when I shutdown my PC, it issues a some-program --save command that would save the currently opened windows to be opened when the next some-program --startup is issued?


r/linuxdev • • May 14 '21

How can I code a GUI installer for a custom Linux distro?

3 Upvotes

Hello! I'm planning on making a custom distro but I was wondering how I would go about coding a graphical installer for the OS, as well as possibly a Live CD mode for people to test the OS. Thanks in advance!


r/linuxdev • • Nov 10 '20

Mixing multi-processing and multi-threading

3 Upvotes

Introduction to My Issue

I'm developing a general purpose library in C++. One of its features is periodic run of various commands - on startup the library reads a configuration file with "jobs" to execute with time intervals, and it executes them.

In the current implementation, on startup the library creates it own thread which mostly sleeps, checking if its time to run a command. This was done to avoid forcing the consumers of the library to call it once-in-a-while.

Unfortunately, we found out that one of the teams that consume the library use it in some service with workers - it forks multiple times on startup, and its worker processes preform most of its logic.

The Issue

According to the internet and man documentation, mixing multiprocessing and multithreading is hard. Quoting fork's man page:

After a fork() in a multithreaded program, the child can safely call only async-signal-safe functions (see signal-safety(7)) until such time as it calls execve(2).

As I have no control on the host process, my library breaks it in the sense that it is now a multithreaded program instead of a single-threaded program, causing the child to run invalid code.

Moreover, the man page suggest:

the use of pthread_atfork(3) may be helpful for dealing with problems that this can cause.

As pointed out in various posts and stack-overflow, pthread_atfork should cause the run of handlers which are supposed to help to clean things related to multi-threading, but it actually cannot do so! Functions like pthread_mutex_lock are not signal-safe, and it is not entirely clear if one can unlock the mutex from a different process from which it was locked:

Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior

My questions

Assume I understand thoroughly the issues with mixing multi-processing and multi-threading.

  1. Assuming my use-case, can I somehow fix the above issue without making my library fork instead of creating a thread, or forcing my consumers not to fork?

  2. What happens in practice? Does glibc (or any other common libc) uses pthread_atfork to protect its internal mutexes? (malloc mutex, dynamic loader mutex)

  3. In general, is there a way to mix multi-processing and multi-threading? Are there any common C++ patterns to maintain some sense of safety? (mutexes are unlocked, file descriptors are closed...)

References

Various posts and threads I've read and related to this issue:

https://stackoverflow.com/questions/6056903/multithreaded-fork https://stackoverflow.com/questions/2620313/how-to-use-pthread-atfork-and-pthread-once-to-reinitialize-mutexes-in-child https://groups.google.com/g/comp.programming.threads/c/ThHE32-vRsg https://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them


r/linuxdev • • Mar 28 '20

Reprepro

3 Upvotes

I'm trying to set up reprepro however i'm getting this error when following the guide on the debian wiki

"E: The repository 'http://fire.lionos.org/repos/apt/debian awkward Release' does not have a Release file.

N: Updating from such a repository can't be done securely, and is therefore disabled by default."

https://i.imgur.com/U7YSxwX.png


r/linuxdev • • Mar 21 '20

GitHub actions: libGL error: No matching fbConfigs or visuals found

3 Upvotes

Hi all,

I’m currently working on adding GitHub Actions support to a project of mine that is using SFML (which uses OpenGL under the hood). I’m only using the `ubuntu-latest` (Ubuntu 18.04) runner for now to keep things simple. The runners for these actions are headless so I’m running with Xvfb.

I consistently get the following errors:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

I’ve done a bit of research into this and I’ve seen that this can be caused by ambiguous references to libGL.so, but I don't see duplicates of libGL. I’ve tried updating mesa and get the same issue. I’ve also tried renaming the ligGL.so files as recommended here but that had no effect.

Here is a project that shows a minimum reproducible case.

Here is the setup code from that project.

Am I missing something here? Does anyone have any ideas? Has anyone got any gui application to work with GitHub Actions (or with a similar headless setup)?


r/linuxdev • • Mar 11 '19

How to set DPMI mode?

3 Upvotes

How to set DPMI mode in active display when I use directFB output?

How to escape display blank instead DPMI mode change?


r/linuxdev • • Feb 02 '19

How do I do publishing/subscribing across apps on linux?

3 Upvotes

Lets say I have have one app that's a publisher and 0 or many subscriber apps. How do I tell subscriber apps when an event occurred? The best I can come up with is to write to a log file and have subscribers watch the file. I haven't done files for a while so I don't remember, how do I create a file that isn't read exclusive? and how does the subscribing app know when I write to it? Does it have to use something like inotifywait? On windows you can send events to other apps, can I do that on linux?


r/linuxdev • • Dec 21 '18

Linux USB boot

3 Upvotes

I posted this to /r/linuxquestions first but this subreddit seems more appropriate, so I'll repost here

Hello! If this is the wrong subreddit, please let me know. Thanks!

I've been working on making my own Linux distro from scratch, mostly for fun, but also to see if I can innovate a little by shedding a lot of the cruft of the old ways (traditional package management, old architectures, BIOS boot, 32 bit, etc). Think of it as NixOS that feels like a normal distro or as Fedora Silverblue but without the legacy of RPM.

I'm trying to boot the system, and it will not find the boot medium (USB drive) to mount a rootfs. The EFI finds the kernel and the initramfs without issue, but once the kernel is executed, USB completely shuts down. Systemd blocks while waiting for the rootfs to show up, and eventually times out and Dracut drops me to a root shell in the initramfs. Since USB isn't working I cannot type anything on this shell to investigate further, since my keyboard also works through USB. I don't have a PS2 keyboard or port to use

The flash drive's partition table is configured like a normal HDD. I have a vfat ESP and an ext4 rootfs. I get the same result if I provide a root= argument on the kernel command line, or if I let systemd use GPT to figure it out automatically. My initramfs is assembled using Dracut. The init in the initramfs is systemd. Linux version is 4.19.1

I've been trying to mess with the Linux config, since I suspect I'm not loading some USB driver. I'm not having much success, and I've even copied Arch's kernel configuration and am still having the same issues. As soon as the kernel is executed, I see the USB activity light on my drive go off (it pulses if the drive isn't being accessed but it has power) and it never comes back on again. Different USB ports all have the same result.

Am I looking for a solution in the right place? Does this sound like a misconfigured kernel or some other issue? (maybe Dracut is misconfigured and needs something special for booting off of USB?)

Crummy picture of the initramfs

Thanks and happy holidays!


r/linuxdev • • Apr 30 '18

GraalVM

3 Upvotes

Has anyone played around with Oracle's new GraalVM? If so, what do you think?


r/linuxdev • • Apr 24 '18

Creating a graphical element to display sensor data

3 Upvotes

I wish to build a graphical interface element that would change with correspondence to input data. It would be similar to the battery icon on the phone which "fills up" according to the battery level or a "system monitor widget" that displays an icon that corresponds to the current CPU usage etc. I know that usually for battery, volume or CPU levels there are about five or so icons where the one with the single bar corresponds to 0%~20%, three bars to 60%~80% and so on, so there aren't many icons to deal with. However what if I want the text to go on top of the icon? I would need to have 100 different images. I hope to eventually incorporate this icon to the status bar of my PC.

I'd prefer it to be a vector drawing, so that it could be scaled or change colors easily. My first thought was to build a program that would grab the input data and draw the icon using cairo. It needs to constantly refresh. Grabbing data, generating and drawing the icon every second or so. Another option is to make the list of icons into a font that consists of about a 100 or so images.

Is this a feasible approach? Is it efficient? Is there a better way to achieve this?


r/linuxdev • • Apr 22 '18

The Beauty Of Persuasive Design (User Interface Design)

Thumbnail
youtube.com
3 Upvotes

r/linuxdev • • Feb 19 '18

Ensuring a safe PATH for system() in a root-setuid'ed program?

3 Upvotes

I am making a C++ program, intended to have its setuid flag on and owned by root, which needs to call system(). I am worried, however, that a malicious user could set their PATH so that the programs I call as root are instead replaced with their own.

Is there some way to ensure a standard PATH of /usr/bin, /usr/local/bin, etc. for system() function calls?


r/linuxdev • • Aug 22 '17

[Help] Resources on scheduling

3 Upvotes

Hi all,

I will soon be working on the CFS for a project at my uni.

I'm currently gathering all resources I can find on scheduling, I have some experience with it but only on single CPU scenarios.

It can be about CFS or scheduling in general, it does not matter as long as it is somewhat recent (Professional Linux Kernel Architecture is outdated when it comes to scheduling with SMP).

Any ideas ? All suggestions are welcome, thank you in advance !


r/linuxdev • • Jun 26 '17

How to write a custom desktop environment

3 Upvotes

I'm looking to write a custom DE for linux. I want something like a media browser: display the icon, meta data for the movie story line, and the ability to play from the selection. Restricted access to system specific files; only media can be browsed and played.

I have years of experience programming and minor OS writing experience in uni.

What do I need to get started?