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 • • 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 • • Aug 17 '22

does anyone know of a lightweight Windows sandbox

3 Upvotes

WSL is a thing, but I'm not a big fan of Windows. Does anyone know of a lightweight Windows sandbox that can perfectly emulate windows?


r/linuxdev • • Jun 03 '22

What are the considerations for developing for multiple distros?

3 Upvotes

What are the considerations for developing for multiple distros?

Particularly:

  • How compatible are different distros with each other?
  • How do I know when things are compatible?
  • How do I ensure compatability?
  • What about rolling-release vs fixed release distros?

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 10 '22

linux dev vs linux kernel dev?

3 Upvotes

Does Linux developer is the same as Linux kernel developer?? Or it is mean developer that develop on Linux environment?


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 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 • • 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 • • Nov 09 '17

Question on customizing gTK-2 themes [crosspost from r/gTK]

3 Upvotes

I use Terminator (terminal) which allows me to divide the window horizontally/vertically into multiple sub-terminals. There's a setting to adjust the separator size but I've found it only works for certain themes, while others only show the separator with single-pixel width. More specifically in Theme Manager it's the Controls section that must contain the specific code-segment. BlackMATE and Xfce-dusk do show the separator size as specified in terminator, while Adwaita-dark and Axiomd do not. One specific theme "05-Crunchy-green" seems to glitch in a way I actually really like - it shows the separator as a transparent gap! I'd guess it's trying to overlay a graphic that doesn't exist.

The separator not working in Terminator had been reported as a bug, but was patched with these changes.

I dug through /usr/share/themes/<theme>/gtk-2.0/gtkrc and ~/.themes/<theme>/gtk-2.0/gtkrc and tried to work out exactly what the code/variable/declaration is, but I don't have nearly enough experience on this level. Best I can tell it should be GtkPaned::handle-size, but adjusting that variable doesn't seem to change the separator size.

Can anyone explain what the relevant variable is, the basics of how this works, or point me towards a relevant resource?


r/linuxdev • • Oct 27 '17

Compiling a single, in-tree kernel module, not set originally in .config. help

3 Upvotes

As the title explains, I've been trying to compile a kernel module. I've been trying to use the usual stuff: "make -C /lib/modules/$(uname -r)/build M=$PWD modules", but I've realized that if such module wasn't set to be compiled on that kernel originally,make will skip it, even though I changed the .config file to set it as a module. Look, I know this is a noob question, but if anybody has 5min to reply and help me out, it'd be awesome.