Debian Stretch下Qt Creator无法运行,创建device.xml报错求助
Hey Gary, let's work through this frustrating Qt Creator issue you're hitting on Debian Stretch. I've dealt with similar permission-related glitches before, so here are some targeted fixes to try:
Clean up stale config files first
Sometimes manually creating the config directories can leave behind hidden permission mismatches. Let's start fresh:- Make sure Qt Creator is fully closed (kill any background processes with
killall qtcreator) - Delete the entire existing QtProject config folder:
rm -rf ~/.config/QtProject - Don't recreate the directory manually—let Qt Creator generate it on its own when you launch it next. This ensures the folder has the correct user ownership and permissions from the start.
- Make sure Qt Creator is fully closed (kill any background processes with
Verify directory ownership (not just permission bits)
Settingxrwpermissions isn't enough if the directory is owned by another user (like root, if you ran the installer withsudo):- Check the owner of your
.configdirectory with:ls -ld ~/.config - If the output doesn't show
gary garyas the owner/group, fix it recursively with:sudo chown -R gary:gary ~/.config
This ensures Qt Creator (running as your user) has full access to write its config files.
- Check the owner of your
Install via Debian's official repositories (instead of the online installer)
Your Synaptic issue might have been due to an outdated package list or missing core packages. Try this:- Update your package index first:
sudo apt update - Install the core Qt Creator and Qt5 runtime packages:
sudo apt install qtcreator qt5-default - Launch Qt Creator with
qtcreatorand see if the freeze/error persists. This avoids potential permission conflicts from the online installer.
- Update your package index first:
Check for AppArmor restrictions
Debian Stretch uses AppArmor by default, which can block apps from writing to certain directories even if file permissions look correct:- Check if AppArmor is active:
sudo aa-status - Temporarily stop it to test:
sudo systemctl stop apparmor - Launch Qt Creator—if it works, you'll need to adjust AppArmor's rules for Qt Creator or add an exemption to allow it to write to
~/.config/QtProject.
- Check if AppArmor is active:
Reinstall the online installer as a regular user
If you ran the online installer withsudobefore, it might have set ownership of Qt's installation files to root. Try this:- Uninstall your current Qt installation using the online installer (launch it again and select "Uninstall")
- Close the installer, then re-run it without
sudo:./qt-unified-linux-x64-3.0.4-online.run - Install Qt Creator again as your regular user—this ensures all files and configs are owned by
gary.
Start with the config cleanup and ownership check—those are the most likely fixes for the "Cannot create file /home/gary/.config/QtProject/qtcreator/device.xml Unknown error" message. Let me know how it goes!
内容的提问来源于stack exchange,提问作者Gary E

