output
stringlengths
9
26.3k
input
stringlengths
26
29.8k
instruction
stringlengths
14
159
You could try to use these commands in the terminal: mkdir /mnt/cd && mount /dev/cdrom /mnt/cdElse try this in the terminal: sudo mkdir /mnt/cd && sudo mount /dev/cdrom /mnt/cdOr, if mkdir works: mkdir /mnt/cd && sudo mount /dev/cdrom /mnt/cd Or, if the directory has already been created: sudo mount /dev/cdrom /mnt/cdEdit: I've googled and found this link. It's about mounting an audio CD. It reads you can't mount them because of no filesystem. You need another program indeed.
I'm trying to play an audio CD in Debian but each time I insert the CD, while there appears an icon with the CD in the screen, when I try opening it I get the message: Failed to mount "Audio CD". Location is not mountable.I've been searching since yesterday but as I see there is a general problem with audio CDs because the system cannot mount them (they are iso data?) So, is there a way to fix this problem? Note: I have found suggestions of using cdparanoia or soundjuicer. Should these programs solve the problem(if truly there is one)? Note2: I have tried these: root@debian:/home/kwstas# mkdir /mnt/cd && mount /dev/cdrom /mnt/cd mount: /dev/sr0 is write-protected, mounting read-only mount: wrong fs type, bad option, bad superblock on /dev/sr0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so. root@debian:/home/kwstas# mkdir /mnt/cd && sudo mount /dev/cdrom /mnt/cd mkdir: cannot create directory ‘/mnt/cd’: File exists root@debian:/home/kwstas# mount /dev/cdrom /mnt/cd mount: /dev/sr0 is write-protected, mounting read-only mount: wrong fs type, bad option, bad superblock on /dev/sr0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.`
Audio cd doesn't play
cdparanoia can attempt to rip the audio data to a null device, and as a side effect tell you how damaged the discs are. cdparanoia -q -p -X 1- /dev/null
I need to check if a lot of audio CDs are damaged or not and would prefer not to have to listen to them all. Is there a good way to do this quickly?
Detect damaged audio CD
After trying with another DVD Drive I was able to rip using abcde. So I can answer my own question and confirm the suggestion of Stephen, my first drive is broken. I lost time, but I learned a few things. Hope my investigation described above helps someone.
I'm running a debian 9.2 machine with a Plextor PX-716A DVD-Drive as /dev/sr0. I would like to rip a music CD to MP3 using abcde. When I try to to launch abcde : $ abcde -V -d /dev/sr0 CDDB method 0: cddb Executing customizable pre-read function... done. Getting CD track info... [WARNING] something went wrong while querying the CD... Maybe a DATA CD? [WARNING] Error trying to calculate disc ids without lead-out information.After a few investigations, I tried cdparanoia, without success : $ cdparanoia -vsQ cdparanoia III release 10.2 (September 11, 2008)Using cdda library version: 10.2 Using paranoia library version: 10.2 Checking /dev/cdrom for cdrom... Testing /dev/cdrom for SCSI/MMC interface SG_IO device: /dev/sr0CDROM model sensed sensed: PLEXTOR DVDR PX-716A 1.08 Checking for SCSI emulation... Drive is ATAPI (using SG_IO host adaptor emulation)Checking for MMC style command set... Drive is MMC style 004: Unable to read table of contents headerUnable to open disc. Is there an audio CD in the drive?The I did the same with cd-discid : $ cd-discid cd-discid: /dev/cdrom: CDROMREADTOCHDR: Input/output errorI also think about a permissions problem so I verified : $ ls -al /dev/sr0 brw-rw----+ 1 root cdrom 11, 0 Nov 21 22:32 /dev/sr0and the user that I use is in the group cdrom. To be sure that my drive is working I put a DVD inside it. I can mount it and access the content, so the DVD drive is not broken. I tried the CD on a CD player it works fine, I also tried another music CD and I've got the same result. Finally I think that my DVD drive is unable to read the music CD, so I check with cd-info : $ cd-info /dev/sr0 cd-info version 0.83 i686-pc-linux-gnu Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CD location : /dev/sr0 CD driver name: GNU/Linux access mode: IOCTLVendor : PLEXTOR Model : DVDR PX-716A Revision : 1.08 Hardware : CD-ROM or DVD Can eject : Yes Can close tray : Yes Can disable manual eject : Yes Can select juke-box disc : NoCan set drive speed : No Can read multiple sessions (e.g. PhotoCD) : Yes Can hard reset device : YesReading.... Can read Mode 2 Form 1 : Yes Can read Mode 2 Form 2 : Yes Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes Can read C2 Errors : Yes Can read IRSC : Yes Can read Media Channel Number (or UPC) : Yes Can play audio : Yes Can read CD-DA : Yes Can read CD-R : Yes Can read CD-RW : Yes Can read DVD-ROM : YesWriting.... Can write CD-RW : Yes Can write DVD-R : Yes Can write DVD-RAM : No Can write DVD-RW : No Can write DVD+RW : No __________________________________Disc mode is listed as: No information ++ WARN: error in ioctl CDROMREADTOCHDR: Input/output errorcd-info: Can't get first track number. I give up.As you can read, this drive is able to read music. In the end, I tried to install vlcand mplayer but none succeed in reading the CD. I'm now lost and far to accomplish a rip ! I would like your suggestions on this problem. Any ideas what to check next ?
Unable to read an audio CD in Debian 9.2
As I try hard to avoid running non-free software (such as Nero), and I prefered command-line to GUI in this case, I've found other solution. I installed libcdio-utils Debian package, and then used: cd-info cdimage.nrgto get information about NRG file which looked sane. Afterwards I used cd-paranoia from same package to extract audio tracks as .wav files, and then burned them with wodim as usual: mkdir wav cd wav cd-paranoia -d ../cdrimage.nrg -B wodim -v -audio *.wav(note that cd-paranoia from libcdio-utils package is not the same thing as cdparanoia from cdparanoia package). This worked fast and easy for audio (and could be used to RIP audio tracks from .nrg image to mp3 files for example), but CD-Text information was lost - I could have used cd-info to read CD-Text track descriptions and with little scripting record them too back on CD with wodim -text (but I was in a hurry and the CD-Text info turned out not to be useful in my case...)
I have audio CD in Nero .nrg file format (created on Microsoft Windows), and want to burn it on physical Audio CD medium. nrg2iso(1) Debian package produces .iso image which doesn't work (nor is it supposed to, according to wikipedia article above, as it is not Data CD). I've had some luck with mplayer --cdrom-device=cdimage.nrg cdda:// (it can detect and play audio tracks!) so some support seems to be present (and I could probably kludge it around to extract raw audio), but I'd ideally want to preserve other data (according to mplayer, there are at least CD-Text tracks also present) I'd prefer command-line oriented Debian Jessie package, but I'll take anything that can be compiled/run on Debian.
Burning audio CD from .nrg file
Originally CD ROM drives (in the IDE era) had an analog audio connection to the motherboard. The SCSI commands PLAY, STOP, SCAN and their variants would then play audio CDs to this analog output just like a standalone CD player. The CDROMPLAYMSF ioctl issues one of those SCSI commands, namely PLAY AUDIO MSF. MSF defines a position on the CD (in Minutes, Seconds, Frames). Internal CD ROMs have long lost this feature, as do external USB CD ROMs (there's no analog audio connection to the motherboard). So your CD player rightfully ignores this command. IIRC the libcdaudio library also has functions to read the digital data from the CD. You need to use those, and then pass on the data to Pulseaudio etc. to playback the CD. You can also use ready-made command-line tools like mplayer cdda:// for that.
I've got a USB 2.0 CD/DVD drive, which is (amongst other use cases) used to play music CDs. But: The drive seems to ignore CDROMPLAYMSF commands. The host is a Raspberry Pi 3B with the current version of Raspbian. I'm using libcdaudio for audio CD playback, which in turn issues the necessary ioctl commands, including CDROMPLAYMSF. UPDATE: Upon request, may I hereby give you the specs of my drive, as spit out by the cd-drive utility of cdio: CD-ROM drive supports MMC 3 Drive: /dev/cdrom Vendor : MATSHITA Model : CD-RW CW-8124 Revision : DA0DHardware : CD-ROM or DVD Can eject : Yes Can close tray : Yes Can disable manual eject : Yes Can select juke-box disc : NoCan set drive speed : No Can read multiple sessions (e.g. PhotoCD) : Yes Can hard reset device : YesReading.... Can read Mode 2 Form 1 : Yes Can read Mode 2 Form 2 : Yes Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes Can read C2 Errors : Yes Can read IRSC : Yes Can read Media Channel Number (or UPC) : Yes Can play audio : Yes Can read CD-DA : Yes Can read CD-R : Yes Can read CD-RW : Yes Can read DVD-ROM : YesWriting.... Can write CD-RW : Yes Can write DVD-R : No Can write DVD-RAM : No Can write DVD-RW : No Can write DVD+RW : No
What does the ioctl CDROMPLAYMSF command do exactly?
To rip an audio CD you should really use a tool such as cdparanoia. This will handle jitter and error correction, will retry as necessary, and try to create a "perfect" datastream. Typically you would use this to create the wav files, which can then be converted to FLAC format as necessary. There are other tools, including some front end GUIs, that can talk to external databases like CDDB to automatically work out the album and track names, but for raw audio ripping cdparanoia is hard to beat.
I have a hard time using Linux' built-in tools to rip an audio cd (sound juicer, rhythmbox). The reason likely being my drive, which vibrates a lot and cannot read the disk continuously. Playing the disk in any audio player results in short pauses and stutter-y playback. Ripping the CD results in noticeable artefacts. I would have thought there's some validation going on in those tools, say for example a buffer that's save to convert, but apparently that's not the case and data is converted as comes from the drive. This phenomenon occurred on several cds to different extent. To work around the drive, I copied the .wav files over to disk (using thunar file browser). To double check if at least that worked, I found the location of the CD files, cd'd into that directory and used diff to compare the first file to the copied on in my music directory: /run/user/1000/gvfs/cdda:host=sr0$ diff Track\ 1.wav ~/Music/Artist/Album/Track\ 1.wav Binary files Track 1.wav and /home/me/Music/Artist/Album/Track 1.wav differOk, so they are different. Why is this the case? How can I copy the file correctly without getting a different one? Or is the problem with my verification? Is diff a valid way to to compare the two files?Ideally, I'd love to just rip a CD to flac files renamed to match the track titles like sound juicer would do, but more reliably.
How can I copy a .wav file from an audio cd and verify it?
Based on perusal of the issues on Clementine's GitHub page, it looks like Clementine should have CDDB support, per Issue#1239 (which is marked as a duplicate of Issue#314). The closing comments of Issue #314 indicate that Clementine uses the libtunepimp library for talking to the MusicBrainz service for this tagging capability. Unfortunately, per the MusicBrainz page, libtunepimp uses their deprecated web service (see http://wiki.musicbrainz.org/Web_Service for more details). Which means that Clementine may not be getting all of the latest-and-greatest from MusicBrainz. Now, Issue #314 is more about get automatic song tagging support in general into Clementine, not necessarily CDDB specifically. And indeed, among the open Clementine issues, there are a couple which suggest that CDDB support is lacking/not working as expected (e.g. Issue#3067, Issue#4120). So I think that the answer to your question of whether Clementine lacks CDDB support is most likely: "Yes, it's CDDB support is lacking enough to be considered missing". Sadly.
A lot of players can get CDDB info about Audio CDs, but I have never seen that in Clementine. Given the prestige and other qualities of this player It's hard to believe that it lacks this feature. Is it?
Can Clementine music player fetch CDDB/FreeDB data?
The mp3info program only writes ID3 v1 tags. Android has started looking at just the v2 tags. You should use the id3v2 program to write tags from the command line that will get recognized in most modern systems. For a GUI music tagger I recommend EasyTAG. Also, grip will rip audio cd's to mp3 and write tags using cddb data that work on Android all in one step. There are other ripping programs to, that just happens to be the one I use and know it works.
I have been struggling for months on how to add mp3 tags readable by (of all things) Android? (mp3info doesn't seem to set the fields in a way readable by Android music players, and neither does RhythmBox). So far, my most success has been the embarrassment of ripping the CD from a Windows machine, letting it auto-recognize the album/artist/title fields, then transferring the files back over to Linux for listening.
mp3info fails to make MP3 data fields readable by Android
You could automate the process by wrapping the abcde with a script that invokes abcde and checks for 'Unknown Artist/Unknown Album' directory existence after abcde completion. If the test shows that directory exists then rename it with a name that includes the disk CDDB ID which you can get with cd-discid tool. This script obtains the ID early, otherwise auto-eject prevents obtaining the ID after abcde has completed. #!/bin/bashid=$(cd-discid /dev/cdrom) abcde $@ || exit 1 if [ -d "Unknown Artist/Unknown Album" ]; then mv "Unknown Artist/Unknown Album" \ "Unknown Artist/Unknown Album $id" fi
I'm starting the longish process of ripping my CD collection. I've got abcde installed with the config from Andrew's Corner. It seems to be working ok but when the metadata fetch fails, the MP3s get written as Unknown Artist and Unknown Album. Which isn't a problem until the second metadata fetch fails. Then the tracks get overwritten. What would be ideal is that the second album gets a number on the name like "Unknown Album 2". Any suggestions on how to accomplish this? Or how to keep the directories from being ovewritten?
How do I prevent my cd ripper from overwriting Unknown Album when metadata can't be found
As indicated here, a solution would be to use the 'File - Add URL' option, and there add cdda:///. But that is a bit cumbersome, so, to have that with a click or two: In KDE: Tested in KDE4. System Settings - Device Actions - Add, and add the command : qmmp cdda:///.Now, upon inserting an audio CD, one of the Audio CD actions will be the one set aboveAlso, after adding an icon to the desktop or the panel: right click on it, then 'Properties' (for the desktop icon) or 'Icon settings' (on the panel) and under Application tab change command to qmmp cdda:///In Xfce: Create a launcher on the desktop or the panel, and then in the launcher options, change the command to the one specified.Similar option may be available in other desktops. A general, all-Linux solution is to create a .desktop file (executing the above command) and run it to start playing the audio cd after it has been inserted. Something like this (to be added to desktop, panel or menu): [Desktop Entry] Categories=AudioVideo;Player;Audio;Qt; Exec=qmmp cdda:/// Icon=qmmp Name=Play Audio CD in Qmmp Type=ApplicationIt is also important to note that to have all needed plugins available, be sure to install the latest version sudo add-apt-repository ppa:forkotov02/ppa sudo apt-get update sudo apt-get install qmmp qmmp-plugin-pack
This should be possible, given that the latest Qmmp player has a CD plugin with options regarding CD tracks info - both CD-Text and CDDB.But I see no menu option like 'Open CD' etc. Is it there? When trying to use 'Open files' to select Audio CD in the File browser, there is a message 'You can only select local files'.
How to open Audio CD in Qmmp player?
The problem is with the option "Prefer CD-Text over CDDB" (under Preferences-Plugins-Audio CD player-Configure): that should NOT be checked.When it was, instead of preferring CD-Text when available, it just showed CD-Text and never CDDB info. And as CD-Text is usually absent, it showed generic names of tracks ('Track 1, 2 etc) even if CDDB data was available and CD-Text was not. (It surely looks like a bug.)
Many Linux players (like Audacious, Banshee, Amarok, Exaile) can easily access audio CDs tracks info (names and other metadata) but Deadbeef cannot, although it has a cdda plugin that should do just that.Along VLC, Amarok, Rhythmbox, Xine and Kaffeine, Deadbeef is one of the players that can read CD-Text (tracks info accessible offline, from the cd itself), but it oddly fails at accessing online CDDB, a somewhat trivial task these days. Can those settings be adjusted to make this work?
Deadbeef audio player does not retrieve online (freedb, CDDB) info about CD tracks
Green? is a bit obscure, but looking at the source code and then libcdio programming documentation helps: it seems to refer to whether or not the track contains CD-ROM XA data and therefore is CD-I (Green Book) compatible.The original CD-ROM format is known as Mode 1, and XA is known as Mode 2. There are two sector formats in XA: Mode 2 Form 1 contains all the error correction as in Mode 1. This mode is sometimes the default for CD-R authoring programs, because it provides more compatibility with multisession discs.So, for vintage CD players, you would want to burn the whole disc at once, without turning off the laser in the middle. In other words, select "single-session" and "disc-at-once" if your burner and software allows, or "single-session" and "session-at-once" if that's the best your system can do. The first CD burners could only do "disc-at-once". Then multi-session technology was developed for CD-Rs and CD-RWs, and track-at-once burning became the default. Later, the "session-at-once" burning method was developed to be the multi-session equivalent of "disc-at-once", to improve compatibility with older CD players (among other reasons). Copy? is the copy protection status of the track. I think some old stand-alone CD players might refuse to output the audio in digital format when this is set to no, to prevent copying the track digitally to a DAT tape.
I am trying to burn an Audio CD to be playable on old vintage CD Players. Ihave tried using Brasero Audio CD and XfBurner, to no avail. TheresultingCD is playable only on some newer players. I have a CD (that Igot from someone) which works. SoIanalyzedit using cd-info. This is the information about theworking CD: Disc mode is listed as: CD-DA CD-ROM Track List (1 - 20) #: MSF LSN Type Green? Copy? Channels Premphasis? 1: 00:02:00 000000 audio false no 2 no 2: 01:43:04 007579 audio false no 2 no 3: 03:30:68 015668 audio false no 2 no 4: 05:45:37 025762 audio false no 2 no 5: 07:33:14 033839 audio false no 2 no 6: 09:27:53 042428 audio false no 2 no 7: 10:57:36 049161 audio false no 2 no 8: 12:57:33 058158 audio false no 2 no 9: 14:18:70 064270 audio false no 2 no 10: 16:02:30 072030 audio false no 2 no 11: 17:36:57 079107 audio false no 2 no 12: 18:59:35 085310 audio false no 2 no 13: 21:08:00 094950 audio false no 2 no 14: 22:11:08 099683 audio false no 2 no 15: 23:32:35 105785 audio false no 2 no 16: 25:52:23 116273 audio false no 2 no 17: 27:00:12 121362 audio false no 2 no 18: 29:55:43 134518 audio false no 2 no 19: 31:39:27 142302 audio false no 2 no 20: 33:10:26 149126 audio false no 2 no 170: 35:05:28 157753 leadout (353 MB raw, 353 MB formatted) Media Catalog Number (MCN): 0000000000000 Last CD Session LSN: 0 audio status: no status volume level port 0: 255 (0..255) 100 (0..100) volume level port 1: 255 (0..255) 100 (0..100) volume level port 2: 0 (0..255) 0 (0..100) volume level port 3: 0 (0..255) 0 (0..100)And this is theinformation about my CD from Brasero (it is the same for XfBurner): Disc mode is listed as: CD-DA CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? Channels Premphasis? 1: 00:02:00 000000 audio true yes 2 no 170: 06:00:61 026911 leadout (60 MB raw, 60 MB formatted) Media Catalog Number (MCN): 0000000000000 Last CD Session LSN: 0 audio status: no status volume level port 0: 255 (0..255) 100 (0..100) volume level port 1: 255 (0..255) 100 (0..100) volume level port 2: 0 (0..255) 0 (0..100) volume level port 3: 0 (0..255) 0 (0..100)It seems the only differences are theGreen? and Copy? fields. Whatis the meaning of these fields? Any suggestions on writing compatible Digital Audio CDs for old players?
What do Green and Copy mean in CD-INFO?
CDs and DVDs require different wavelengths of light. In your drive there is one laser for CD, another for DVD. My guess is the one for CD is dead. Or some other component used exclusively for CDs is dead, it makes no difference in practice. I used to have a drive that stopped reading CDs while still being able to read DVDs. Just in case check the drive with another computer and/or OS, if you can. I don't expect surprises though. For many years operating systems have been able to read CDs out of the box, they still can. If the physical interface between the drive and the rest of your hardware was to blame, you wouldn't be able to read DVDs. General conclusion: if a drive reads DVDs but fails to read CDs (or vice versa) then the problem is most likely with the drive. The drive in question is faulty. Use another one.
When I insert a DVD into the drive on my PC under Fedora 33, vlc opens the disk automatically and begins to play it. When I insert a CD (audio or data), the drive spins up and the light blinks, but the disk fails to automount. The disk doesn't appear in Rhythmbox or Files. When I try to mount with mount /dev/sr0 /tmp, I get mount: /tmp: no medium found on /dev/sr0. I can successfully eject the drive. I have installed all the recommended gstreamer plugins and can see no obvious errors in the following commands $ lsblk $ lspci $ dmesg | egrep -i --color 'cdrom|dvd|cd/rw|writer' $ cdrecord -prcap dev=/dev/cdrom $ ls -l /dev/sr0The audio CDs play fine in another dvd drive on my ancient laptop. I've recently upgraded from Fedora 32 so all the libraries are up to date. As far as I can recall, I've never bothered playing CDs from this machine. It's been a long time since I've had to deal with CD/DVD issues, so there could be something in the last 5-10 years that I haven't kept up with. I'm still coming up to speed with systemd. ;) The only errors I can spot are from journalctl /dev/sr0 Apr 09 11:57:52 corvus kernel: ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 5 ports 6 Gbps 0x5 impl SATA mode kernel: ahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part ems apst kernel: scsi host2: ahci kernel: scsi 2:0:0:0: CD-ROM hp DVD-RAM UJ8E1 4H01 PQ: 0 ANSI: 5 kernel: sr 2:0:0:0: [sr0] scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray kernel: sr 2:0:0:0: Attached scsi CD-ROM sr0 kernel: sr 2:0:0:0: Attached scsi generic sg1 type 5 kernel: sr 2:0:0:0: [sr0] tag#23 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s kernel: sr 2:0:0:0: [sr0] tag#23 Sense Key : Not Ready [current] kernel: sr 2:0:0:0: [sr0] tag#23 Add. Sense: Incompatible medium installed kernel: sr 2:0:0:0: [sr0] tag#23 CDB: Read(10) 28 00 00 00 00 00 00 00 02 00# wodim --devices wodim: Overview of accessible drives (1 found) : ------------------------------------------------------------------------- 0 dev='/dev/sr0' rwrw-- : 'hp' 'DVD-RAM UJ8E1' -------------------------------------------------------------------------The output of cd-info cd-info version 2.1.0 x86_64-redhat-linux-gnu CD location : /dev/cdrom CD driver name: GNU/Linux access mode: IOCTLVendor : hp Model : DVD-RAM UJ8E1 Revision : 4H01 Hardware : CD-ROM or DVD Can eject : Yes Can close tray : Yes Can disable manual eject : Yes Can select juke-box disc : NoCan set drive speed : No Can read multiple sessions (e.g. PhotoCD) : Yes Can hard reset device : YesReading.... Can read Mode 2 Form 1 : Yes Can read Mode 2 Form 2 : Yes Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes Can read C2 Errors : Yes Can read IRSC : Yes Can read Media Channel Number (or UPC) : Yes Can play audio : Yes Can read CD-DA : Yes Can read CD-R : Yes Can read CD-RW : Yes Can read DVD-ROM : YesWriting.... Can write CD-RW : Yes Can write DVD-R : Yes Can write DVD-RAM : Yes Can write DVD-RW : No Can write DVD+RW : No __________________________________Disc mode is listed as: Error in getting information ++ WARN: error in ioctl CDROMREADTOCHDR: No medium foundcd-info: Can't get first track number. I give up.The OS is GNU/Linux 5.11.11-200.fc33.x86_64. Where should I look next and what issues should I be thinking of?
Can't play CD on fedora: no medium found on /dev/sr0
Well, here's your error: ++ WARN: error in ioctl CDROMREADTOCHDR: No medium foundIt seems your medium is either non-redbook compliant, is faulty or damaged, or your drive is faulty (seems less likely considering the other CD works). If your CD works on another audio player, it may be that it contains Digital Restrictions Management technology, which you don't have the required technology to interact with.
I have two Audio CDs to prepare for my upcoming English test. I can play the first CD by execute vlc cdda:// in konsole (I use Arch Linux with KDE). I also note that the Audio CD appears in the Devices panel in Dolphin. Unfortunately, for the second CD, nothing appears in Dolphin and I also can't play this CD with vlc. I run cd-info /dev/cdrom with the the second CD inside and get cd-info version 0.93 x86_64-unknown-linux-gnu Copyright (c) 2003-2005, 2007-2008, 2011-2013 R. Bernstein This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CD location : /dev/cdrom CD driver name: GNU/Linux access mode: IOCTLVendor : Slimtype Model : DVD A DS8A5SH Revision : XAA2 Hardware : CD-ROM or DVD Can eject : Yes Can close tray : Yes Can disable manual eject : Yes Can select juke-box disc : NoCan set drive speed : No Can read multiple sessions (e.g. PhotoCD) : Yes Can hard reset device : YesReading.... Can read Mode 2 Form 1 : Yes Can read Mode 2 Form 2 : Yes Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes Can read C2 Errors : Yes Can read IRSC : Yes Can read Media Channel Number (or UPC) : Yes Can play audio : Yes Can read CD-DA : Yes Can read CD-R : Yes Can read CD-RW : Yes Can read DVD-ROM : YesWriting.... Can write CD-RW : Yes Can write DVD-R : Yes Can write DVD-RAM : Yes Can write DVD-RW : No Can write DVD+RW : No __________________________________Disc mode is listed as: Error in getting information ++ WARN: error in ioctl CDROMREADTOCHDR: No medium foundcd-info: Can't get first track number. I give up.I installed libdvdread, libdvdcss, libdvdnav and tried with vlc dvd:///dev/sr0 but konsole returned errors. Can anyone help me to play the CD?
Can not play Audio CD in Arch Linux
Depends on filesystem caching. If the wav file is deleted right away, it may never be written to disk in the first place. In such a case there should not be a noticeable difference to piping directly. If you have enough free RAM you could always do it in a tmpfs/ramdisk and only copy the final result to the real filesystem. Rather than piping it directly to an encoder, the program that does the ripping would have to start the encoder by itself. Encoders usually only take one file at a time, so a multi pipe is not feasible. cdparanoia frontends such as abcde sometimes offer an option to save disk space, however the method used by abcde is actually much slower than ripping the CD to files first. I think part of the problem is that you don't know how fast you're ripping the audio data, and how long it takes for the encoder to actually process it. So if you pipe things, the drive may not be able to operate at optimal speeds. The abcde manpage says:Use only if your system is low on space and cannot encode as quickly as it can read.So unless the method used by this script is bad, there should be no speed penalty for temporary files.
I would like to be able to rip a CD through the command line (using cdparanoia and lame, preferably) without having to use temporary files. I'm thinking that this would save some time with the encoding process, but if this isn't the case, please let me know. So far, I've tried cdparanoia 1 - | lame -f --silent - track.mp3, and it worked well on that first track. However, I can't figure out how I can pipe all of the tracks from the CD in this way without doing some slightly messy parsing of the CD track table. Is this kind of thing feasable in a one-liner, or will I have to grab the number of tracks and iterate? EDIT: I'd appreciate input on whether or not ripping the full CD in this way and splitting tracks post-encoding would be any better or more feasable.
CD Ripping Without Temporary Files
As indicated here, the command is deadbeef all.cda
This question is created to share a simple and interesting solution related to this great player.
Start playing an audio CD in Deadbeef player with a command
I have posted in the question some players that, oddly enough, lack a "Open CD" option.Wile not having that option, Rhythmbox and Banshee should be able to access the CD drive in the list of drives, but I will leave them aside for the moment. (Rhythmbox should be able to display a music CD in the list of drives under the condition that a plugin is installed inside the player. After installing the player in KDE, rhythmbox-plugins and rhythmbox-plugin-cdrecorder are not installed by default. After installing those separately, I cannot enable the CD plugin. This is related to my KDE system I think. Banshee too should work but in KDE the CD drive is not listed.) See the end of the answer.Considering the players that have this 'Open CD' option; until now, I could find that only in Clementine, Deadbeef, Exaile (at least v. 3.4), Kaffeine, KsCD, SMPlayer, VLC, Xine, Xix-media-player. Audacious has this option under "Services" menu. Amarok immediately shows the Audio CD in the left pane under Media sources - Local music (see image below). Xix-media-player I shall leave aside for now. It seems a new-comer to me, it seems a pretty ambitious player that finds names in most cases, but has a lot of quirks, sometimes not playing at all on my system.Considering finding and showing track names. This kind of info is either present on the CD itself (CD-Text), or is taken from the internet. On that, take a look at this question. As some players were able to access tracks names and info while off-line, this means that they can read that embedded CD info. From my experience 4 out of 10 audio CDs have that info on them, in the rest of cases the players have to look for info online. Among the selected players, Clementine and SMPlayer have never given me the names of the tracks. This means they neither can read the CD-Text, nor access the internet to get the info from databases like CDDB. SMPlayer can only start an audio CD, but is not displaying the tracks at all, not even with generic names in the playlist, which stays empty. Kaffeine can find the names of the tracks in most cases (and is one of the best in this sense) and while it will not show the CD tracks in a playlist at all, it will (only) show the proper name of the playing track on the window name. I should leave it aside, but I'll keep mentioning it because it is so good at finding the proper names of tracks. Considering the access to CD-Text (off-line info on CD tracks), the only players that I found able to read it were Audacious, Amarok, VLC, Deadbeed, Xine and Kaffeine. Amarok, Xine and Kaffeine were able to access the CD-Text on all CDs that showed that kind of info (offline) while Audacious, VLC and Deadbeef accessed it only on some CDs. Deadbeef didn't seem to me (at first) able to fetch the info from the internet because of a bug - but that can be in fact solved by NOT checking the the option "Prefer CD-Text over CDDB" (under Preferences-Plugins-Audio CD player-Configure). More here.To start playing a CD in Deadbeef with a command: deadbeef all.cdaConsidering the capacity of fetching info on the CD tracks from internet databases, the most capable seem (in KDE) Audacious, Amarok, Deadbeef, Kaffeine, Xine and Exaile. They were able to find the needed info in most if not all cases, while the rest lagged behind. From my experience, when VLC was able to find online info on a CD that contained no CD-Text, KsCD did the same. On rare occasions these two, along Amarok, were able to find online info that was not found by any other player mentioned here, while in most other cases VLC and KsCD lagged largely behind the rest. This means maybe that they access only some more rare and/or old database that the other mentioned players (except Amarok) do not access.Conclusions: Xine and Kaffeine are mainly video players (and one should be normally privileging here a proper audio-player software. Xine has a somewhat odd/oldish look and Kaffeine has no playlist for audio CDs (AFAIK). Therefore, my favorites here are: Deadbeef, Audacious, Exaile and Qmmp (for Qmmp see update below), especially that they have tabbed playlists (a Foobar2000-like feature that I learned to love and cannot do without). Amarok is good, but I find its GUI a bit bloated and often buggy. Exaile cannot read CD-Text, but that should not make a big difference these days. Maybe KsCD can be dropped completely in favor of VLC. VLC deserves to be taken into account along Deadbeef for accessing CD-Text too. Outside KDE, beside Audacious, Deadbeef and Exaile: Banshee has no "Open CD" option but the Audio CD drive appears in the left pane once the CD is inserted (this doesn't work in KDE). This player is able to find internet info about the CD tracks, but its capacity is somewhat limited compared to others mentioned here. - It cannot read CD-Text. Rhythmbox installs along with the needed plugins in Ubuntu & Gnome-based systems (not in KDE; there, the needed plugin doesn't seem to work). It is excellent at fetching online info and it can also read CD-Text offline. No "Open CD" option, but the Audio CD entry can be made visible in the left pane by going to 'File' - 'Add music', and then selecting the Audio CD. Both these players were also able to fetch info that only Amarok, VLC and KsCD could - and other players couldn't. These two together are a powerful and complete non-KDE solution; (and there are also Audacious and Exaile).UPDATE: I will update the answer below. Decibel is also able to access audio CDs by going to 'Edit - Preferences - Exlorer' and enabling 'Audio CD', then selecting Audio CD in the drop-down list. It cannot access CD-Text but can retrieve and save CDDB info online, just like Audacious and Exaile.To play an audio CD in Qmmp there is the solution presented in this answer. Qmmp can access online CD database and also read CD-Text.Dragon Player will play an audio cd with the options 'Play Media/Play Disk' but without a playlist for the cd and without access to any info on the tracks (similar to SMPlayer).
I should restrict this question to KDE, but the non-KDE-specific players may very well work. I am surprised how many Linux audio players (and video/multimedia players too) lack the simple option of accessing and opening a music CD that was inserted in the CD drive.I mostly use Deadbeef and Clementine, and they do have this option, but they do not show the track names. What music players have an "open CD" option? show the tracks names in a playlist?EDIT:: Music players that do not have a clear way ('Open CD', 'Add CD' option, etc) to access a music cd in the drive: Bomi, Dragon, Guayadeque, Parole, Qmmp, Quod Libet, Tomahawk, Yarock.
Music players that have 'Open CD' option and that show tracks' titles?
Right-click the volume icon in the trayand select Configure KMix….Unselect Show On Screen Display (OSD) then click OK (or Apply). This is equivalent to editing ~/.config/kmixrc and adding the line: showOSD=false
In older versions I used to comment out osd.show(percent) in the functions increaseVolume and decreaseVolume in the file /usr/share/plasma/plasmoids/org.kde.plasma.volume/contents/ui/main.qml (blog source). But that file does not exist anymore in Plasma 5.13. Is there an other way to disable it?
How to disable the volume popup in KDE Plasma 5.13?
You need a script to do this. There are scripts like this that control the default sink, but I haven't seen one that controls all sinks. You can get a list of all sinks with pacmd list-sinks, and set the volume with pacmd set-sink-volume, so you need to do something like VOLUME='+5%' for SINK in $(pacmd list-sinks | grep 'index:' | cut -b12-) do pactl set-sink-volume $SINK $VOLUME doneWhere $VOLUME can be absolute (150%) or relative (+5%, -5%), and possibly other formats, too. Most window managers can be configured to launch scripts or programs, complete with arguments, when you press keys. That's the best method, but if your WM doesn't, there are tools like xbindkeys. So you can customize in any way you want. Note that Pulseaudio will start using hardware mixers if the sink volume goes over 100%, and that can distort the sound. Also note that Pulseaudio allows to set the volume for each application ("audio stream") with pacmd set-sink-input-volume. You can list them with pacmd list-sink-inputs and set them similarly. That allows you to have the sink volumes at a fixed level, so they are about equal, without using hardware mixers, and when you switch sinks, it will automatically have the "right" volume. That's the setup I prefer.
I'm frequently changing the audio setup of my laptop (sometimes using the built-in jack port, sometimes nothing at all, sometimes using USB headphones, sometimes using the jack port in the dock of my laptop). I'd like to have keyboard shortcuts to lower or increase volume for all outputs at once, so it works no matter which audio output is currently active. What's the easiest way to achieve this? I also see that in pavucontrol, I can go above 100%, which is sometimes practical, so if the command was also able to do this, that'd be great. I'm running Debian Testing, kernel 4.9.0-3-amd64, and pulseaudio 10.0.
Lower or increase pulseaudio volume on all outputs
As far as i am concerned this is not a pulseaudio thing and depends on which DE or WM you are using I have never used a DE with arch but for WM's this is configured in their configuration files like fori3 (~/.config/i3/config)#change volume bindsym XF86AudioRaiseVolume exec amixer -q set Master 5%+ bindsym XF86AudioLowerVolume exec amixer -q set Master 5%- bindsym XF86AudioMute exec amixer -q -D pulse set Master togglefor configuration in dwm (go to dwm dir and configure config.h)#include <X11/XF86keysym.h> { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer -q set Master 5%- ") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer -q set Master 5%+ ") },for qtiles (.config/qtile/config.py)([], "XF86AudioLowerVolume", lazy.spawn('amixer -q set Master 3%-')), ([], "XF86AudioRaiseVolume", lazy.spawn('amixer -q set Master 3%+')),
On my laptop, when I press the volumeup/volumedown key, the sound lever go up/down by 10 units. I can check that with alsamixer: when I press volume up, the sound level indeed go up by 10 points. But I would like these keys to be less sensible: it would be nice if the level could go up/down by 5 points when I press a key (volume up/volume down). I know that these rules are configured in /lib/udev/hwdb.d, but the only thing I found in these files is the use of the "volumeup" and "volumedown" keywords, but not the amount the button increase/decrease. How could I do that ? Is there a config file somewhere ? Edit I'm on arch, and I would like to know where the config is stored (if there is one) I'm using pulseaudio, I don't know if this can help
How can I set the amount by which the sound keys increase/decrease volume?
Disable absolute volume in Pulseaudio's config. Edit the file /etc/pulse/default.paAnd change the line load-module module-bluetooth-discoverto load-module module-bluetooth-discover avrcp_absolute_volume=falseCredit for this solution goes to https://www.reddit.com/user/mmstick/ https://www.reddit.com/r/pop_os/comments/s2y0hf/pop_os_2110_brake_bluetooth_device_volume_control/Unfortunately the above solution stopped working for me (kernel 5.19.0-76051900-generic) But I found another solution that works for me currently: https://askubuntu.com/a/1350436
$ neofetch OS: Pop!_OS 21.10 x86_64 Kernel: 5.15.8-76051508-genericI have two Bluetooth devices: a speaker SoundCore Boost and headphones EDIFIER W830BT. When I'm trying to change the volume on headphones using system volume settings it does work. Headphones also have buttons on them for controlling volume and those buttons also work (they change system volume in Linux). But on a Bluetooth speaker changing volume in Linux doesn't affect the actual volume. On the other hand, using volume buttons on the speaker does change the system volume in Linux (and the volume level bar in Linux changes as expected when I use the device's buttons). Also, when I mute system volume in Linux it does affect the speaker (sound mutes). Summarizing - Bluetooth devices work, sound plays, I can change volumes using devices' buttons but only the speaker volume can't be controlled via Linux system volume (except muting). I removed and paired again the speaker but that didn't help. For both devices, Output Device configuration is set to Hight Fidelity Playback (A2DP Sink). The same speaker works well on macOS (changing system volume affects the speaker volume). $ bluetoothctl devices Device 00:22:37:59:E0:A5 SoundCore Boost Device 5C:C6:E9:30:68:EA EDIFIER W830BT$ bluetoothctl show Controller 38:DE:AD:1B:85:90 (public) Name: xxxx Alias: xxxx Class: 0x007c010c Powered: yes Discoverable: no DiscoverableTimeout: 0x000000b4 Pairable: no UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb) UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb) UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb) UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb) UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001) UUID: Headset (00001108-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb) UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb) UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb) UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb) UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb) UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb) UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb) UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb) UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb) Modalias: usb:v1D6Bp0246d053C Discovering: no Roles: central Roles: peripheral Advertising Features: ActiveInstances: 0x00 (0) SupportedInstances: 0x05 (5) SupportedIncludes: tx-power SupportedIncludes: appearance SupportedIncludes: local-nameAny ideas on how to solve the problem?Edit 1: I booted live LTS version with an older kernel $ neofetch OS: Pop!_OS 20.04 LTS x86_64 Kernel: 5.13.0-7620-genericAnd it turned out that there's no issue with that version - system sound control affects the volume of my Bluetooth speaker as expected. I also booted the live version of my current system (to confirm that there's no issue with my installed version) and the issue with volume control was present. So my guess is that kernel 5.15.8-76051508-generic does something with Bluetooth and sound control differently than 5.13.0-7620-generic.Edit 2: I downgraded the kernel version to 5.13.0. https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.13/ I downloaded 4 files and installed them $ ls linux-headers-xxx_all.deb linux-headers-xxx-generic_xxx.deb linux-image-usigned-xxx-generic_xxx.deb linux-modules-xxx-generic_xxx.deb$ sudo dpkg -i *.debPop!_OS doesn't have GRUB and uses kernelstub https://github.com/isantop/kernelstub/blob/master/README.md I changed the kernel version using the following command (where xxx is the desired kernel version) $ sudo kernelstub -v -k /boot/vmlinuz-xxx-generic -i /boot/initrd.img-xxx-genericAfter the reboot, I see that I'm using kernel 5.13.0-051300-generic but that doesn't solve the problem with volume control. $ uname -r 5.13.0-051300-genericSo my guess is that Pop!_OS changed something between 20.04 LTS and 21.10 that broke proper volume control in my Bluetooth speaker and it's not the kernel's fault.
Bluetooth speaker volume control doesn't work (but muting does work)
ffmpeg -i inputfile -vcodec copy -af "volume=10dB" outputfile would increase volume by 10dB VLC allows you to watch a network stream, you enter a youtube URL and you can increase the volume to 125% - I read to 200%.
I'm using Kubuntu and need to increase my volume beyond 100% on many youtube videos, because the recording level was too low, and my speaker is capable of generating much louder volume.
How to increase volume beyond 100% on Kubuntu KDE
I have tried again to compile the pa-applet (it aren't on Debian repository) and looking in the "issue" of his project on GitHub, I find a fork that a dude made and he fix the problem of compiling that I have. So, case closed. If you are looking for an icon volume, just compile the pa-applet through the original project on GitHub or by this fork that I mentioned. =) The original project. https://github.com/fernandotcl/pa-applet The fork. https://github.com/Strubbl/pa-applet
I'm using Debian 8 with Openbox which comes with PulseAudio by default. And I cannot find a volume icon which works properly. I try Volti (the volume becomes very low and sometimes doesn't work), Pavucontrol (doesn't have a volume icon) and try to compile pa-applet (I can't compile then! Many others have the same problem) and volctl (doesn't appear on the panel). I didn't try volumeicon because in many forums people say that they don't work properly with PulseAudio, so I did not even try then. I read about pulseaudio-ctl, but it hasn't a volume icon. Any help?
Volume icon for PulseAudio on Tint2 -- nothing works!
Merely the package gvfs-backends was missing. This package is responsible for virtual filesystems in userspace. After installation everything works fine!
I run Debian 9 with LXQt what is completely fine. However, attached USB-volumes are not getting displayed in the PCManFM-Qt sidebar in category Devices intended for that (see screenshot). Which package is responsible for that? I activated all three necessary options in Preferences -> Volume, but the drives still don't appear in the sidebar. Ironically the taskbar-widget shows the drives and I can easily open them in PCManFM-Qt by clicking on the widget. However they are never displayed in the sidebar while the category Devices remains completely empty. During common workflows that is a bit uncomfortable...Screenshot of the issue:Screenshot of the working taskbar widget:Again, clicking on the taskbar widget the device gets opened in PCManFM-Qt without any problems. Only displaying its existence in the sidebar does not work.
Debian 9: USB-volumes are not displayed in PCManFM-Qt's sidebar
Apparently, I had PULSE_SERVER="" in my /etc/environment file. I removed that line and rebooted. Then, everything worked.
One time when I rebooted my computer, suddenly, the audio won't change and the audio settings only say No output or input devices found. I have replaced pulseaudio with pipewire, but it stilled worked after a reboot following the replacement. When using kmix and rebooting again, the audio can be changed, but the audio applet in KDE Plasma shows the same message. I can still hear audio, but I need to manually change it with programs like alsamixer or kmix. Also, I tried making the same conditions on Virtualbox with pipewire instead of pulseaudio, and the audio worked in the virtual machine. How can I fix plasma-pa's audio problem? My Linux distribution is Debian Sid. Output of pactl info: Connection failure: Invalid server pa_context_connect() failed: Invalid serverVersion of packages: plasma-pa: 4:5.27.10-1+b2 pipewire: 1.0.5-1+b1 pipewire-pulse: 1.0.5-1+b1
Cannot change volume or access audio settings in KDE Plasma suddenly
The problem is that the knob was working because of a configuration done in the context of the i3 window manager that I use, and long long ago I had botched the configuration. These are the culprits: bindsym XF86AudioRaiseVolume exec amixer -q set Master 1%+ unmute && pkill -RTMIN+1 i3blocks bindsym XF86AudioLowerVolume exec amixer -q set Master 1%- unmute && pkill -RTMIN+1 i3blockswhich need to be changed to this bindsym XF86AudioRaiseVolume exec amixer -q -D pulse set Master 1%+ unmute && pkill -RTMIN+1 i3blocks bindsym XF86AudioLowerVolume exec amixer -q -D pulse set Master 1%- unmute && pkill -RTMIN+1 i3blocksi.e. by passing -D pulse to amixer. The idea came from line 112 of the code of the volume-pulseaudio i3 custom blocklet. Not sure what the difference is between set and sset for amxier. From man amixer I deduce they are synonymous. And that also get and sget are synonymous with each other.
Below is pavucontrol GUI. As you can see, volume is 100%. I can use the knob of my Roccat external keyboard, to change it to any value between 0% and 100%. Now I do the followingset it to something lower than 100%, say 69%, suspend the system via systemctl suspend wake the system upAt this point, the keyboard knob will allow me to reduce the volume below 69%, but not increase it above 69%. I can pull up the volume to 100% using pavucontrol, at which point the knob can again span the whole 0-100% range. Why is that the case? And how can I fix this?
Volume can't be increased via keyboard volume knob after suspend
OK, turns out it's a pulseaudio configuration issue. For some reason it had the enable-deferred-volume attribute set to "yes". Just edit /etc/pulse/daemon.conf, uncomment that param, set it to no and restart pulseaudio (or system).
So I have this unexpected behavior when changing volume under newest Fedora 32 (Gnome 3 default version): When I change volume, it doesn't change right away on every Fn+F2/F3 keypress - the volume actually changes once the volume change icon disappears from the screen. So if I pressed the combo a few times, the sound will still be as it was, and then it will suddenly change when the icon disappears. It's not super inconvenient, it just feels weird after using Ubuntu where the volume changes on every press immediately, even when the icon is still on screen. Any idea if this is normal or if it could be changed somehow?
Volume change in Fedora only applies when the volume icon is gone?
Here are some thoughts - I am still learning this and will update this as I go. How to choose the union filesystem There are two ways to look at this:How do the features of each one compare? For some common use cases, which one should I choose?I'll compare unionfs / unionfs-fuse / overlayfs / aufs / mergerfs, the latter being a replacement for mhddfs. Features of each one Development statusaufs seems to be active unionfs looks mature, but not under active development? unionfs-fuse seems to be active mergerfs seems to be active overlayfs is activeDistribution / Kernel support There are kernel mode and usersystem mode filesystems, the latter run on FUSE. Kernel mode ones have less overhead (there is overhead when code switches between user space and kernel space) but the only one currently supported in the Linux kernel is overlayfs. User mode filesystems are easier for distributions to package.unionfs and aufs need kernel patches unionfs is not distributed by Debian (the rest are) unionfs-fuse and mergerfs are based on FUSE, so don't need to additional modules in the kernel overlayfs has been part of the kernel since 3.18 (Debian Stretch)Copy on write This relates to the Live CD use case below:mergerfs does not have copy on write The others doUse cases Read-only root / The Live CD use case The idea is to have a read-only CD-ROM/partition of a linux system. The union filesystem makes it look to the user like it is a read-write system so they can make changes. There is a read-write filesystem (for example, a tmpfs RAM disk) which stores the "Delta" of any changes made by the user, but not the full snapshot. Here any of the union filesystems except mergerfs would do (lack of cow support). Docker use case I am aware this is a main use case, but don't know the details - can someone provide guidance on this? Merging hard disks For example, you might have two sets of /home directories on different filesystems. Or you might be upgrading your home computer with a second hard disk, and want a single logical volume. This is where you don't actually want copy-on-write, so possibly mergerfs is the best choice. Union filesystem versus LVM for disk pooling I'll list some use cases that can be achieved with union filesystems but not LVM: If you are upgrading an existing system with a second disk, something like mergerfs might be better because LVM would require you to reformat the first hard disk hence destoying the data on it. A union filesystem would avoid this step. LVM might split a file over two physical hard disks (assuming RAID 0), so you would lose it if one hard disk fails. Some users might like, for example, to keep their /home directory on a USB stick that they can take away. In the use case of one virtual partition on two physical disks, with LVM you wouldn't need to worry about whether files get saved on one disk or the other. With mergefs, the system can automatically choose which one for you depending on how much free space is available.
I have randomly been reading about union file system which enables a user to mount multiple filesystems on top of one another simultaneously. However, am finding trouble deciding on which one to use(Unionfs vs Aufs vs Overlayfs vs mhddfs) and why as I have not found concrete information on the subject anywhere. I know for instance that overlayFS has been adopted in the mainstream Linux kernel which means it might get wider adoption. Would appreciate if someone would give me some perspective. Also I can't find any conceiving use-case for Union file system over something like LVM (as recommended by users in separate question) or RAID setup except in the fact that LVM requires formatting all the drives which might not be desirable if you already have valuable data on the drives.
Unionfs vs Aufs vs Overlayfs vs mhddfs, which one do I use
To delete the hidden AUFS white-out files, you could: Find them, and remove them:find . -regex '.*/\.wh\.\.wh\.plnk' -delete for .plnk files find . -regex '.*/\.wh\.\.wh\.aufs' -delete for .aufs filesThis matches (in any subfolder) the aufs-specific files .wh ..wh.plnk and .wh..wh.aufs, but would not match -say- .wh.Fwh.aufs In the RegEx, '.' matches any character, while '\.' only matches the literal dot. EDIT: Updated command to use -delete option after comment hint from @wodny
I'm using AUFS for merging 100+ branches for a project. At runtime, I frequently add or remove few branches. Now, If I have a branch named "firefox-21.0" and If I update/modify one of it's file then AUFS creats it's whiteout file (.wh). So far so good. But later, If I planned to update the firefox to new version then I have to delete the "firefox-21.0" branch from system. Deleting branch from AUFS is easy. But question is [how do I remove those .wh files created ?] If I merge firefox-23.0 then previously created .wh may get preference over old firefox-21.0's file
Aufs Whiteout removal
All union filesystems with read-only and read-write branches use some form of "whiteout" marker on a read-write branch to suppress a file that exists on a read-only branch. AUFS is no different. For AUFS, the whiteout markers are files called: .wh.<filename>located in the same directory where the deleted file used to live, and where <filename> is the filename of the file that was deleted. Ref: aufs manpage, information about whiteout
When I change a file in an AUFS-mount, that change gets stored somehow in the rw-layer. It is clear how new/changed files are stored in the rw-layer, but how get deleted files remembered there?
How does AUFS store deleted files?
You should not need the full Linux file structure if just booting an ISO. I have installed grub to flash drive with various formats and booted ISO on that same flash drive. Not sure exact grub boot stanza required for network boot. I had an old USB2 flash drive which I reformated. I first make it gpt, as I prefer that over the now 40 year old MBR partitioning. You can use gparted which I normally do. Select gpt under device, advanced over msdos(MBR) default partitioning before starting. or use parted or gdisk. Note: This totally erases drive. The sdX, is your flash drive. sudo parted /dev/sdX mklabel gptI then used gparted to create on large FAT32 partition. I had to reboot for it to be seen correctly & file browser does not auto mount ESP partitions, so used Disks or manually mount. Model: Kingston DataTraveler 2.0 (scsi) Disk /dev/sdc: 1998MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 1998MB 1996MB fat32 esp2 msftdataI then mounted it with disks and then it was in /media/fred: /dev/sdc1 on /media/fred/FC87-F75C type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)Then installed grub. My drive was seen as sdc. Was a bit slow as old USB2 flash drive. sudo grub-install --root-directory=/media/fred/FC87-F75C /dev/sdc It created structure and the normal /EFI/ubuntu/grub.cfg that is a 3 line configfile to full grub in /boot/grub/grub.cfg. But did not create any /boot/grub/grub.cfg boot file. I normally manually created one to boot local ISO using these references & my older notes. You will have to create a grub.cfg but with path & mount? to network. ISO boot & link to examples https://help.ubuntu.com/community/Grub2/ISOBoot more examples https://help.ubuntu.com/community/Grub2/ISOBoot/Examples Network grub info I found using google. nfs will not work, but has example for net boot. Set up nfsroot for GRUB PXE How to boot linux kernel from network through GRUB2 console?
Disclaimer: I'm a newb and I need step by step guide. Thanks! I want to first install grub without OS, since it will boot from ISO file off the local network storage. I'm booted into a liveCD (I can't install it since I need a volatile system) I'm already stuck at first stage. I tried grub-install /dev/sda and I get error saying grub-install: error: cannot open directory '/boot/grub/i386-pc': No such file or directory. So I created and copied all files it grub-install needed and now it says grub-install: error: failed to get canonical path of 'aufs'. I searched web and figure most answers requires me to use chroot while I have a installed system (can be broken though) I don't have Ubuntu installed to any drive and my goal is to install grub from liveCD to empty drive. I want to start with an empty boot loader. How do I do this? Thanks again in advance.
How to install grub to empty disk from ubuntu liveCD
I'm working through this same issue now. This happens because vfs is not a true union file system (like aufs), so every incremental image in the image you restore is restored to its full size. See this issue for more details: https://github.com/docker/docker/issues/14040
I'm attempting to help out a roommate who has installed Kubuntu on his Chromebook using Crouton (it's basically just a fancy chroot run within ChromeOS). I helped him get the Docker daemon running, using some advice from this issue on the Docker github: https://github.com/docker/docker/issues/1863. That involved using the flag --storage-driver=vfs. AUFS tools are installed according to apt, but I guess there's some additional support that ChromeOS is lacking. Anyways, the first pull he did failed because it filled the remainder of his SSD (about 8gb). I pulled the same image onto a blank Docker install on my laptop, and the entire /var/lib/docker directory consumed 1.2gb. Is the fact that we're using vfs causing this? There's a literal order of magnitude difference in storage space used. I'm not overly familiar with Docker, but the other thought I had was that it uses system libraries when available but will pull anything not installed. TL;DR - Docker image takes up ~700Mb on my machine, over 8Gb on a friend's. We'd like to be able to pull one Docker image without resorting to external storage. Is there anything we can do?
Docker in Crouton - VFS consuming astronomical amounts of space
Aufs is very old, the today's variant is overlayfs. mount -t overlay overlay -o lowerdir=/mnt/dd1/1/:/mnt/dd2/1/ /var/www/3/It will be read only.
I am trying to merge two folders that contain the same tree and bring them together in a third folder that contains a link to the contents of two different folders, it is possible with auFS? If this is not possible, is there another solution? Thank you ! dd1 └── 1 ├── a │ └── 1 ├── b ├── c │ ├── 1 │ ├── 2 │ └── 3 └── d └── 1 dd2 └── 1 ├── a │ └── 2 ├── b │ └── 1 ├── c │ ├── 4 │ └── 5 └── d └── 2transform the upper block into the under block www └── 3 ├── a │ ├── 1 │ └── 2 ├── b │ └── 1 ├── c │ ├── 1 │ ├── 2 │ ├── 3 │ ├── 4 │ └── 5 └── d ├── 1 └── 2dd1 and dd2 are using NTFS filesystem, and are external drives connected by usb and already auto-mounted in fstab by default at startup. I have actually this configuration: sudo mount -t aufs -o br=/mnt/dd1/1/:/mnt/dd2/1/ none /var/www/3/
Merge two folders with the same tree (auFS)
In researching this the answer appears to be: no.In looking at the man page for aufs I don't see any options that would allow it to mount as anything but the root user. In looking at the filesystems that libfuse supports I don't see aufs listed there either. Lastly if you look at the userspace filesystems it's not listed their either: Filesystem in Userspace on Wikipedia, it's not listed as a option there either.
I'm experimenting with different union/overlay filesystem types. I've found unionfs-fuse package in Ubuntu which allowed me to use unionfs mount command as non-root user. But it seems aufs, which is created to provided similar options as unionfs, cannot be used as non-root user. I need to give sudo password for aufs mount. Can I use aufs without giving root password?
Can aufs be used as fuse filesystem like unionfs-fuse?
Each underlying filesystem is assigned a precedence. If there are duplicate filenames, the one from the higher precedence filesystem is the visible one, the others are hidden. See https://superuser.com/questions/326190/how-does-unionfs-work
I just tried to mount two folders in one using aufs on Debian 7 wheezy. The command I issued is the following: mkdir /test1 mkdir /test2 mkdir /test mount -t aufs -o dirs=/test1:/test2 none /testThen I wanted to see if files with the same name would conflict in the same folder, so I issued this: touch /test1/file1.txt touch /test2/file1.txtecho "A" >/test1/file1.txt echo "B" >/test2/file1.txtThe result is that /test contains only file1.txt containing the letter "B" (which means it is the file1.txt contained in /test2). How can the files not conflict? And which criteria does aufs use to choose which file to show if they have the same name?
Do files with equal name conflict in unionfs (aufs)?
Transform the input into the required syntax and splice it into the command line with a command substitution. dirs_with_photos="$(<~/dirs_with_photos.txt tr '\n' :)" if [ -n "$dirs_with_photos" ]; then unionfs-fuse "${dirs_with_photos%:}" /photos fiWith mount_unionfs you need to issue one mount command per directory. You can use a loop around the read builtin. while IFS= read -r dir; do mount_unionfs "$dir" /photos done <~/dirs_with_photos.txt
Is it possible to feed the branch paths from stdin to the mount (or mount_unionfs) command, instead of supplying them as arguments or from a file? cat ~/dirs_with_photos.txt | mount -t unionfsI don't want to use /etc/fstab, because ideally I want to automatically generate these txt files dynamically, such as with a cron job: @weekly find $HOME -type d -iname "*photos*" > ~/dirs_with_photos.txt
Mount unionfs (or aufs) branches fed from stdin?
It sounds to me like you have done everything right, so I would suggest filing a bug against aufs. PS: Kontrollfreak has done that already, and the fix is to use the dirperm1 mount option, according to http://sourceforge.net/p/aufs/bugs/21/#1293 . Thanks for your research @Kontrollfreak .
I have two writeable directories branch1 and branch2 tied together with AUFS on Debian 8 to the mount point union. Mount options: br=branch1=rw:branch2=rw branch1 and branch2 each contain a subdirectory dir with permissions 700. When I change the permissions with chmod 755 union/dir, only the first directory branch1/dir is altered, branch2/dir ramains as it is. Problem: Group and other users can't access union/dir even after setting chmod 755 because branch2/dir is still chmod 700. Is there a way to make AUFS apply changed permissions to all directories in the union or is it always limited to the topmost one?
AUFS only changes permissions of the topmost directory
Something like what you’re after is coming in systemd v256, systemd-confext. However that might not be usable for you for a while yet. Looking at the broader issue of tracking configuration changes (and identifying their origin as a subset of that), perhaps you could use a tool such as etckeeper. This is available in most distributions, and will integrate with the package manager to record changes made to /etc as separate commits. You can then record your own changes as separate commits — this can serve as a journal too, since you’ll have room in the commit messages to record the reasons for each change. Changing a couple of configuration settings will improve your experience with etckeeper, in etckeeper.conf:assuming you’re using the git backend, GIT_COMMIT_OPTIONS can be used to specify options used with git when run by etckeeper; you might be able to use this for example to set the commit authorship to distinct values; AVOID_DAILY_AUTOCOMMITS=1 disables daily autocommits; this ensures that any manual changes that haven’t been committed yet don’t end up included in an automatic commit; AVOID_COMMIT_BEFORE_INSTALL=1 disables automatic commits before installation; this serves a similar purpose to the previous setting, but prior to package installations rather than as part of daily processing.With the above, changes you make will be readily apparent in git logs and blames, and if you forget to commit a change, package manager operations will be aborted instead of being allowed to make further changes. etckeeper is available in most distributions, and distribution packages of etckeeper configure it to integrate with the distribution’s package manager.
I wish to separate the default packages configuration files (/etc/), and the configuration files I edited e.g. in /Data/etc/ (normally should be /usr/local/etc/, but let assume /Data/etc/). This to enable me to easily see the modifications I made, to easily back it up, etc. Therefore, I was wondering it was possible to mount /etc/ as :upper layer FS in RO : /Data/etc/ lower layer FS in RW : itself (/etc/).The package manager would make its changes in /etc/ like normal. But when I add a file in /Data/etc/, e.g. /Data/etc/foo, I wish to then have a /etc/foo file in RO that will shadow any existing /etc/foo. Note:physical links aren't possible as /Data and /etc will be in different FS. symbolic links would be troublesome : e.g. if a symlink is deleted when updating a package, requires to automatically create a symlink for each files in /Data/etc/, etc. mount --bind would be troublesome for the same reason. some packages does look at /usr/local/etc/ for extra-configuration files, but unfortunately, not all.However, I failed to see how to do so with UnionFS/AuFS/OverlayFS/etc. I am also open to alternative solutions/ideas.
Separate default configurations and my own changes with a layered FS : /Data/etc/ upper layer in RO and /etc/ lower layer in RW?
I figured it out, actually, the easiest way was to simply modify the linuxrc script with exactly I wanted to do. In that case, I added support for both aufs and overlayfs, but have opted for overlayfs since it doesn't require a special kernel patchset which would be convenient if I want to use this method / approach on other distributions. I modified my linuxrc to support loading the squashfs image into tmpfs, using a tmpfs rw volume, and using a volume you specify for rw. The later is really nice because you can isolate any changes you've made and either clear them out and reboot or simply reboot to a tmpfs volume to "refresh" the slate.
I have used an aufs root before on gentoo years ago, but cannot seem to get it going now. I am using genkernel-next, I would imagine I used genkernel before as well. I am using funtoo with aufs-sources and have aufs built-into the kernel (not a module). I believe I need to make some initramfs changes + command-line and /etc/fstab changes as well, but can't seem to figure out exactly what. Any ideas?
aufs root on gentoo/funtoo
Looks like your autogen.sh is calling autoreconf. The project may be using intltool instead but if so autoreconf should pick that up and call intltoolize. If it's definitely using GNU gettext then this from the autopoint info page is helpful:The ‘autopoint’ program copies standard gettext infrastructure files into a source package. It extracts from a macro call of the form ‘AM_GNU_GETTEXT_VERSION(VERSION)’, found in the package’s ‘configure.in’ or ‘configure.ac’ file, the gettext version used by the package, and copies the infrastructure files belonging to this version into the package.And if we write AM_GNU_GETTEXT_VERSION then autopoint is correctly invoked by autoreconf.To extract the latest available infrastructure which satisfies a version requirement, then you can use the form ‘AM_GNU_GETTEXT_REQUIRE_VERSION(VERSION)’ instead. For example, if gettext 0.19.8 is installed on your system and ‘0.19.1’ is requested, then the infrastructure files of version 0.19.8 will be copied into a source package.The problem only appears when switching to this version of the macro, and while it does what it says on the tin it isn't known to autoreconf and we see a patch for support. Gentoo users can get the same behaviour in ebuilds by using our eautoreconf function. Writing AM_GNU_GETTEXT_VERSION and AM_GNU_GETTEXT_REQUIRE_VERSION immediately afterwards in my own configure.ac generates a warning but otherwise appears to yield the desired result.
I am trying to compile a gnome application and I am curious what the output means when I run the autogen.sh script: ~/Documents/Code/window-picker-applet $./autogen.sh autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: running: libtoolize --install --copy libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. autoreconf: running: /usr/bin/autoconf autoreconf: running: /usr/bin/autoheader autoreconf: running: automake --add-missing --copy --no-force data/Makefile.am:11: `%'-style pattern rules are a GNU make extension data/Makefile.am:11: wildcard $(top_srcdir: non-POSIX variable name data/Makefile.am:11: (probably a GNU make extension) autoreconf: Leaving directory `.' [Output trunkated...]Why am I getting the info configure.ac: not using Gettext? Is that a warning and should I change some of the configuration files to fix it? I know the application has a po/ folder so I think it should be using Gettext, hence I am confused about this warning. I also had a lot of warnings with the N_ macro not being defined, so this might be related? [Update] See comment below [/Update]
configure.ac: not using gettext
The cause of the problem was the -f i.e. --force tag to autoreconf. The man page for it states: "consider all files obsolete" which is a bit vague, so I couldn't initially connect it to my problem. Its html manual entry is even more misleading:Remake even configure scripts and configuration headers that are newer than their input files (configure.ac and, if present, aclocal.m4).It only talks about configure scripts, but in reality it also handles the standard GNU files. And as it turns out, autoreconf -f actually calls automake --force-missing, which has a more explicit description: "force update of standard files", and its html manual entry makes it even clearer:When used with --add-missing, causes standard files to be reinstalled even if they already exist in the source tree. […]Removing the -f tag from the autoreconf invocation solved this. Conclusion: The people working on autoreconf can't write manual entries. The people working on automake can.
I'm working on a project that has a custom INSTALL file. Running automake --add-missing (or more precisely, autoreconf -i) will generate the GNU default INSTALL file, and overwrite our file with it. How can I prevent this behavior? I want it to either not generate the GNU INSTALL file at all, or alternatively, create it with a different name. Also, I don't want to disable any other files that automake might generate.Edit 1: From the automake manual:If the --add-missing option is given, automake will add a generic version of the INSTALL file as well as the COPYING file containing the text of the current version of the GNU General Public License […]. However, an existing COPYING file will never be overwritten by automake.It says that an existing COPYING file will not be overwritten, but doesn't say anything about the INSTALL file, so it seems like it will be unconditionally overwritten. Edit 2: As requested, here are my configure.ac and Makefile.am, and also autogen.sh that we run to autoreconf the project: configure.ac: AC_INIT([program name], [version number], [bug report], [short name], [url]) AC_CONFIG_SRCDIR([Main/Source/main.cpp])AM_PROG_AS AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AC_PROG_CC AC_PROG_CXXCFLAGS="$CFLAGS $SDL_CFLAGS " LIBS="$LIBS $SDL_LIBS" CPPFLAGS="$SDL_CFLAGS -DLINUX -DLOCAL_STATE_DIR=\\\"$sharedstatedir/<program name>\\\" -DDATADIR=\\\"$datadir\\\" -DUSE_SDL -DGCC"AC_PROG_INSTALL AC_PROG_RANLIB AC_CONFIG_FILES(<list of Makefiles in subdirs>) AC_OUTPUTMakefile.am: SUBDIRS = FooLib Main Bar Baz EXTRA_DIST = LICENSING <and a bunch of unrelated files>autogen.sh: autoreconf -f -i
How to prevent automake from overwriting INSTALL?
The canonical way to do this is to provide values for various variables in the ./configure invocation: ./configure CPPFLAGS="-I/path1/include -I/path2/include -I/path3/include" \ CFLAGS="-O3 -g" \ LDFLAGS="-L/path1/lib -L/path2/lib" \ LIBS="-ltensorflow -lasan"If the C++ compiler is used, specify CXXFLAGS instead of (or in addition to) CFLAGS. These variables can also be set in the environment, but recommended practice is to specify them as command-line arguments so that their values will be stored for re-use. See Forcing overrides when configuring a compile (e.g. CXXFLAGS, etc.) for details. Note that in most cases it would be unusual to specify that many paths as flags; instead, I would expect to find --with options to tell the configure script where to find various dependencies. For example, --with-tensorflow=/path/to/tensorflow which would then result in the appropriate -I and -L flags being set. Run ./configure --helpto see what options are available.
I am trying to build using ./configure. I haveThree include directories -I/path1/include -I/path2/include -I/path3/includeTwo link directories -L/path1/lib -L/path2/libTwo -l flag options -ltensorflow -lasanTwo compile flags -O3 -gHow can I put all these flags effectively as options in ./configure?
How to put multiple -I, -L and -l flags in ./configure?
The presence of the .am files indicates the project is intended to be used with AutoMake. They are the source files for AutoMake, and the only ‘configuration’ files needed if you're building a project. Read through GNUMakefile.am to see how AutoMake is configured. Generally speaking, you don't need to do that in many cases. The standard ./configure; make; make install and its variants works well. The GNU Build Toolchain, aka autotools, (check out the flowchart) is very complex (and its use of M4 is not for the faint of heart — and to think I once used that to make a website). Your best allies are the documentation. All the tools have manpages, but most of their documentation comes in info pages (say info automake, or use your favourite info browser). Have a look at a tutorial for autotools or go browse the official automake documentation.
The source folder of rtnet contains only the above mentioned files for compilation purposes. Remaining files are the source code of the examples. Question is that do these files indicate that they have been generated through automake? If yes, then where should I look to find out what settings where made to configure automake for generating these files?
Do GNUmakefile, GNUmakefile.am, and GNUmakefile.in indicate that Automake has been used?
The macro AC_PROG_MKDIR_P is a feature test macro. It expands to shell code that tests for the best mkdir -p-capable command available. It uses MKDIR_P and ac_cv_path_mkdir (a "cache variable") to figure out what command to use. You may set the value of MKDIR_P to the command that you want to use for creating directories. The command that you use must be able to create not only a single directory but also the parent directories if these are not already existing (just like mkdir -p does). Normal: $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p checking for gawk... gawk ...With MKDIR_P set: $ ./configure MKDIR_P='install -d -m 0755' checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... install -d -m 0755 checking for gawk... gawk ...According to the documentation, one should be able to make this "permanent" by setting the cache variable ac_cv_path_mkdir to the wanted command. This variable can be set directly in the configure script (ugly) or by modifying the created config.cache file after running configure with the -C option once. However, I've found that configure adds a -p option to the value of this command which may not be wanted (the meaning of this option is different between mkdir and install). If you're happy with re-generating the configure script from its configure.ac source, you may set MKDIR_P to a value just after the call to AC_INIT. Then run autoconf (or autoreconf) to recreate configure. The most flexible way would be to set the MKDIR_P environment variable in the current shell session with export MKDIR_P='install -d' (or whatever you need). This would not require modifying any files, but would affect all configure scripts that you run in that shell session.
When I run sudo make install on a compiled package from the GNU archive, it uses mkdir -p to create the destination directories. I'd prefer it to use mkdir -p -m 0755 or install -d -m 0755 instead in order to ensure the destination directory has proper permissions for everyone under all circumstances, not just when the umask for root is 0022 (which isn't true for me). The package is using autoconf/automake and it looks like the behaviour is controlled by an M4 macro called AC_PROG_MKDIR_P. At the moment I can run sudo chmod 0755 on the directories I know have wrong permissions. But this isn't clearly the right option. I'd avoid to study the whole documentation in order to accomplish "just that". Any hint?
How to make autoconf use "install" instead of "mkdir -p"?
Automake was originally a shell script and switched in version 0.21 (see the automake history page) in November 1995. (I am not aware of a drop-in replacement)
I tried to get remove Perl from my Ubuntu machine, but found that automake not only depends on Perl but itself is a Perl program. I read somewhere this was not always the case. Today I looked in the archives, but even version 1.0 already is in Perl. Did I misread, or was automake always in Perl? Are there any drop-in replacements that does not depend on Perl?
When did Automake switch to using Perl
It's easy to create and update Let's Encrypt cerificates with dehydrated (https://github.com/lukas2511/dehydrated). You have to add /.well-known/acme-challenge/ location for each site as Let's Encrypt service will look on challenge responses under this location to verify that you are the owner of sites you have requested certificates for: location /.well-known/acme-challenge/ { allow all; root /st/hosting/hamilton/htdocs; } And use same path in dehydrated config: egrep -v "^#|^[[:space:]]*$" config WELLKNOWN="/st/hosting/hamilton/htdocs/.well-known/acme-challenge" CONTACT_EMAIL=<you@email>After that put all your domains in domain.txt file: on each line first domain will be CommonName and other names will be AlternativeNames, for example: head -n1 domains.txt hamilton.rinet.ru jenkins.hamilton.rinet.ru munin.hamilton.rinet.ruAfter that you should put dehydrated -c in cron and use script like this one to install new generated certificates: #!/bin/shCERTS_DIR=/usr/local/etc/dehydrated/certs NGINX_SSL=/usr/local/etc/nginx/ssl DOMAINS=$(awk '{ print $1 }' /usr/local/etc/dehydrated/domains.txt)for d in $DOMAINS; do short_d=${d%%.rinet.ru} short_d=${short_d%%.ru} # short_d=${short_d##www.} cp -v ${CERTS_DIR}/$d/fullchain.pem ${NGINX_SSL}/${short_d}.crt cp -v ${CERTS_DIR}/$d/privkey.pem ${NGINX_SSL}/${short_d}.key done# Also update certs for Dovecot cp -v ${CERTS_DIR}/hamilton.rinet.ru/fullchain.pem /usr/local/etc/dovecot/certs/certs/server.crt cp -v ${CERTS_DIR}/hamilton.rinet.ru/privkey.pem /usr/local/etc/dovecot/certs/private/server.key
I have an Ubuntu-server 16.04 VPS and Nginx. Now I'm implementing HTTP1 (without TLS, utilizing port 80) but I desire to go "one step forward" and work with HTTP2 (with TLS, utilizing port 443), for all my (Wordpress) websites. Assuming I adjusted my environment, this way: 1. Firewall ufw app list # Choose Nginx HTTPS 2. Server blocks Default server block server { listen 80 default_server; listen [::]:80 default_server; server_name server_domain_or_IP; return 302 https://$server_name$request_uri; }server { # SSL configuration listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; include snippets/self-signed.conf; include snippets/ssl-params.conf; }Each site server block server { listen 443 ssl http2; listen [::]:443 ssl http2; root /var/www/html/example.com; index index.php index.html index.htm index.nginx-debian.html; example.com www.example.com; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location ~ /\.ht { deny all; } }Now I need to create OpenSSL certificates, sign them with Let'sEncrypt, and associate them with each site dir, respectively. My question: How can the creation of OSSL certs, LE signage, and SDIR associating, be done as much automatic as possible from inside the terminal? Of course there is some part in which I need to verify a domain from my email, but beyond that, AFAIU, everything is done from the terminal, thus can be fully automated. Can you share a Bash script code example (or a utilization of a particular utility, maybe GNU make), that helps achieving that? NotesI would humbly prefer a dockerless solution (I read here and bedsides the fact it has to do with renewling, it also seems to implement docker which I have no intention to do for a small private server of less than 10 small sites, by means of minimalism). I understand that creating, signing, and site dir associating, requires a different algorithm than renewaling. I am asking only on creating, signing and associating.Why I even ask this question: Well, I just want to use HTTP2 on my self-managed, minimal VPS (no kernel/shell customization, no compilations, almost no contrib utilities), and it seems insane to me to manually implement this algorithm for many sites, or each time a new site is added.
Automating OpenSSL certificates creation, Let'sEncrypt signing, and site dir associating, in an Nginx environment
It is usually worth reading output of ./configure --help. This suggest to run configure as ./configure CFLAGS="-ggdb3 -O0" make make installOverriding CFLAGS (or LDFLAGS, CPPFLAGS, depending on your needs) as follows works as well: CFLAGS="-ggdb3 -O0" ./configure make make installIf you need to use a compiler other than gcc, you have to override the CC variable.
I want to build a library with a specific tool instead of GCC. The regular build sequence is: ./configure make make installWhere should I replace the GCC settings (I think that the configure was created with AutoMake)?
How to change the compiler settings with AutoMake?
Solution: To properly pick up the source for the manual when performing a VPATH build, the rule for it in the relevant part of the Makefile.am file should look like shell.man: $(srcdir)/shell.mdoc $(mandoc) -T man $(srcdir)/shell.mdoc >shell.manBy specifying $(srcdir)/shell.mdoc, make will find the file in the distribution tree even when the build tree is in a different location from the distribution tree.
I'm using autoconf and automake to build a tiny project. For the project's manual, I've used OpenBSD's native mdoc format, and the installable man-formatted manual is generated from this using the mandoc utility. The man-formatted manual will be installed as the actual manual with make install, as some systems do not grok mdoc properly, or at all. In the project's doc directory, I have a Makefile.am file that currently looks like the following (the manual is for a utility called shell): dist_man1_MANS= shell.man EXTRA_DIST= shell.mdocshell.man: shell.mdoc $(mandoc) -T man shell.mdoc >shell.man$(mandoc) will be properly expanded to the full path of the mandoc formatter (this variable is set by the configure script). This allows me to run make dist which creates shell.man and then creates a compressed tar archive containing both the source mdoc manual and the generated man manual along with the rest of the project's distribution files: $ tar tzf shell-toolbox-20180401.tar.gz ... shell-toolbox-20180401/doc/Makefile.am shell-toolbox-20180401/doc/shell.man shell-toolbox-20180401/doc/Makefile.in shell-toolbox-20180401/doc/shell.mdocThis tar archive can later be used to successfully build and install the project, and its manual. So far so good. However, if I run make distcheck (because I'd like to make sure it absolutely positively works): $ make distcheck ... checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for mandoc... /usr/bin/mandoc checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating doc/Makefile config.status: creating src/shell Making all in src Making all in doc /usr/bin/mandoc -T man shell.mdoc >shell.man mandoc: shell.mdoc: ERROR: No such file or directory *** Error 3 in shell-toolbox-20180401/_build/sub/doc (Makefile:459 'shell.man') *** Error 1 in shell-toolbox-20180401/_build/sub (Makefile:345 'all-recursive') *** Error 1 in /home/myself/local/build/shell-toolbox (Makefile:576 'distcheck')It seems as if the source mdoc file is not available in the build directory when the manual needs to be built: $ ls shell-toolbox-20180401/_build/sub/doc total 32 -rw-r--r-- 1 myself myself 14989 Apr 1 21:35 Makefile -rw-r--r-- 1 myself myself 0 Apr 1 21:35 shell.manThe zero-length shell.man file comes from the failed mandoc run. The source is available in the unpacked archive, but just not copied over to the _build/sub/doc directory: $ ls -l shell-toolbox-20180401/doc total 48 -r--r--r-- 1 myself myself 178 Apr 1 21:23 Makefile.am -r--r--r-- 1 myself myself 13925 Apr 1 21:23 Makefile.in -r--r--r-- 1 myself myself 3443 Apr 1 21:27 shell.man -r--r--r-- 1 myself myself 3319 Apr 1 18:54 shell.mdocQuestion: What automake magic do I have to apply to get make distcheck to properly copy the mdoc source to the build directory before it attempts to generate the man-formatted manual? I'm looking for a "proper" way of doing this, not a hack. I tried using man1_SOURCES= shell.mdocbut that makes automake complain with doc/Makefile.am:2: warning: variable 'man1_SOURCES' is defined but no program or doc/Makefile.am:2: library has 'man1' as canonical name (possible typo)Another way to provoke this error is to manually do a VPATH build (which is basically what's happening when doing make distcheck): $ make distclean $ mkdir t $ cd t$ ../configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for mandoc... /usr/bin/mandoc checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating doc/Makefile config.status: creating src/shell$ make Making all in src Making all in doc /usr/bin/mandoc -T man shell.mdoc >shell.man mandoc: shell.mdoc: ERROR: No such file or directory *** Error 3 in doc (Makefile:459 'shell.man') *** Error 1 in /home/myself/local/build/shell-toolbox/t (Makefile:345 'all-recursive')$ ls -l doc total 32 -rw-r--r-- 1 myself myself 14589 Apr 1 22:42 Makefile -rw-r--r-- 1 myself myself 0 Apr 1 22:42 shell.man
Issue with "make distcheck" in GNU autotools project relating to generating a manual
Actually automake -a will take care of everything about dependencies while compiling a program. I have gone through this document 1 & 2 which explains about automake dependencies. I suggest you read that document for more information regards.
I am using automake on Debian Squeeze for compiling a very simple C project with 6 source files. The issue comes when I try to compile the sources using the generated Makefile. One of the sources (ll_socket.c) uses system libraries like and . Those dependencies should appear in the ".deps/ll_socket.Tpo" file automatically generated; however, that file is empty and, therefore, when GCC tries to compile that file, it cannot find the dependencies for the compilation. Any ideas about how to solve this problem?
Dependencies problem with automake
In other words, I look for either a way to run the script from paste, or to paste it into a temporary file and run it "in-place" without saving any file --- To run everything is least number of clicks and pastings.Assuming your interactive shell is a Bash or compatible shell -- you are looking for that : bash << 'EOT'<PASTE SCRIPT HERE>EOTThe above code practice is called "Heredoc" (abbrivation of "Here document"), and I used it to execute all commands until EOT in a new sub-shell. That way, you can change the working directory or alter environment. Notice EOT is not a keyword, so you can use whatever phrase you want instead of EOT (Just ensure the spelling is the same both at the start and end of the heredoc). Single quotes are around 'EOT'are used to instruct the parent shell to not perform any substitution in the heredocument. This prevent for example variable expansion by the parent shell instead of the child shell. As a concrete example: sylvain@bulbizarre:~$ bash << 'EOT' echo hello cd / echo We are in ${PWD} EOThello We are in / sylvain@bulbizarre:~$ # <-- I'm still in my home directory when # back to the interactive shellIn other words, I look for either a way to run the script from paste, or to paste it into a temporary file and run it "in-place" without saving any file --- To run everything is least number of clicks and pastings.If you want to keep a copy of the command executed, you may use that variation: sylvain@bulbizarre:~$ tee /tmp/saved.sh << 'EOT' | bash echo hello cd / echo We are in ${PWD} EOThello We are in /sylvain@bulbizarre:~$ cat /tmp/saved.sh echo hello cd / echo We are in ${PWD}
I use sed to change text in existing files and Nano to create new files. I change text with sed this way, for example: sudo sed -i 's/TESTING === "1"/TESTING === "0"/g' /etc/csf/csf.confIs there a way to create files with it, without going inside Nano or VI and pasting text, giving permission and then execute? Usually I do cd ~ && nano script.sh && chmod +x script.sh && ./script.sh && rm -rf script.sh and then I paste all the script content inside, then save and execute. This time however, I want to automate even that, and just paste everything as one input and run it in place. In other words, I look for either a way to run the script from paste, or to paste it into a temporary file and run it "in-place" the moment I close the file and by that, to run it with the least number of clicks and pastings.Why I need this solution: The process can be repetitive when working with several server environments and I want to save time when doing this task time and again. The discussion about the legitimacy of such action is surly a discussion by itself...Here is an example --- I paste the following coomand to prompt (the first one, that includes ampersands), go into Nano to create the script and right then, I paste the following script syntax, save, and it it is being executed. I wish to automate this process as to do all of this, in one pasting / one action. cd /home/testo && sudo nano script.sh && sudo chmod +x scripts.sh && sudo ./script.sh#!/bin/bash -x# Basic update and upgrade: sudo apt-get update -y sudo apt-get upgrade -y# Setup CSF-LFD: sudo rm -f csf.tgz sudo wget https://download.configserver.com/csf.tgz sudo tar -xzf csf.tgz sudo sh install.sh sudo perl /etc/csf/csftest.pl sudo sed -i 's/TESTING === "1"/TESTING === "0"/g' /etc/csf/csf.conf sudo csf -r
Create a temporary script with sed (or any other utility) for immediate script creation to run in-place
Every library is usually split into serveral packages such as: foo #the library foo-bin #binaries used by foo foo-dbg #debug symbols used by foo foo-dev #development stuff used by foo foo-devel #development stuff used by fooWhen you compile any software the respective development files of all dependent libraries need to be installed such as libvte-devel. Ubuntu and Debian based systems use the suffix -dev but Fedora uses the suffix -devel. But its basically the same. On my system I have installed both libvte-2.90-dev and libvte-dev. If you checked out the lastest version from git, then its well possible that your system does not match the necessary requirements since the required packages are not available. In that case you either need to manually install the necessary libraries plus their development files or you can resort to jhbuild, a build system developed by gnome that can help you find and build are the dependencies.
I am on Fedora 20. I am trying to make gnome-terminal. The automake does not find certain packages. I do not understand why. Here is the part I do not understand. checking which gtk+ version to compile against... 3.0 checking for TERM... no configure: error: Package requirements (vte-2.91 >= 0.37.0 glib-2.0 >= 2.40.0 gio-2.0 >= 2.33.2 gtk+-3.0 >= 3.9.9 gsettings-desktop-schemas >= 0.1.0 dconf >= 0.14.0 uuid x11) were not met:No package 'vte-2.91' found Requested 'glib-2.0 >= 2.40.0' but version of GLib is 2.38.2 No package 'uuid' found-- No page 'vte-2.91' found. Is it looking for package vte-2.91 or package vte? I have vte installed, but not package vte-2.91. Fedora names the package vte. What am I to do? Current thoughts: I need to download the source for vte version 2.91 and compile. -- No package 'uuid' found. When I attempt to install uuid, yum install says the package is installed. # yi is an alias for yum install me $ yi uuid.i686 uuid-devel.i686 [sudo] password for me: Loaded plugins: langpacks, refresh-packagekit Package uuid-1.6.2-21.fc20.i686 already installed and latest version Package uuid-devel-1.6.2-21.fc20.i686 already installed and latest version Nothing to do me $ How do I fix the uuid problem?
Trying to automake gnome-terminal
I eventually found a way to handle python with autotools. Makefile.am allow you to override install and uninstall like this : install-exec-local: cd src/ && python setup.py install --record $(pythondir)/installed_files.txtuninstall-local: cat $(pythondir)/installed_files.txt | xargs rm -rf \ rm -r $(sysconfdir)/ninaspecial thanks to Kevin Brown for his amazing tutorial. https://blog.kevin-brown.com/programming/2014/09/24/combining-autotools-and-setuptools.html
I'm currently building a large package which is handled with automake. Package is composed by C,C++ and Python. So far i have good results with C/C++ but i'm blocked when it comes to python dependencies. I personnaly run a script when i'm installing, and i'd like to run it whenever make install is called. For now it's called by configure.ac but it's run at unecessary times. The script is doing 3 things :Placing some python files in /usr/local/lib/python2.7/(dist|site)-packages Installing a homemade python module Checking for python & program dependencies such as geckodriver and install those if necessaryI know that makefiles generated by automake are "creating commands" that are triggered when install or uninstall by example, and i'd like to know how to tell makefile.am to call somescript.sh when install is called and to call someOtherscript.sh when uninstall is called to remove what my program installed. A bit like preinst script in debian packages.
Specify script to run with install command automake
This old workaround seems to be still working mylibdir = $(libdir) dist_mylib_SCRIPTS = libxxx.so
I have a precompiled shared object that I need to distribute with the package I'm building, how do I get automake to copy the shared object to the lib/ folder where it places all of the rest of the shared objects that it compiles during the compilation process?
How to add a precompiled library in autotools?
I found out what is problem in. I use filezilla to transport automake to Raspberry Pi (running on Raspbian) in unpacked form. When I transported packed automake.tar through fillezila and then unpacked it on RPi and did installation of this one then I have no problem. However many thanks for all your answers and an effort to help me.
I have problem with installing automake 1.14.1 on Rapbian (2014-09-09-wheezy-raspbian) distro. I wrote sh ./configure and then I wrote make then terminal wrote me that: $ make CDPATH="${ZSH_VERSION+.}:" && cd . && "/home/pi/LIBRARY/automake-1.14./twrap/aclocal-1.14" Can't locate /home/pi/LIBRARY/automake-1.14.1/bin/aclocal in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5usr /share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /home/piLIBRARY/automake-1.14.1/t/wrap/aclocal-1.14 line 29.Makefile:2493: recipe for target 'aclocal.m4' failed make: *** [aclocal.m4] Error 2I don't know what does it mean. Can you help me what to do next?
Automake - problem with installing version automake-1.14.1
I've figured it out. This error is related to the amhello-1.0.tar.gz file. The originally provided file was not configured properly for my system. Therefore, if I rebuild the file myself, and replace the original amhello-1.0.tar.gz, then I can run make with no errors. To see how to rebuild amhello-1.0.tar.gz so that its configured properly to your system, see the link below: https://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html By the way, it is also important to run autoreconf -vfi before compiling the package.
I'm attempting to install automake-1.13.4 on my system. First, I do ./configure which creates a Makefile compatible with my system. However, when I execute make, it runs for a bit, but then returns the following error message: /bin/sh: -c: line 5: syntax error near unexpected token || /bin/sh: -c: line 5: ` { || exec 5>&2 >$tmp 2>&1; } \' make: *** [doc/amhello-1.0.tar.gz] Error 1I can't seem to figure out why this is occuring. Any help would be greatly appreciated.
Error in bin/sh when installing automake-1.13
You can specify your own “if found” action (this will override the default): AX_CHECK_X86_FEATURES([CXXFLAGS="$CXXFLAGS $X86_FEATURE_CFLAGS"])or use @X86_FEATURE_CFLAGS@ directly in Makefile.am.
The autoconf AX_CHECK_X86_FEATURES will test for -mavx, -mavx2, etc and add it to CFLAGS. What is the right way to propagate it to CXXFLAGS too? Is it "clean" to always add CFLAGS to CXXFLAGS? It doesn't seem so... But my C++ code contains some avx2 code, so I need this.
AX_CHECK_X86_FEATURES for CXXFLAGS
The problem is that the latest stable autoconf version, 2.69, was released eight years ago, in 2012. In 2013 a Red Hat employer added the --runstatedir option (https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=a197431414088a417b407b9b20583b2e8f7363bd). But since there has not been a stable release since then the option has never been released. Debian adds the patch to its autoconf package (https://sources.debian.org/patches/autoconf/2.69-11.1/add-runstatedir.patch/), so you can see the option in the wild. But Fedora doesn't. By the end of October this year, 2020, autoconf 2.70 is planned to be released (https://lists.gnu.org/archive/html/autoconf/2020-09/msg00006.html) which will solve the issue. I don't expect Fedora 33 to include it, though. So until Fedora 34, next year, the issue will still be there for you. Unless you have any hurry the solution is to just wait.
Slurm is an open source project using gnu autotools to build. The problem is as follows: when applying autoreconf to the project, the Makefile.in files created are missing the runstatedir macro. I'm using Fedora 32, and after filing a bug with the project owners (Schedmd) I've received a WONTFIX resolution with the following answer:This is due to differences between the Debian/Ubuntu vs. Fedora autotools packaging. The build tooling is managed on Debian/Ubuntu - which does not produce such a diff today. Thus I won't be applying this.My question is - can I modify anything in the project to make it "universally" correct - that is - ensure autoreconf does the right thing on both Fedora and Ubuntu? The Fedora autotools package used is current as of this writing: rpm autoconf-2.69-33.fc32.noarch I have no idea which autoconf version is used in Debian/Ubuntu.
How do I modify a debian/ubuntu based gnu autotooling build to fedora 32?
It is fairly common for software to install example configurations and let the user copy and modify this configuration for use with their actual installation. By "user" I mean anyone installing the software, be it a local administrator (root) installing the software system-wide or an unprivileged user installing the software under their $HOME somewhere. Example configuration files may, for example, be installedin or under sysconfdir, but with a modified filename (for example with a .example suffix). is a separate examples directory somewhere under docdir.The INSTALL document would then direct the user to copy and modify these examples to suit their needs. The benefit of this is that the user installing a new version of the software would get an up to date example of the configuration file or files. They can then update their actual configuration based on the new files if they need to do so. Avoiding installing a new configuration file, and not installing examples, would possibly leave the user in a bewildered state when the syntax of the configuration, or any of its settings, has changed as they don't know what the file should look like (unless this is clearly mentioned in the utility's manual and upgrade instructions).
In Makefile.am we have: bin_PROGRAMS = sample sample_SOURCES = main.cpp sampleconfdir = $(sysconfdir)/sample sampleconf_DATA = sample.cfgwhenever I install the application using make install, the file sample.cfg gets overwritten. How to tell automake to skip copy if file is already present?
How to prevent automake from overwrting _DATA file
You can use your package manager to find out which package clang-tidy provides. For example on Fedora/CentOS: dnf whatprovides '*/clang*tidy*'On Debian/Ubuntu you can use an analogous apt-file search command. However, on Fedora 23 clang-tidy just isn't packaged. No match is found. There is even an open bug report: Missing clang-query and clang-tidy For Ubuntu/Debian, the LLVM project maintains an llvm apt repostiory. This should be the easiest way to get the latest clang-tidy. After configuring that repository and doing an apt-file update and apt-file search should return the package that provides clang-tidy. An alternative to building from source is to use the upstream llvm pre-built binaries - they are available for Fedora, CentOS etc. For example the one for Fedora 23 does contain clang-tidy: clang+llvm-3.8.0-x86_64-fedora23/bin/clang-tidy
I have clang installed from packages on both Ubuntu 14.07, Centos 7 and Fedoara 22. I would like to use clang-tidy but can neither find a package nor how to install it without installing clang from source. That's something I would rather not do. What am I missing? I might be dense, if so please mock me.
clang-tidy install
Your version of Mint is based on Ubuntu 16.04, so you should use the sources for that (as documented on the repository's main page): deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main # 3.8 deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main # 3.9 deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 mainYou shouldn't need the ubuntu-toolchain-r/test PPA.
I know that there are similar questions for installation of clang-lower versions. But, I am trying to follow them to install clang-3.9 or 4.0 , but I am unable to do so on my Linux Mint 18. First, I was only getting options upto clang-3.8 using sudo apt-get install clangfollowed by pressing tab twice. Then, I followed this link and followed whatever is there in the first answer. Now, I can see clang-3.9 and clang-4.0 when I press tab after typing sudo apt-get install clang. Now, when I do sudo apt-get install clang-4.0I get the following error:- The following packages have unmet dependencies: clang-4.0 : Depends: libjsoncpp0 (>= 0.6.0~rc2) but it is not installable E: Unable to correct problems, you have held broken packages.
How to install clang 3.9 or higher using apt-get on Linux Mint?
I am specifically wondering about the kernel and whether there are forks that eliminate gcc/gnu dependencies--No-one is going to finish the work syncing up clang & Linux and then maintain that as a long-term fork. Especially when there's such interest and willingness from mainline. Unless it was a small part of a big visible project, which you would have found. (As you did...).consider this a subsidiary question of the title--it seems to me it would be a waste to ask it separately.Android, as mentioned by the first answer. Some parts get merged so maybe it's not as bad as it was. I'm not really up to date on this. Mainline certainly gets work for some ARM CPU related stuff e.g. BIG.little. And Android repeatedly rebase on mainline versions; Google is not going to fall too far behind. But it's a long running fork. It doesn't run on "upstream first" rules. They're carrying a lot of hardware support. IMO "Android" and "Google" are good pointers to the levels of resource you need for something that justifies being called a fork of Linux.Android has also been a problem in that devices running it ship with kernels containing large amounts (often millions of lines) of out-of-tree code. -- https://lwn.net/Articles/738225/Also RHEL kernels, which have terrifying names like 2.6.32-754 as of 2018. These are not just security updates; they will include support for some new hardware, while at the same time aiming to provide closer behaviour to the base kernel version e.g. 2.6.32. I believe fork is a appropriate word for the resources RH require to maintain this. Running well on a wide range of recent hardware is costly, and hence valuable. That's mostly what the Linux kernel project is, and I'd say it's the single most important factor to understand these two forks. You might compare the code size of vim and Linux on openhub.net and think, oh, Linux is "only" about 20x the size. However the difference in number of commits is significantly larger; the rate of churn is quite ferocious. Also, it's not just that kernel code is harder to get right... though it is... but also it's hardware support. When your apparently harmless refactoring ends up breaking a few devices, you need to have access to those specific devices to debug and fix the problem. Hardware support makes me think of https://en.wikipedia.org/wiki/Embeddable_Linux_Kernel_Subset :-P. In this world of server virtualization, you might also think there would be fork(s) optimized for it, as they would not need to keep up with so much different hardware. I can't think of any good examples though. You could look up "unikernels"; there seem to be several not based on Linux.linux-rt / PREEMPT_RT also comes to mind as an out of tree patch set. This is a patch set which is rebased on successive mainline versions. 200 KB (compressed) of specialist code is a respectable patch set. Some large pieces of it have been merged in, at at least one point.
A google search reveals this slashdot story yielding this github repository that hasn't had a commit since 2016. There are 22,602 forks listed on github.com but these are going to be mostly (if not virtually all) simply development forks for torvalds/linux. I have read before that Linux has become quite crufty. It seems to me that, at least in terms of user experience, Linux has become much more polished than I remember 10+ years ago (obviously this is not an accurate assessment of the kernel; I am only now reading K&R and have never dipped into the kernel source except a cursory glance that yielded a "whoa, I can't understand a line of this", but I am aware of a great amount of development regarding linux-on-the-laptop features in the kernel, for example). Regardless, I know I've seen BSD people complaining about Linux cruft. Considering the neovim fork of vim based on vim's cruft, I would think similar efforts would be rewarding for the kernel. What prompts this question was this article on LWN discussing attempts to compile Linux with clang. I've read that the kernel uses many quirks/special features specific to gcc for optimization (though the linked article seems to downplay them compared to my memory), and I began to wonder if anyone had attempted to refactor/fork the kernel to make it more portable, or at least compilable outside of the gnu-environment. I also understand that gcc iteself is crufty, and Linus himself has criticized it. I know I am not alone in my personal distaste for RMS and GNU and interest in Linux devoid of GNU; I am aware of Alpine Linux which does without gnu tools, but the kernel is still compiled with gcc, isn't it? There are many references to alternative toolchains and userland software, but I am specifically wondering about the kernel and whether there are forks that eliminate gcc/gnu dependencies--consider this a subsidiary question of the title--it seems to me it would be a waste to ask it separately.
Are there any successful forks or refactors of the Linux Kernel?
Try setting the variables to the output of llvm-config using command substitutions, rather than the raw commands themselves: set -x CGO_CPPFLAGS (llvm-config --cppflags | tr -s ' ' \n) set -x CGO_LDFLAGS (llvm-config --ldflags --libs --system-libs all | tr -s ' ' \n) set -x CGO_CXXFLAGS '-std=c++11'The pipe through tr is to avoid getting bitten by a difference in behaviour between bash/zsh and fish.
this is my fish configuration: set -x CGO_CPPFLAGS 'llvm-config --cppflags' set -x CGO_LDFLAGS 'llvm-config --ldflags --libs --system-libs all' set -x CGO_CXXFLAGS '-std=c++11'I've tried running make on my LLVM-based project, but I get the following error: clang: error: unsupported option '--cppflags' clang: error: no such file or directory: 'llvm-config' make: *** [all] Error 2Is this an error in my configuration file? If so, what am I doing wrong?
Can't seem to set environmental variables in fish correctly?
You're right - simply swapping toolchains will not magically make it work. As an experienced musl user I can say this will not work "out of the box". Many, many programs still require special cases glibc only provides which are even not in musl, and especially many GNU project programs will not even compile without glibc presence. The big work of fixing popular, but broken programs currently is in progress, and you can monitor and participate if you want. There are projects like sabotage linux which generate patches for such programs to make them work with musl (and other less known libcs as well), so if you are brave enough, you can try to fix major build breakages with help of those projects. To make plain LFS work you will end up probably massively hacking the book. (Back into 2009 when I've built LFS last time I remember there were still unexplained instructions which worked around some glibc special cases) As an alternatives, you can try:CLFS embedded, which had replaced glibc with musl. You can merge both books to make something that will work in your situation. Although it completely omits classical GNU software. Use one of those new musl-based Linux distributions available. As an examples, I can name sabotage and alpine, but musl wiki names more. At least you can build binaries on host and them try to import them to your device.Since you are trying to build binaries for embedded platform, I highly suggest you not to mess up with GNU software, but try lightweight alternatives instead.
Firstly, this isn't my first attempt at building an LFS system - I've already successfully built LFS 7.8 and LFS 7.8-systemd. I would like to replace GCC+GlibC with ELLCC, which is Clang/LLVM+musl. It has a few limitations - the most notable of which is that it currently lacks support for dynamic linking - but the intended end is a cross-compiled (or better yet, compiled on-device) armhf LFS build, as part of an experiment in replacing Android completely with Linux on an old device of mine, so the efficiency of the binaries produced matters (hence the reason I'm interested in using ELLCC.) The real question is, how would I go about doing this? Simply replacing GCC and GlibC with ELLCC won't even let me get past installing the Linux API headers. I can compile some of the programs from source separately, but they always end up relying on the host system in one way or another.
Building an LFS system using ELLCC
You seem to be having a number of issues, summarised below. You almost certainly should be using a port for python as noted by @mjturner, which will use the native FreeBSD OpenSSL.in csh the syntax set CC clang sets two variables named CC and clang to the empty string, you want set CC=clang, but even that won't work (see next point) simply setting a variable in your csh shell won't affect anything else, you really want to use setenv CC clang (note this one doesn't use =). config is an sh script, so the variable must be exported to be seen. libc is not a dependency of gcc, almost everything you link dynamically will be linked against libc (on FreeBSD this is not GNU glibc). The alternative is to link statically which, if possible, removes the dynamic dependency by embedding the required code in the final binary. (When you use gcc there may be a libgcc dependency on some platforms and is used for exception handing. This is harder to avoid.) I would expect you will have trouble linking python statically.If you are instead building OpenSSL and python using clang for some purpose such as distribution of binaries (assuming you have carefully read the relevant licence agreements), or have a requirement for specific software versions, this should be possible by correctly setting CC. I note though that the OpenSSL port does not do this, it opts to patching the gcc commands out of the Configure script and uses the FREEBSDCC environment variable instead. Other advice:see the OpenSSL wiki for using clang: https://wiki.openssl.org/index.php/Compilation_and_Installation#Modifying_Build_Settings clang is in fact covered, but not FreeBSD specifically because all BSDs are considered effectively equivalent there. make sure to run make test after you build OpenSSL make sure to compile everything with the same compiler, this means python and everything in lib-dynload
I have a 64 bit FreeBSD build machine. I need to add https support in my python3 application code. For that it is advised to build/compile python with openssl support. I do not need any gcc dependency in my final executable. So instead i am using clang to build python. But before that while building openssl I am unable to do so. I even used "set CC clang". But still openssl is taking up gcc as the c compiler.So on running "ldd" on the final dynamic executable it is showing up libc dependency. This link does not mention anything about FreeBSD and clang. (https://wiki.openssl.org/index.php/Compilation_and_Installation) Please suggest some alternative? [EDIT] These are the command I am executing on my \bin\sh shell set CC clang ./config -fPIC In the output I notice the following line which indicates gcc being used: BN_ASM =x86_64-gcc.o
How to build openssl with clang(rather than gcc) on a FreeBSD machine?
Just build the Fedora37 package of clang locally :) Install mock, add your user to the mock group, go to the RPM source page, i.e., https://src.fedoraproject.org/rpms/clang , click on clang-15 for F37, get the clang-15.0.0-2.fc37.src.rpm , and tell mock to build it in a container for your target architecture (assuming that is x86_64): mock --config /etc/mock/fedora-36-x86_64.cfg --rebuild clang-15.0.0-2.fc37.src.rpmMake yourself a coffee or two, and install the resulting rpms from the target directory you'll see at the very end of a successful run. (Hint: use cd /path/to/the/binary/rpms; sudo dnf install ./rpm1.rpm ./rpm2.rpm … to install them, satisfying dependencies as needed. You will need to install clang, libllvm and so on from that directory at once, to let dnf satisfy the dependencies.)
I'm considering switching to Fedora, but the latest stable Fedora (36) only ships Clang 14, while the latest release is Clang 15. Is there any way to get up-to-date binaries, without switching to the beta version of Fedora? I found https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots/, but they only produce trunk builds, not the stable releases.
How to install the latest stable Clang on Fedora?
If FreeBSD supports some Linux cross-compiler tools(and you can port them to FreeBSD if they doesn't exists in their repositories) then probably yes. It is not FreeBSD tool but i know one tool with Linux distro that can build cross-compilers from source and switch between compiler relatively easy is crossdev from Gentoo Linux. I suggest you installing Gentoo if you want to do any sort of compiling (cross or built-in) and then when compiled with Gentoo linux you can copy and paste your package to your FreeBSD.
Is there a way to compile a C program with Clang compiler for MIPS (32-bit) on a FreeBSD x86_64/AMD64 system?
Compiling a C program with Clang for MIPS (32-bit) on a FreeBSD x86_64/AMD64 system
This issue can be reproduced with older versions of clang-format available for install with yum in sglim2/centos7 docker image for example. clang-format --version has been modified to return 0 in this commit:CommandLine: Exit successfully for -version and -help Tools that use the CommandLine library currently exit with an error when invoked with -version or -help. This is unusual and non-standard, so we'll fix them to exit successfully instead. I don't expect that anyone relies on the current behaviour, so this should be a fairly safe change. llvm-svn: 202530
I'm working on a RHEL7 and I just installed clang: sudo yum install clang. Then I execute the command clang-format --version and the output is below: me@localhost:~$ clang-format --version LLVM (http://llvm.org/): LLVM version 3.4.2 Optimized build. Built May 10 2018 (10:48:27). Default target: x86_64-redhat-linux-gnu Host CPU: x86-64me@localhost:~$ echo $? 1As you see, clang-format --version seems to work without any error but echo $? shows me a 1. What's wrong with this command? I just did the same thing on an Ubuntu system and there is no such an error. The output of type -a clang-format: clang-format is /usr/bin/clang-format clang-format is /bin/clang-formatThe output of file "$(command -v clang-format)": /usr/bin/clang-format: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=899595580dbae12ee1ae6eb9feb8a19aa6d51f49, stripped
Why does `clang-format --version` return 1
A compiler like clang++ only does compiling of the source code. In your case, it creates the executable file a.out (since you didn't explicitly tell it to use some other output filename using the -o option). The compiler will not automatically run the resulting executable. These things also holds true for g++ (the GNU C++ compiler) as well as for both the clang and gcc C compilers (and most other compilers of languages requiring compilation). To run the executable, issue the command ./a.outat the shell's command prompt. To give the executable another name than the traditional default of a.out, use something like clang++ -o myprog file_name.cppto create myprog from the sources in file_name.cpp.Given the sources in the single file file_name.cpp, make can also be used to compile the sources into the executable file_name using the command make file_namewhile in the same directory as the source code file (but only if the source code has been updated since file_name was last compiled). This requires no Makefile to be present but will instead use implicit rules built into make for compiling C++ sources. Use CXX=clang++ make file_nameto explicitly use the clang++ compiler. For more on this, see the GNU make documentation about implicit rules (other implementations of make, e.g. on BSD systems, use similar implicit rules).
I try to compile a program by typing (lets assume here I'm cd'd into the directory) clang++ file_name.cpp. It compiles and should autorun, but it doesn't, and just ends the event, and opens the terminal back for input. I see a file named 'a.out' in the folder directory. And if I type clang++ file_name.cpp, nothing happens, and I am back in the terminal. If I type clang++ a.out.cpp, the compiler says it can't find the file, and the compiler closes. I tried to see if clang is properly installed, and it is. I don't know what's wrong.
Clang++ Compiles, but doesn't run
You need to use clang++. clang is the C compiler, clang++ is the C++ compiler. Like gcc. I think these are basically the same compiler under the hood, but (again like gcc), clang++ links against the C++ libraries by default, while clang doesn't. Hence the linker errors.
Installed clang: $~/Projects/clang$ sudo apt-get install clang Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: clang 0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded. Need to get 0 B/3,590 B of archives. After this operation, 42.0 kB of additional disk space will be used. Selecting previously unselected package clang. (Reading database ... 259453 files and directories currently installed.) Preparing to unpack .../clang_1%3a3.5-23ubuntu1_i386.deb ... Unpacking clang (1:3.5-23ubuntu1) ... Processing triggers for man-db (2.7.0.2-2) ... Setting up clang (1:3.5-23ubuntu1) ...Compile code: $~/Projects/clang$ clang hw.cpp /tmp/hw-70de0d.o: In function `main': hw.cpp:(.text+0x8): undefined reference to `std::cout' hw.cpp:(.text+0x1a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/hw-70de0d.o: In function `__cxx_global_var_init': hw.cpp:(.text.startup+0x10): undefined reference to `std::ios_base::Init::Init()' hw.cpp:(.text.startup+0x16): undefined reference to `std::ios_base::Init::~Init()' clang: error: linker command failed with exit code 1 (use -v to see invocation)Source code: #include<iostream> int main() { std::cout<<"Hello,World!\n"; }What else is needed to use clang?
What else is needed to use clang besides "apt-get install clang; clang hw.cpp"?
I solved it! In the make file, add: FLEX_PATH := $(shell dirname $(shell which flex)) LIB_PATH := $(shell readlink -f "$(FLEX_PATH)/../lib")clang ... -L $(LIB_PATH) -lfl ...
I'm new to NixOS and I'm trying to build a project which uses Flex. I get the following error if I try and build the project /nix/store/b10shv9yqbgps47y0n8x7l7bq8fmp1i6-binutils-2.31.1/bin/ld: cannot find -lfl How can I resolve this? `ld: cannot find -lc` on NixOS shows that I need to add glibc.static to shell.nix's buildInputs but that hasn't resolved anything. Edit: Here is shell.nix { pkgs ? import <nixpkgs> {} }with pkgs;stdenv.mkDerivation { buildInputs = { name = "my-project"; buildInputs = [ flex ] } }
Unable to use -lfl on NixOS
LIThe problem was solved by implementing the code: brew install -s ncviewUsing homebrew (extra Linux code for Mac), that installed the whole ncview package automatically for the Apple Mac, including it's dependencies. See: katbormann commented on 13 Jul 2016 on GitHub post.
I am trying to install UDUNITS-2 package for the graphical visual browser: ncview. I need to understand the following error message: clang: error: no such file or directory: '_REENTRANT'A similar question was given here ---> Xcode 7.2 - clang: error: no such file or directory: My ./configure output: brendan-darrer:Downloads brendandarrer$ cd src/ brendan-darrer:src brendandarrer$ ls COPYRIGHT INSTALL NOTEBOOK README VERSION admin configure.in perl udunits CUSTOMIZE Makefile.in ORIGIN RELEASE_NOTES aclocal.m4 configure lib port brendan-darrer:src brendandarrer$ ./configure creating cache ./config.cache configure: warning: reading configuration customizations checking type of operating system... darwin checking for c89... c89 checking for dependency generation mechanism... c89 -M checking how to run the C preprocessor... c89 -E checking the C preprocessor... works checking for C const... yes checking for C volatile... yes checking for C signed... yes checking for C function prototypes... yes checking for standard C variadic functions... yes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: illegal option -- M usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ... [-o outfile] [-O optlevel] [-U name]... operand ... checking for standard C string generation... yes checking for standard C token pasting... yes checking C void pointer... yes checking type of machine... x86_64 checking for ar... ar checking for tar flags... -chof checking for ranlib... ranlib checking binary distribution directory... /home/ftp/pub/binary/x86_64-darwin checking the installation prefix... /Users/brendandarrer/Downloads checking the installation exec-prefix... /Users/brendandarrer/Downloads/bin checking for neqn... neqn checking for tbl... tbl /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: illegal option -- M usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ... [-o outfile] [-O optlevel] [-U name]... operand ... checking C header file <stddef.h> for typedef size_t... declared checking for ar... (cached) ar checking for float.h... yes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: illegal option -- M usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ... [-o outfile] [-O optlevel] [-U name]... operand ... checking C header file <stdlib.h> for typedef size_t... declared checking for atexit... yes checking C header file <stdlib.h> for function atexit()... declared checking for getenv... yes checking C header file <stdlib.h> for function getenv()... declared /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: illegal option -- M usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ... [-o outfile] [-O optlevel] [-U name]... operand ... checking C header file <string.h> for typedef size_t... declared checking for strerror... yes checking C header file <string.h> for function strerror()... declared checking for strstr... yes checking C header file <string.h> for function strstr()... declared checking for memmove... yes checking C header file <string.h> for function memmove()... declared /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c89: illegal option -- M usage: c89 [-cEgs] [-D name[=value]] [-I directory] ... [-L directory] ... [-o outfile] [-O optlevel] [-U name]... operand ... checking C header file <time.h> for typedef time_t... declared checking C header file <time.h> for typedef size_t... declared checking for difftime... yes checking C header file <time.h> for function difftime()... declared checking for strftime... yes checking C header file <time.h> for function strftime()... declared checking for perl... perl checking for type of perl executable to create... dynamic checking for position-independent compilation flags... '' updating cache ./config.cache creating ./config.status creating Makefile creating lib/Makefile creating udunits/Makefile creating perl/Makefile.PL creating port/master.mk creating port/Makefile creating port/misc/Makefile creating port/fortc/Makefile creating port/misc/udposix.h creating port/misc/stdarg.h creating port/misc/stddef.h creating port/misc/stdlib.h creating port/misc/string.h creating port/misc/time.h expanding `include's in file `Makefile' expanding `include's in file `lib/Makefile' expanding `include's in file `udunits/Makefile' expanding `include's in file `perl/Makefile.PL' expanding `include's in file `port/master.mk' expanding `include's in file `port/Makefile' expanding `include's in file `port/misc/Makefile' expanding `include's in file `port/fortc/Makefile' brendan-darrer:src brendandarrer$ make Makefile:279: warning: overriding commands for target `/Users/brendandarrer/Downloads/lib' Makefile:276: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/lib' Makefile:384: warning: overriding commands for target `/Users/brendandarrer/Downloads/bin' Makefile:381: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/bin' Makefile:418: warning: overriding commands for target `/Users/brendandarrer/Downloads/include' Makefile:415: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/include' Makefile:448: warning: overriding commands for target `/Users/brendandarrer/Downloads/etc' Makefile:445: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/etc' Makefile:503: warning: overriding commands for target `/Users/brendandarrer/Downloads/man' Makefile:491: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/man' Makefile:541: warning: overriding commands for target `/Users/brendandarrer/Downloads/info' Makefile:538: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/info'making `all' in directory /Users/brendandarrer/Downloads/src/portMakefile:263: warning: overriding commands for target `/Users/brendandarrer/Downloads/lib' Makefile:260: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/lib' Makefile:368: warning: overriding commands for target `/Users/brendandarrer/Downloads/bin' Makefile:365: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/bin' Makefile:402: warning: overriding commands for target `/Users/brendandarrer/Downloads/include' Makefile:399: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/include' Makefile:432: warning: overriding commands for target `/Users/brendandarrer/Downloads/etc' Makefile:429: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/etc' Makefile:487: warning: overriding commands for target `/Users/brendandarrer/Downloads/man' Makefile:475: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/man' Makefile:525: warning: overriding commands for target `/Users/brendandarrer/Downloads/info' Makefile:522: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/info' Makefile:263: warning: overriding commands for target `/Users/brendandarrer/Downloads/lib' Makefile:260: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/lib' Makefile:368: warning: overriding commands for target `/Users/brendandarrer/Downloads/bin' Makefile:365: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/bin' Makefile:402: warning: overriding commands for target `/Users/brendandarrer/Downloads/include' Makefile:399: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/include' Makefile:432: warning: overriding commands for target `/Users/brendandarrer/Downloads/etc' Makefile:429: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/etc' Makefile:487: warning: overriding commands for target `/Users/brendandarrer/Downloads/man' Makefile:475: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/man' Makefile:525: warning: overriding commands for target `/Users/brendandarrer/Downloads/info' Makefile:522: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/info'making `all' in directory /Users/brendandarrer/Downloads/src/port/miscMakefile:285: warning: overriding commands for target `/Users/brendandarrer/Downloads/lib' Makefile:282: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/lib' Makefile:390: warning: overriding commands for target `/Users/brendandarrer/Downloads/bin' Makefile:387: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/bin' Makefile:424: warning: overriding commands for target `/Users/brendandarrer/Downloads/include' Makefile:421: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/include' Makefile:454: warning: overriding commands for target `/Users/brendandarrer/Downloads/etc' Makefile:451: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/etc' Makefile:509: warning: overriding commands for target `/Users/brendandarrer/Downloads/man' Makefile:497: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/man' Makefile:547: warning: overriding commands for target `/Users/brendandarrer/Downloads/info' Makefile:544: warning: ignoring old commands for target `/Users/brendandarrer/Downloads/info' c89 -c -g -I. -D_REENTRANT uddummy.c clang: error: no such file or directory: '_REENTRANT' make[3]: *** [uddummy.o] Error 1 make[2]: *** [misc/all] Error 1 make[1]: *** [subdirs/all] Error 2 make: *** [port/all] Error 1 brendan-darrer:src brendandarrer$
clang: error: no such file or directory: '_REENTRANT'
There are 3 methods that I'm aware of: pwdx $ pwdx <PID>lsof $ lsof -p <PID> | grep cwd/proc $ readlink -e /proc/<PID>/cwdExamples Say we have this process. $ pgrep nautilus 12136Then if we use pwdx: $ pwdx 12136 12136: /home/samlOr you can use lsof: $ lsof -p 12136 | grep cwd nautilus 12136 saml cwd DIR 253,2 32768 10354689 /home/samlOr you can poke directly into the /proc: $ readlink -e /proc/12136/cwd/ /home/saml
What command(s) can one use to find out the current working directory (CWD) of a running process? These would be commands you could use externally from the process.
Find out current working directory of a running process?
Your shell has a builtin pwd, which tries to be "smart". After you did a cd to a symlink the internal pwd fakes the output as if you moved to a real directory. Pass the -P option to pwd, i.e. run pwd -P. The -P option (for “physical”) tells pwd not to do any symbolic link tracking and display the “real” path to the directory. Alternatively, there should also be a real binary pwd, which does not do (and is even not able to do) this kind of magic. Just use that binary explicity: $ type -a pwd pwd is a shell builtin pwd is /bin/pwd $ mkdir a $ ln -s a b $ cd b $ pwd /home/michas/b $ /bin/pwd /home/michas/a
Say I do the following: cd /some/path ln -s /target/path symbolic_nameIf then do: cd /some/path cd symbolic_name pwdI get: /some/path/symblic_nameand not: /target/pathIs there a way to have the shell "fully resolve" a symbolic link (i.e. updating CWD, etc.), as if I had directly done: cd /target/path? I need to run some programs that seem to be "aware" or "sensitive" about how I get to my target path, and I would like them to think that I arrived to the target path as if had done cd /target/path directly.
Resolving symbolic links (pwd)
AFAIK, there is no such dedicated utility in the POSIX tool chest. But it's common to invoke sh to set up an environment (cwd, limits, stdout/in/err, umask...) before running a command as you do in your sh script. But you don't have to write that script in a file, you can just inline it: sh -c 'CDPATH= cd -P -- "$1" && shift && exec "$@"' sh /some/dir cmd args(assuming the directory is not -). Adding CDPATH= (in case there's one in the environment) and -P for it to behave more like a straight chdir(). Alternatively, you could use perl whose chdir() does a straight chdir() out of the box. perl -e 'chdir(shift@ARGV) or die "chdir: $!"; exec @ARGV or die "exec: $!" ' /some/dir cmd args
We have env(1) to modify the environment of the command we want to run (for example env MANPAGER=more man dtrace). Is there something similar but for modifying the directory that the command is going to be started in? Ideally, I would like it to look like this: theMagicCommand /new/cwd myProgramThis way it could be "chained" with other env(1)-like commands, e.g., daemon -p /tmp/pid env VAR=value theMagicCommand /new/cwd myProgramSo far I can think of the following solution, which unfortunately does not have the same interface as env(1): cd /new/cwd && myProgramAlso, I can just create a simple shell script like this: #! /bin/sh - cd "${1:?Missing the new working directory}" || exit 1 shift exec "${@:?Missing the command to run}"but I am looking for something that already exists (at least on macOS and FreeBSD). myProgram is not necessarily a desktop application (in which case I could just use the Path key in a .desktop file).
Is there a POSIX (or at least a popular) utility to set the current working directory when invoking a program?
A symlink actually stores the path you give literally, as a string¹. That means your link ~/mylink contains "." (one character). When you access the link, that path is interpreted relative to where the link is, rather than where you were when you made the link. Instead, you can store the actual path you want in the link: ln -s "$(pwd)" ~/mylinkusing command substitution to put the output of pwd (the working directory name) into your command line. ln sees the full path and stores it into your symlink, which will then point to the right place. ¹ More or less.
I am now under a directory with very long path. For future visiting it quicker, I would like to create a link to it. I tried ln -s . ~/mylink ~/mylink actually links to ~. So can I expand ~ into the obsolute pathname, and then give it to ln?
Create an absolute symbolic link to the current directory
If you only give a username as argument, su changes user without changing much else:For backward compatibility, su defaults to not change the current directory and to only set the environment variables HOME and SHELL (plus USER and LOGNAME if the target user is not root).So su postgres stays in the same directory. However since HOME is set to the new user’s home directory, cd will take you to the right place. To log in and start from the user’s default directory, you need to ask su to start a login shell set up appropriately: su -l postgresor its common synonym, su - postgres
I feel like this should be straightforward but I've never seen anyone ask this that I can tell. The situation is pretty straight forward. Whenever I become a user, ie su user it always starts in /root directory instead of it's home directory. Let me show you. [root@st-test2 ~]# grep "postgres" /etc/passwd postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql/:/bin/bash [root@st-test2 ~]# su postgres bash-4.2$ pwd /root [root@st-test2 ~]# ls -lhart /var/lib |grep postgres drwx------. 4 postgres postgres 86 May 5 16:07 pgsqlSo, you can see that the postgres user's home directory exists and that its set in /etc/passwd...but for some reason, they start in the root directory. This happens with every user that I have created and I have no idea why. I can't say that I've ever seen this happen before either.
Why do all users start in /root instead of their home directories after su as root?
All symbolic links are one-way. As far as the kernel is concerned, after going into /D/S1 and running chdir("ls2"), you're in /D/S2, so if you run chdir(".."), you end up in /D. If you do this in a shell, after cd /D/S1 cd ls2 cd ..you end up in /D/S1. The reason is that the shell does its own tracking of the current directory, and it remembers symbolic links. You can't disable this shell behavior on a link-by-link basis, but you can disable it when you run the cd command. After running cd ls2, the shell remembers the current directory as /D/S1/ls2: $ pwd /D/S1 $ cd ls2 $ pwd /D/S1/ls2 $ cd .. $ pwd /D/S1To instruct the shell to forget its symlink-aware current directory tracking, pass the -P option to cd. The pwd command also has a -P option. $ pwd /D/S1 $ cd ls2 $ pwd /D/S1/ls2 $ pwd -P /D/S2 $ cd -P .. $ pwd /DYou can also forget the logical tracking when you change into the symlink: $ pwd /D/S1 $ cd -P ls2 $ pwd /D/S2 $ cd .. $ pwd /D
I want to create a one way symlink i.e. I can use it to go to the destination directory but I cannot go back. Let's say there is a directory called D with two subdirectories S1 and S2. I want to create a link in S1 that points to S2 (let's say ls2 -> ../S2/). If I do cd ls2 and then cd .. then I want to go to D and not S1. Is it possible?
Can I create a one way symlink?
You can use the following script (found here) #!/bin/bashpid="$1" # first arguvment is the PID cwd="$2" # second argument is the target working directory# now let's command the GNU debugger gdb -q <<EOF attach $pid call (int) chdir("$cwd") detach quit EOFCall it by passing the PID as the first parameter and the target working directory as the second. Caveats: This may have unexpected consequences on the target process, including files being closed, and misleading information provided in shell prompts for example. You also need gdb installed (obviously).
Can I change the current working directory of a certain process? For example, I am running a process that has the pid 1000. Right now, its current working directory is ~. I want to change its current working directory to ~/1. How can I do it?
Changing the current working directory of a certain process
cwd: current working directory (a concept, state, or value) pwd: print working directory (a command)Part of the confusion may be that in some shells $PWD is actually the current working directory name, and pwd is a command to display it (similar to echo "$PWD" where available). At the library level, pwd can be implemented by a call to getcwd(3).
What is the difference between cwd and pwd? I've tried googling it, and one of the answers mentioned that depending on some factor (which I sadly do not remember), the implementation (the code I'm assuming) is not the same? I don't suppose this is like the difference between print('x') vs return str(x) (to use a Python analogy)?
What is the difference between cwd and pwd?
You may pre-populate the directory stack in your ~/.bashrc file if you wish: for dir in "$HOME/dir" /usr/src /usr/local/lib; do pushd -n "$dir" >/dev/null endor, if you want to put the directories in an array and use them from there instead: dirstack=( "$HOME/dir" /usr/src /usr/local/lib )for dir in "${dirstack[@]}"; do pushd -n "$dir" >/dev/null endunset dirstackWith -n, pushd won't actually change the working directory, but instead just add the given directory to the stack. If you wish, you can store the value of the DIRSTACK array (upper-case variable name here), which is the current directory stack, into a file from ~/.bash_logout, and then read that file in ~/.bashrc rather than using a predefined array. In ~/.bash_logout: declare -p DIRSTACK >"$HOME/.dirstack"In ~/.bashrc: if [ -f "$HOME/.dirstack" ]; then source "$HOME/.dirstack" fiI don't know how well this would work in a situation where you use multiple terminals. The .dirstack file would be overwritten every time a terminal exited, if it ran a bash as a login shell.
Ok this is a short question. I just happened to know that with pushd command, we can add more working directories into our list, which is handy. But is there a way to make this list permanent, so it can survive reboots or logoffs?
Making 'pushd' directory stack persistent
The primary differences between a virtual copy of the file system and a symbolic link are that the getcwd(3) functions work correctly in the virtual copy,getcwd’s behaviour with symlinked directories is a fairly well-known gotcha, documented in Advanced Unix Programming for example (see this SO question for a quote): chdir and getcwd aren’t symmetric when symlinks are involved. One might expect that changing directories, using chdir, to a given directory, and then retrieving the current directory, using getcwd, would return the same value; but that’s not the case when a process changes directory using a path containing a symbolic link — getcwd returns the path obtained after de-referencing all symbolic link(s). This can have unexpected consequences when changing directories to a parent directory, when the path containing symbolic link(s) and the de-referenced path have different numbers of components.and that other file systems may be mounted on the virtual copy without affecting the original.Continuing Stéphane’s example, you can mount another file system on a sub-directory of /tmp/b without affecting /some/dir, whereas mounting a file system on a sub-directory of /tmp/a will make it show up under /some/dir too.A different device number for the virtual copy is returned by stat(2), but in other respects it is indistinguishable from the original.This means that running stat on the copy, or any file thereunder, will return a different device number compared to the original, but that’s the only difference; apart from that, stat("/tmp/b/c", &buf) and stat("/some/dir/c", &buf) would return the same information.
In FreeBSD, man mount_nullfs states that:The primary differences between a virtual copy of the file system and a symbolic link are that the getcwd(3) functions work correctly in the virtual copy, and that other file systems may be mounted on the virtual copy without affecting the original. A different device number for the virtual copy is returned by stat(2), but in other respects it is indistinguishable from the original.What is the full meaning/implication of this paragraph?
Meaning of statement that 'getcwd functions work correctly' in FreeBSD man page for mount_nullfs?
The shell will not change to another directory unless you tell it to. If you want your script to execute commands in a different directory, call cd from your script. The path to the script is available as "$0". If the script is a symbolic link, that's the path to the symbolic link. If you want to get the final target of the symbolic link, call realpath (available on most but not all modern unices; it's available on Linux (both GNU and BusyBox), FreeBSD and Solaris 11, but not OSX). cd "$(dirname "$(realpath "$0")")"realpath is a relatively recent addition to GNU coreutils; if your version is too old, you can use readlink -f which is older. For non-GNU systems, if realpath isn't present then readlink may be but it typically only looks through one level of symbolic links, most readlink implementations don't have the -f option to do the full resolution.
My desire is not to change directory then execute. I use a jar file and need to execute that. So I made a very basic shell script to do that. #!/bin/sh java -jar TreeForm.jarThen, I saved it as TreeForm, not TreeForm.sh. Next, I created a symbolic link as below: ln -s /opt/TreeForm/TreeForm /usr/bin/ chmod +x /opt/TreeForm/TreeFormIt is successfully created. However, when I run, I take the error below from JAVA.Error: Unable to access jarfile TreeForm.jarSo, it seems shell script does not run its own directory or does not look into that, but works in current directory. I don't really want to modify my script file giving full path of TreeForm.jar. So I wanted to ask, is there a way to find a file relative to script file without changing the current path or adding path to PATH variable? Or is there any variable having the path of script, not the current one?
Run a shell script via a symbolic link from the directory containing the script itself
Yes, pwd has -P (--physical) option to avoid all symlinks. So do: pwd -Por you can use the canonical way, readlink: readlink -f /pathCheck man pwd and man readlink.
On one of our servers, we have a directory with the following path: "/daten/i/scripts"When you go to /daten/i, one can see that scripts is a soft link to "/batch". When I type cd /daten/i/scripts and then pwd, I see /daten/i/scripts. Is there a way, a command, that I can type in at /daten/i/scripts that shows me that I'm in a "soft link", that I am really in /batch?
How can I make pwd resolve a soft link?
A somewhat complicated use case: On some system, users' home directories may, for example, be mounted by an automounter (as on Solaris). From the Wikipedia "Automounter" article:The automounter has the purpose of conserving local system resources and of reducing the coupling between systems which share filesystems with a number of servers. For example, a large to mid-sized organization might have hundreds of file servers and thousands of workstations or other nodes accessing files from any number of those servers at any time. Usually, only a relatively small number of remote filesystems (exports) will be active on any given node at any given time. Deferring the mounting of such a filesystem until a process actually needs to access it reduces the need to track such mounts, increasing reliability, flexibility and performance.The automounter may mount a home NFS share from some central fileserver under a path such as /a or /tmp_mnt or similar, and then create a symbolic link from /tmp_mnt/home/steve (the physical home directory) to /home/steve (the logical home directory) when you log in. This has the benefit, as the Wikipedia article mentions, of only requiring one single mount of the home NFS share even if multiple users are active. When someone's home directory is no longer in use, the symbolic link may be removed, and when all users are logged out, the mounted NFS share may even be unmounted completely.A more simple example: Let's say you run out of space on /usr/local. You may then add new disks and mount them as e.g. /data/disk1 and /data/disk2. Then you may decide to copy the old contents of /usr/local/bin to /data/disk1 and /usr/local/lib to /disk/data2 and recreate /usr/local/bin and /usr/local/lib as symbolic links to these two directories. Changing directory with cd /usr/local/bin would then physically move you to /data/disk1 but logically you'd be in /usr/local/bin. This also has the effect that accessing utilities from /usr/local/bin would transparently access their physical location in /data/disk1 without you having to update your $PATH variable.Another one: You may create a symbolic link from a user-mounted USB stick or other storage device somewhere under /media as /home/steve/my_work_files. The benefit of this would be that you would be able to cd into ~/my_work_files rather than having to remember where under /media your files are located.
I understand what a logical working directory is. When you create a symbolic link to a directory, and then cd to that directory using the symbolic link, your logical working directory becomes the path of the symbolic link + the symbolic link itself! for example: $ pwd /home/john/this_is_a_symbolic_linkBut what is the benefit of a logical working directory exactly?
What is the benefit of a logical working directory?
Actually, Dir2 does exist, but the name Dir2 does not. Confused? :) The shell's current directory is still the directory referred by the name Dir2, and this keeps the directory still around. This is analogous to anonymous files. Normally, when a files link count goes to zero, the file is deleted and the inode freed. However, if a process still has the file open, the kernel does not delete the file until the process closes the file, either explicitly or implicitly by exiting. In Dir2's case, the shell is still having the directory "open" as long as it doesn't change its current directory. What is gone are the names Dir1 in the Desktop catalog and the whole hierarchy of names below it, including the . and .. entries. The directory formerly known as Dir1 is also gone (assuming no other process has it as current directory). Files and directories at the inode level do not form a hierarchy, i.e. there are no links from inodes to parent, child or sibling entries. The hierarchy is built up separately by directory entries, which are essentially (name, inode) pairs, pointing to files and other directories. After this lengthy introduction we can rephrase your original question so that it reads: "why does the shell not change its current directory to something else, when the directory entry Dir2 is removed from Dir1?" Well, one reason is that the shell doesn't even know this. Some other process has run the rm program and removed the directories, but there is no mechanism by which the shell would be told about this. Second, which directory would the shell choose as its new current directory? The directory is changed using the chdir system call, which takes a string containing the new directory as argument. The shell could try a chdir(".."), but as we saw above, we already destroyed the .. entry! Third, why should the shell change the current directory? It has no reason to do so, it is comfortable where it sits, and it is not in the habit of magically change directories without being explicitly told to do so. Granted, the situation is kind of pathological, but it is up to the user to avoid it.
I tried a little experiment where I created 2 folders Dir1 and Dir2 inside my Desktop directory, such that Dir1 is parent of Dir2. /home/username/Desktop/Dir1/Dir2 Then, I use cd to set my pwd as /home/username/Desktop/Dir1/Dir2. Next I used rm -r /home/username/Desktop/Dir1 to remove the Dir1. Now if I use pwd it still shows it to be /home/username/Desktop/Dir1/Dir2, which now doesn't exist. Also at this time if I use ls or cd .. it generates an error saying 'Cannot access /home/username/Desktop/Dir1/Dir2: No such file or diectory', which is ablsolutely true but I was thinking this issue generated because of pwd not getting updating after folder deletion. The solution to this is also simple as far as I can think, you can go the parent directory and then delete the requested directory. I want to know if there is some specific reason for pwd not getting updated, is my solution is correct and/or I just found a bug ?
Why does the pwd doesn't update after directory removal?
(cd /a && ./script1)& (cd /a/b && ./script2)&If the names don't contain spaces or special characters like *, (, or ), you don't need quotes.
Say I have this structure /masterscript /a/script1 /a/b/script2In masterscript I spawn the other scripts as background processes: "/a/script1" & "/a/b/script2" &The problem is that script1 and script2 inherit the working directory of masterscript. Is there a way to start these scripts with working directories the directories where they are?
Can I start a background process with a specific working directory?
Question 1 : Why is the directory where a program is installed not the initial directory of the process when running the program? Actually, the installation path of a program is irrelevant. What matters is the current path of the father process. In case of a program launched from a shell, the father process is the shell itself so the initial current directory of the new process is the shell's current directory. Question 2 : How can a process create a file outside from its current directory? There are two ways to give the path of a file: absolute path and relative path. An absolute path is interpreted from the root of the filesystem (/) and start with a slash ("/"). A relative path is interpreted from the current directory of the process. So if you have two directories, for example /path2 and /path2/path3, and a process whose current directory is path2, it can open a file path3/file. This path is relative (it doesn't start with a slash) so it's computed from the current directory path2. And finally, the new file's complete path is /path2/path3/file. So a process running in a given directory may create file outside of it. Question 3 : How does the OS assign and change the current path for a process, during its running? A process can ask the OS for changing its current directory by the mean of the chdir(2) system call (provided that it has needed permissions on the new directory for it, etc. etc.). That's a different mechanism which has nothing to do with opening files. Opening files is done through another system call (namely open(2)).
Suppose I write a program, which outputs a file under a relative path (as opposed to a full/absolute path) - let's say, the current path. Then I compile it and store the executable under some dir path1.Now I run the executable, while I am under a different dir path2. The executable will output a file under path2 instead of path1. I wonder why the executable doesn't write a file under path1 instead? In other words, why is the "current path" path2 not path1? If during run-time, the executable opens a file stored in path3, why does the current path become path3, although I run the executable from path2 and the executable was stored in path1?How does the OS assign and change the current path for a process, during it's run-time?
The current path of a process
What is wrong with $cwd? When you use cwd="pwd | rev | cut -d '/' -f1 | rev" and then $cwd you are actually running pwd with arguments (you do not pipe the output). So basically you are running something like this: pwd '|' rev '|' cut '-d' "'/'" '-f1' '|' revYou do not see any error because pwd will ignore non-option arguments. If you use /bin/pwd instead of pwd built-in you can notice the message: $> /bin/pwd '|' #Output /bin/pwd: ignoring non-option argumentsYou can test that behavior with this simple script.sh: #! /usr/bin/env bashprintf "I got: %s\n" "$@"Make sure you set execution permissions to script.sh Now change your cwd to: cwd="./script.sh | rev | cut -d '/' -f1 | rev"And run $cwd: (shell)> $cwd #Output I got: | I got: rev I got: | I got: cut I got: -d I got: '/' I got: -f1 I got: | I got: revAs you can see above the script ./script.sh actually got the values becuase they were passed as arguments so they were not piped. If you do want to pipe the content stored in the variable $cwd you will have to use eval, like this: eval $cwd #Output: testI recommend you use functions instead of using strings to run commands (you will avoid these kinds of problems): getBaseName() { pwd | rev | cut -d '/' -f1 | rev }getBaseName #Output: testBtw, what you are trying to do (print only test) can be achieved by using the command basename: basename $(pwd)#Output: testRegarding your commands you want to create them an alias. Again, I suggest you use functions (in my opinion alias should be used for short/non-complex commands) So you can create a function for your two scripts. Also I suggest you use . as a <CURRENT_DIRECTORY_NAME> since using a . will make reference to your current directory. If you pass the output of $cwd this will not make reference to your current path but a directory in your current path which might not exist. What I meant above is that if you are places under this path: home/<USERNAME>/Projects/VueJS/testAnd you use $cwd for passing the current working directory to the python venv like this: python3 -m venv "$cwd" what you are actually passing is this path home/<USERNAME>/Projects/VueJS/test/$cwd where in your case cwd is test then the real path you are passing is: home/<USERNAME>/Projects/VueJS/test/test. Solution to your "alias" createVenv() { python3 -m venv . && source ./bin/activate && [ ! -f ./requirements.txt ] || pip install -r requirements.txt }createVenvNode(){ python3 -m venv . && source ./bin/activate && pip install nodeenv && nodeenv -p }Or since you really want to create a venv environment in a new folder (where its name should be the basename of your current directory) then the functions would be: createVenv() {# dest="${PWD##*/}" # You can run the function `getBaseName` and assign its output like this: dest=$(getBaseName)if python3 -m venv "$dest" ; then cd "$dest" source "./bin/activate" [ ! -f "./requirements.txt" ] || pip install -r requirements.txt echo You are now in new venv environment else echo "Failed to create 'venv' environment" >&2 fi}createVenvNode(){# dest="${PWD##*/}"# You can run the function `getBaseName` and assign its output like this: dest=$(getBaseName)if python3 -m venv "$dest" ; then cd "$dest" source "./bin/activate" # You can test the exit status of these commands with an if statement too pip install nodeenv && nodeenv -p echo You are now in new venv environment else echo "Failed to create 'venv' environment" >&2 }
Can't seem to figure out what the issue is. This is on a Fedora 37 with default setup (bash, gnome, etc...). What I want to achieve is to create an alias that creates a python virtual environment, where the folder name for the virtual environment is the name of the current working directory (something akin to python3 -m venv $cwd). This is helpful especially when activating the venv (and later switching directories between project) you can easily identify which venv is enabled. But for some odd reason this is not working as I expected. To note that I don't have much experience in creating complex aliases but still. I have created the following vars in .bashrc:export cwd="pwd | rev | cut -d '/' -f1 | rev"If I run this in termnial it displays the directory name test as I need it, but when running $cwd in the terminal I get home/<USERNAME>/Projects/VueJS/testexport cwd2="${PWD##*/}"This one just displays my username for some reason. I've searched here on stackoverflow and this was one of the suggested methods to get the current directory nameSome indication on how to get started or where to look for info are appreciated. I've tried to search on multiple sources but I can't seem to figure it. I read somewhere that double and single quotes make a difference, but I couldn't understand why and if it would affect this behaviour. EDIT: To clarify, what I want my alias to run is i.e:python3 -m venv <CURRENT_DIRECTORY_NAME> && source <CURRENT_DIRECTORY_NAME>/bin/activate && [ ! -f ./requirements.txt ] || pip install -r requirements.txtThis creates a virtual for python projectspython3 -m venv <CURRENT_DIRECTORY_NAME> && source <CURRENT_DIRECTORY_NAME>/bin/activate && pip install nodeenv && nodeenv -pThis creates virtual environments for projects that depend on nodejs, which in itself depend on python venv
Set alias to run python venv setup based on current directory name
From man pwd on my Ubuntu:your shell may have its own version of pwdI use bash. Simple pwd command gives me a path with respect to the symbolic link; yet /bin/pwd returns the actual path. The cd command is also a bash builtin. In other words: this is shell specific. EDIT: thrig's comment (see below) seems to be a better alternative to everything I wrote below this line. To "back up" into the actual directory try cd "$(/bin/pwd)/.." or cd "$(/bin/pwd)"; cd ... The second form may be tweaked to build an alias to cd, I think: alias cd='cd "$(/bin/pwd)"; cd'In the similar way you can get rid of bash pwd builtin: alias pwd=`/bin/pwd`
I am experimenting with symbolic links and I'm encountering a couple issues. The first is how after following a symbolic link to a directory to display the actual working directory instead of the directory with respect to the symbolic link (when using pwd, for instance). The second is how to "back up" into the actual directory in the file system instead of backing into the symbolic link.
How to work with symbolic links to directories
The logical value of the current working directory (logical cwd, what you call “unresolved pwd”) is an internal concept of the shell, not a concept of the kernel. The kernel only remembers the fully resolved path (physical cwd). So you won't get the information you want through generic system interfaces. You have to get the shell's cooperation. The PWD environment variable is how shells transmit the logical cwd to their subprocesses. When a shell runs another shell, the parent sets PWD to the logical cwd (it does this whenever it runs a program), and the child checks PWD that the value of PWD is sensible and if so uses that as its logical cwd, falling back to the physical cwd if $PWD is missing or wrong. Observe: #!/bin/sh mkdir /tmp/dir ln -sf dir /tmp/link cd /tmp/link sh -c 'echo Default behavior: "$PWD"' env -u PWD sh -c 'echo Unset PWD: "$PWD"' PWD=/something/fishy sh -c 'echo Wrong PWD: "$PWD"' rm /tmp/link rmdir /tmp/dirOutput: Default behavior: /tmp/link Unset PWD: /tmp/dir Wrong PWD: /tmp/dirReading the process's environment doesn't have any particular security implications, but what it tells you is what the value of PWD was when the process started. If the processed changed to another directory, the value in the environment is no longer relevant. What you need is the value that would be in the environment if the shell ran another process now. But the only way for this to appear is to actually make the shell run another process. The typical way for GUIs to find the cwd of a shell that they run is to make the shell print it out. If you need the information occasionally and want to leave maximum control over the shell configuration to the user, ensure that the shell is displaying a prompt and issue the pwd command. This is simple, works even in “exotic” shells like csh and fish, but is ambiguous in corner cases (e.g. a directory name containing newlines). If it's ok to tweak the shell configuration, you can make the shell print an escape sequence each time it displays a prompt (PS1 for many shells, but the way to make it include the current directory varies), or when it changes directories (chpwd_functions in zsh, more invasive ways in other shells). Note that if a component of the logical cwd has been moved or removed, or if the symbolic link has been changed to point elsewhere, the value may be wrong. On the other hand the physical cwd will always be correct. (If the directory has been removed, Linux's /proc/PID/cwd, which is where all programs such as ps and lsof get their information, will appear as a broken symlink whose target ends in (deleted). I don't know what lsof reports on macOS for a deleted current directory.) So if you do find out the logical cwd, you should probably ensure that it matches the physical cwd and fall back to the physical cwd if it doesn't.
I'm hitting an issue where I need to get the unresolved symlink of a shell process. For example given a symlink ~/link -> ~/actual, if bash is launched with a $PWD of ~/link, I need to fetch that from outside the bash process. Getting the resolved cwd is possible using lsof or /proc as called out in https://unix.stackexchange.com/a/94359/115410 but I'm beginning to think it's not possible to get the unresolved path. I have tried to use lsof -b to not use readlink but the logging says that path never tries to use readlink anyway. It does appear possible to read the environment via /proc/.../environ and parse out PWD but this is slow, /proc may not exist on the system and I believe there are some security implications to trying to read a processes' environment. Here is the code in question I'm trying to fix: lsof on macOS: exec('lsof -OPln -p ' + this._ptyProcess.pid + ' | grep cwd', (error, stdout, stderr) => { ... });/proc on Linux: Promises.readlink(`/proc/${this._ptyProcess.pid}/cwd`);
Get the unresolved pwd of a shell from another process
The system needs to keep track of the current directory of all processes because otherwise processes couldn't use relative paths for anything (including for example file open or stat, and changing directories — what does chdir("..") mean if you don't track were the process currently sits?). There's also the matter that without tracking that info, the kernel wouldn't be able to check if a process is sitting inside a given mount point. So you'd be liable to accidentally unmount a filesystem from under a process, leading to inconsistent state. For your second question: think about hard links. They would be much harder to implement correctly and safely if the inode data was in the directory "structure" itself. Much easier to have essentially pointers to the inodes in the directory structure, makes adding or removing links to a given inode pretty simple.
I'm reading some doc about UNIX but I don't understand two things:Why is important for the kernel to know the current working directory of the running process? Why not keeping the inode information in the directory?
Kernel current working directory and inode information placement
You can change your initial location to your home by adding cd ~/To your ~/.bashrc You may also need to check that $HOME is set to your actual home directory export HOME=/home/user_name/
By default, every Linux distributions' Terminal I have used so far starts at /home/[username]. For some reason, without noticing, the default folder is now at root in Sabayon. How do I change the default starting folder in Terminal to be my username folder again?
Terminal has changed its default folder to start at
Nautilus can open multiple windows from the same process, but a process has a single current directory, so Nautilus can't change its directory based on what it's displaying in its windows. I can't think of a good reason for Nautilus to change its current directory anyway. What would be the point? When Nautilus needs to access a file in a directory, it can just construct the absolute path. What problem are you actually trying to solve?
I wanted to check the current directory opened in nautilus window. I check the pid of nautilus, and symbolic link proc/pid/cwd, always points to home directory. Is this expected behaviour? If so thenhow to check the opened directory of nautilus from command line?
Why cwd in /proc/nautilus_pid/cwd always points to /home/username?
When you right click the file or folder in Nemo, there will be a + sign at the top. Clicking that will expand the menu and give you the options you want. For what it's worth, I found this functionality at this link: https://forums.linuxmint.com/viewtopic.php?t=212256
I recently did a clean install of Linux Mint 17.3 with Cinnamon on my machine. Before the clean install, if I right clicked on a file or folder in nemo, the menu would have a 'create shortcut' option. Now after the clean install, that option isn't there. I've gone through the nemo preferences and I can't find any option to enable it. After some searching I found out a keyboard shortcut for making file shortcuts in nemo (ctrl+shift+click and drag), but I'd much rather the more intuitive (and memorable) right click menu option. Similarly, other right click options that are now missing are copy toother pane home Downloads etcmove toother pane home Downloads etcHow can I get those options back as well? I've tried searching through the Nemo preferences, but to no avail.
Right click menu in Nemo missing 'create shortcut' and 'copy/move to'
Most terminal programs like xterm, urxvt, gnome-terminal have an option to change the starting working directory of the shell. If you are using gnome-terminal, there is a special command line switch you have to provide to start the shell in a user defined directory. The command line switch I'm talking about is --working-directory=DIRNAMEYou should take a look at the manual pages of gnome-terminal to verify this. So, if you want to make a desktop shortcut, the command you have to enter would be: gnome-terminal --working-directory=/home/you_username/Dropbox/GTDBeforehand feel free to test the command in your current terminal session.For users on Linux Mint, follow these instructionsRight click on the Desktop Select "Create Launcher" Name this shortcut with whatever name you want In the Command field, enter gnome-terminal --working-directory=XXX. Make sure to replace XXX with the directory you want it to go to (see the example above)
Objective I am looking for an easy way to consistently run a terminal that automatically opens to a specific directory. Is there a way to do that without changing the default directory? Preferably I just click on a 'shortcut' link and it opens that customized terminal to that directory or maybe runs the CD command for me. Full Story Currently, when I open the terminal (via the Linux Mint GUI menu) it by default 'takes' me to the home directory. This is a fine default choice for the majority of times. However, there are instances where I wish it would open elsewhere. I don't wish typing the CD command every time, for example: cd Dropbox/GTDSince I go to work on the files located on that specific directory every now and then (enough to be a pain), I am hoping someone can point a way so all I do is ideallyClick on a desktop shortcut (script or whatever mechanism) Terminal opens under that specific directory without me typing any commands. I can instantly work on the files located there. If I open another terminal outside that 'shortcut', the terminal opens to the default home directory like usual.I have a basic understanding working with the command line and Linux in general but am not advanced. Hopefully, you can dumb it down a bit ^_^ Oh and thanks in advance for any tidbits that can help point me in the right direction.
How to make a Desktop "shortcut" that opens the terminal but under a different directory than the default home?
You can use main menu. There is Tools -> Create Desktop Entry. It might require root permissions.
After installing PyCharm on Pop! OS (by extracting the download) there is no easy way to run the program. I have probably installed it in my Documents folder. Not sure what the convention is. To run PyCharm I need to go to the folder pycharm-community-2019.2.4/bin, open terminal and run ./pycharm.shAny way to make my life easier?
PyCharm has no shortcut or launcher
Create a desktop file for Teamspeak 3 server and place it at /usr/share/applications directory and run sudo update-desktop-database. how to create the desktop file open any text editor of your choice and place the lines bellow and save it with any name you want like teamspeak_3_server.desktop . [Desktop Entry] Type=Application Exec=/usr/bin/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh Icon=/path/to/teamspeak3/icon Name=Teamspeak 3 server GenericName=Teamspeak Categories=Network;Change the icon path if you want a fancy application icon. I suggest to create a symlink for ts3server_minimal_runscript.sh to avoid the long line and change the Exec= line of the desktop file. sudo ln -s /usr/bin/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh /usr/bin/ts3server
I am using Debian and I want to make a icon on the launcher that I can click on to open my Teamspeak server. Currently, I have to go to the terminal and type the following commands. cd /usr/bin/teamspeak3-server_linux-amd64 ./ts3server_minimal_runscript.shThis launches my Teamspeak 3 server, leaving the terminal open which is time consuming and annoying to have a terminal open solely for this purpose. In Ubuntu I just made a .desktop file and dragged the icon onto my launcher, which is miles better. Not sure how to do that on Debian though, can someone advise?
Create Launcher Shortcut
I think its name is "Toggle Scale" on the keyboard shortcuts settings.
I noted it is possible set a number of hotkeys in Linux Mint 17.1 using the keyboard application, but there's not possibility to set the hotkey "Show All Windows"; you can only set a button using Preferences -> Hot Corners. You can set customize hotkey too, but I'm not able to do that. Browsing on the internet, I did not find anything as tutorial, wiki,... to do that. Can someone suggest what I have to do setting that?
What is hotkey in Linux Mint for "Show All Windows"?
As Ipor Sircer suggests, if you can open another terminal, you can run gnome-terminal from there. Alternatively, you can dump gnome-terminal's output to a file: assuming you're running GNOME, press AltF2 and enter sh -c "gnome-terminal > ~/gnome-terminal.log 2>&1"Then you'll find all the output in ~/gnome-terminal.log.
When I try and open the gnome terminal, by clicking the 'terminal' icon in apps, I get a loading and then nothing happens. Is there some way of seeing the background output of trying to open it to try an ddebug it? UPDATE 1: So I was able to open xterminal and tried starting the gnome terminal like this: gnome-terminal This resulted in this output, sorry if it is slightly wrong I had to manually copy it since I couldn't work out how to copy and paste in xterminal: Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 8UPDATE 2: So I got it working again by using google fu to find this thread which got me to enter: locale-gen and reboot which seemed to fix it.
Gnome Terminal not opening
I figured this one out. I was trying different shortcut combinations by changing this "key" org.gnome.desktop.wm.keybindings switch-input-source – inside dconf Editor. The correct combination value in order to use (the left) Alt + Shift was: ['<Alt>Shift_L'].
I'm using GNOME 3.28.0 (in Arch Linux). I do also use two languages, so I constantly switch back and forth between those. I'm trying to configure the shortcut(s) to switch between sources – inside Settings > Devices > Keyboard, but so far, I'm unable to use the ones that I would like: Alt + Shift – and if possible, disable the shortcut to Switch to previous input source (since I only use two languages). The default ones are: Super + Space and Shift + Super + Space. Any clues?UPDATE I tried to set it up "manually" using dconf Editor and the "key" org.gnome.desktop.wm.keybindings switch-input-source...but for some reason it doesn't like Alt + Shift. I even restarted the system just in case.
Configure switch between sources in GNOME