this post was submitted on 18 Aug 2024
19 points (100.0% liked)
linux4noobs
1340 readers
1 users here now
linux4noobs
Noob Friendly, Expert Enabling
Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.
Seeking Support?
- Mention your Linux distro and relevant system details.
- Describe what you've tried so far.
- Share your solution even if you found it yourself.
- Do not delete your post. This allows other people to see possible solutions if they have a similar problem.
- Properly format any scripts, code, logs, or error messages.
- Be mindful to omit any sensitive information such as usernames, passwords, IP addresses, etc.
Community Rules
- Keep discussions respectful and amiable. This community is a space where individuals may freely inquire, exchange thoughts, express viewpoints, and extend help without encountering belittlement. We were all a noob at one point. Differing opinions and ideas is a normal part of discourse, but it must remain civil. Offenders will be warned and/or removed.
- Posts must be Linux oriented
- Spam or affiliate links will not be tolerated.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yes that is indeed what I seek, thank you!
Well so it seems it is on /dev/sr0, because I have found some help on burning the disk through CLI with cdrecord itself, and sox to convert the files to .cdr format. The disk is now "burning" (well, it sounds like it! We'll see if it plays here shortly), but I would like to find out how to use brasero to do it.
For now though I can write a script to convert all the files in a given dir to .cdr and then auto burn them to the disk if this works though which ain't too shabby.
It looks like Brasero would handle all of that kind of Media Management stuff for you, so try it out before you reinvent the wheel.
Well that's the thing, I still haven't figured out how to make brasero actually do anything, but I have already written and tested my first version of my script and it's burning my second disk now. On this test I've figured out another line I need to add to improve it (and make it clean up the .cdr files after itself.) So, unless I can find someone with better instructions on brasero than "just do it" it seems I'm stuck with reinvention.
Incidentally, is it better for me to call sudo inside the script for
cdrecord -v
or should I not use it inside and instead runsudo myscript
for the whole thing?I think Ideally you should be able to run it as you instead of root or sudo. I'm assuming you are needing sudo since you don't have access to the burner as your user.
Do an "ls -lah" on your cd burner. I think you said it was /dev/sr0 so "ls -lah /dev/sr0" and see if it is owned by root:root or hopefully root:disk or something like that. The format is "user:group" so I'm hoping it is owned by a group that you can simply add your user to.
If it is owned by another group, you can just run "sudo usermod -aG disk user" replace disk with the group that shows on the ls command and user with your user.
If that burner is owned by root:root, there is a way to change that. But that gets very complicated. And I'm not sure its worth the effort for you unless you are wanting to learn more. Point 4.3 here: https://wiki.archlinux.org/title/Udev
In which case to directly answer your question, I'd personally prefer to sudo the script instead of adding sudo in the script. But at the end of the day, I don't think it matters too much for this specific use case.
Looks like root, I think. It says
brw-rw----+ 1 root cdrom 11, 0 Aug 18 14:13 /dev/sr0
no ":" though oddly, so maybe I can run
sudo usermod -aG cdrom $USER
?Edit: looks like it throws the same error as not sudoing, wodim no write mode specified blah blah. It did add me to the cdrom group though. Although now it won't work with sudo, how do I remove myself from the cdrom group?
Edit again: Wait, I got it working with another disk, the one I was just trying may have been too big to fit on the disk but throwing the same error as when I didn't use sudo. Burning this one with sudo, will test again without when it finishes. Thankfully I have a stack of these disks lol I can do this all day.
Ok, still need sudo. Without sudo it just exits without writing to the disk. I guess what I thought was warnings is just standard incomprehensible readout, but yeah without sudo (or if the files are too big for the disk) it just exits and finishes out my script removing the .cdr files.
My bad thought it was printed as "user:group" and not "user group".
When you add yourself to a group you need to either log out and log back in or reboot in order for it to take effect. So maybe next time you log in try it without sudo again.
Oh cool thanks I'll log out and try again. Ran into another issue in my script I'm trying to work around now though: I disconnected and reconnected the drive, now it's /dev/sr1!
So, I guess I need to have my script run
cdrecord -checkdrive
, and then take that answer as a variable $CDROM and pump it back intocdrecord -v dev=/dev/$CDROM -audio yadda yadda
.This is getting a liiitle above my head lmao.
Edit: logged out and in, no dice, still sudo. Now to figure out this checkdrive issue...
if you want to take a break, I can ask somebody I know who might have a bit more experience with this.
I think I need one! Lol, I'll happily take a break, thanks for the help and let me know what your friend says!
I messaged him. No guarantees or anything, but he was my forum guy before I was your forum guy.
Thanks! Lol I've been a forum guy once or twice myself but this one is above me!
Ahhh, so apparently in the man page for cdrecord it mentions it needs to be ran as root since it uses "real time scheduling" to write. So even if you have proper permissions to use the cd burner, you still need root to run it. I made a bad assumption that you were having to use root since you didn't have permissions as your use to write to it.
If you don't need to parse the output of "cdrecord -checkdrive" then setting that var is pretty trivial.
CDROM=$(cdrecord -checkdrive)
If that outputs more than just the string you need, that gets a little headachey. Grep/awk/sed/sort/uniq/regex are all very powerful and esoteric.
That being said, the man page also mentions that most users will not have to specify "dev" at all as it should figure it out automatically. So you might be ok with axing the "dev" part of the command instead of feeding it the device path.
AH! Oh well no harm no foul, I can run my script as root, I trust me!
Cdrecord -checkdrive does output a whole mess of stuff:
And the only part I need is the part that says /dev/sr0/.
I will try deleting the /dev/ part entirely though and see what happens (probably tomorrow evening). If it works that'll be perfect. Thanks!
Edit: No dice, dev=/dev/sr0 is needed in my case.
This is a very goofy workaround for you that doesn't actually check what the device is. Only checks if /dev/sr0 exists and if yes, use that if no then use /dev/sr1. Better solution below this block. But leaving it because I kind of like it's jankiness.
Not elegant and a little janky but works.
This will work better. We are taking the output of -checkdrive, searching for "Detected" and sending that to awk. We are telling awk to split that line into columns based on this character ":" and to print the second column. That should give you an output of " /dev/sr0" with a space in front.
That should work. But if you absolutely must kill the whitespace for some reason we can add trim to the end like so
There might be a more elegant solution by using the output of "cdrecord -scanbus" instead. No clue though since I don't have the hardware to verify from here. Hope that helps!
This looks like it'll work perfectly, thank you! When I get home from work I'll play around with -scanbus and see if it works out first, then I'll try with the space and if no dice I'll try without the space!
I'm also going to try k3b and see how that works as another poster was saying, but at this point I think I prefer the script lmao!
hey, man. I'm sorry you felt like I was saying "just do it". I'd be happy to help more, but I don't have a CD ROM to test with. I just assumed the GUI would be more self explanatory. Like I said above, I've never had to burn a CD on Linux. Please remember that the Linux community is made of volunteers. Getting frustrated at them doesn't really make them want to help, especially since I literally cannot help anymore than I have without a CD rom in my hands. If you want to ship one to me, I'd be happy to figure out Brasero and walk you through it. Since that is clearly unreasonable, remember that these forums are populated by well-intentioned people doing their best.
I mean it's not your fault, that's what the documentation for brasero says. It doesn't tell me how to "select where to save it" or whatever their exact verbiage is however, and the hard part is even getting people to understand what my issue is. You may not have been able to answer my main question but you helped me work around it, sorta, and for that I am grateful. I just wish the documentation and every comment helping didn't just say "download brasero" (which I clearly have already done as per my question) or "use this link which says 'brasero: just do it.'"
Tbf I'm sure most people don't bother to try and solve things themselves before posting, but I've already seen the brasero instructions that were linked because I did, and it still doesn't tell me what I need to select to get the files on the disk, it just tells me that I need to select something. Again I think selecting /dev/sr0 will replace and overwrite sr0 as per the warning, so I do not think it is the correct answer, and so far nobody has given any alternatives as to what the answer might be, instead offering suggestions on how to download brasero or that darn link again.
And as to reinventing the wheel:
Now I'm trying to get my script to run
cdrecord -checkdrive
and pipe that answer into my script, the damn thing is now on /dev/sr1!oh! I'm more of a debian guy than a fedora guy which is why this is a bit out of my depth, but /dev/sr1 is just the equivalent of the E:// drive (that is, for whatever reason, you OS mounted it as a new disk). Perhaps this means it burned successfully?
Unfortunately, yeah, not all documentation can cover the entirety of Linux design from the bottom up and back in this era, Linux was used almost exclusively by academics at universities. As such, the documentation was never written for a general user. It has come a very long way since then, but back when cd roms were common, it was a thousand times worse. Also, YouTube didnt work on Linux at all, so you had to be really committed to fuck around with it.
Yeah I was able to burn a few successfully but not with brasero, found a reddit post where someone was just using cdrecord and I've now wrote a script to just call
cdburner
(my script) and just burn all the files in the directory to a disk.Now I just need to figure out how to take the output of
cdrecord -checkdisk
which givesAnd take the
Detected CD-ROM Drive: /dev/sr1
part, or rather just the/dev/sr1
part of that in particular, and use that as a variable called $cdrom or something, and pipe that back intocdrecord -v speed=8 dev=$cdrom -audio -pad -nofix *.cdr
that does the burning. At the moment I have to edit the /dev/sd[X] part of the script before I call it.Also, check out this article:
https://dev.to/softwaresennin/linux-directory-structure-simplified-a-comprehensive-guide-3012
It goes over basic folder structure for Linux so that you have a rough idea where something like C://Users/User/Program Files lives in it's equivalent form on Linux.
Thanks this is super helpful! I'll be saving this one to pdf for future reference too!